Ingen  0.5.1
Public Types | Public Member Functions | List of all members
Ingen::Server::GraphImpl Class Reference

A group of blocks in a graph, possibly polyphonic. More...

#include <GraphImpl.hpp>

+ Inheritance diagram for Ingen::Server::GraphImpl:
+ Collaboration diagram for Ingen::Server::GraphImpl:

Public Types

typedef boost::intrusive::slist< BlockImpl, boost::intrusive::constant_time_size< true > > Blocks
 
typedef boost::intrusive::slist< DuplexPort, boost::intrusive::constant_time_size< true > > Ports
 
- Public Types inherited from Ingen::Server::BlockImpl
enum  Mark {
  UNVISITED,
  VISITING,
  VISITED
}
 Mark used during graph compilation.
 
- Public Types inherited from Ingen::Node
enum  GraphType {
  GRAPH,
  BLOCK,
  PORT
}
 
typedef std::pair< const Node *, const Node * > ArcsKey
 
typedef std::map< ArcsKey, SPtr< Arc > > Arcs
 
- Public Types inherited from Ingen::Resource
enum  Graph {
  DEFAULT,
  EXTERNAL,
  INTERNAL
}
 

Public Member Functions

 GraphImpl (Engine &engine, const Raul::Symbol &symbol, uint32_t poly, GraphImpl *parent, SampleRate srate, uint32_t local_poly)
 
virtual GraphType graph_type () const
 
BlockImplduplicate (Engine &engine, const Raul::Symbol &symbol, GraphImpl *parent)
 Duplicate this Node. More...
 
void activate (BufferFactory &bufs)
 Activate this Block. More...
 
void deactivate ()
 Deactivate this Block. More...
 
void pre_process (RunContext &context)
 Do whatever needs doing in the process thread before process() is called.
 
void process (RunContext &context)
 Run block for an entire process cycle (calls run()). More...
 
void run (RunContext &context)
 Run block for a portion of process cycle (called from process()). More...
 
void set_buffer_size (RunContext &context, BufferFactory &bufs, LV2_URID type, uint32_t size)
 
bool prepare_internal_poly (BufferFactory &bufs, uint32_t poly)
 Prepare for a new (internal) polyphony value. More...
 
bool apply_internal_poly (RunContext &context, BufferFactory &bufs, Raul::Maid &maid, uint32_t poly)
 Apply a new (internal) polyphony value. More...
 
void add_block (BlockImpl &block)
 Add a block to this graph. More...
 
void remove_block (BlockImpl &block)
 Remove a block from this graph. More...
 
Blocks & blocks ()
 
const Blocks & blocks () const
 
uint32_t num_ports_non_rt () const
 
void add_input (DuplexPort &port)
 
void add_output (DuplexPort &port)
 
void remove_port (DuplexPort &port)
 Remove port from ports list used in pre-processing thread. More...
 
void clear_ports ()
 Remove all ports from ports list used in pre-processing thread. More...
 
void add_arc (SPtr< ArcImpl > arc)
 Add an arc to this graph. More...
 
SPtr< ArcImplremove_arc (const PortImpl *tail, const PortImpl *head)
 Remove an arc from this graph. More...
 
bool has_arc (const PortImpl *tail, const PortImpl *head) const
 
CompiledGraphswap_compiled_graph (CompiledGraph *cp) INGEN_WARN_UNUSED_RESULT
 Set a new compiled graph to run, and return the old one. More...
 
Raul::Array< PortImpl * > * external_ports ()
 
void external_ports (Raul::Array< PortImpl *> *pa)
 
Raul::Array< PortImpl * > * build_ports_array ()
 
bool enabled () const
 Whether to run this graph's DSP bits in the audio thread.
 
void enable ()
 
void disable (RunContext &context)
 
uint32_t internal_poly () const
 
uint32_t internal_poly_process () const
 
Engineengine ()
 
- Public Member Functions inherited from Ingen::Server::BlockImpl
 BlockImpl (PluginImpl *plugin, const Raul::Symbol &symbol, bool poly, GraphImpl *parent, SampleRate rate)
 
bool activated () const
 Return true iff this block is activated.
 
bool enabled () const
 Return true iff this block is enabled (not bypassed). More...
 
void set_enabled (bool e)
 Enable or disable (bypass) this block. More...
 
virtual LilvState * load_preset (const Raul::URI &uri)
 Load a preset from the world for this block. More...
 
virtual void apply_state (Worker *worker, const LilvState *state)
 Restore state. More...
 
virtual boost::optional< Resourcesave_preset (const Raul::URI &bundle, const Properties &props)
 Save current state as preset. More...
 
virtual void learn ()
 Learn the next incoming MIDI event (for internals)
 
virtual void post_process (RunContext &context)
 Do whatever needs doing in the process thread after process() is called.
 
virtual void set_port_buffer (uint32_t voice, uint32_t port_num, BufferRef buf, SampleCount offset)
 Set the buffer of a port to a given buffer (e.g. More...
 
virtual Nodeport (uint32_t index) const
 
virtual PortImplport_impl (uint32_t index) const
 
virtual PortImplport_by_symbol (const char *symbol)
 Get a port by symbol. More...
 
std::set< BlockImpl * > & providers ()
 Blocks that are connected to this Block's inputs. More...
 
std::set< BlockImpl * > & dependants ()
 Blocks that are connected to this Block's outputs. More...
 
virtual void set_polyphonic (bool p)
 Flag block as polyphonic. More...
 
virtual bool prepare_poly (BufferFactory &bufs, uint32_t poly)
 Prepare for a new (external) polyphony value. More...
 
virtual bool apply_poly (RunContext &context, Raul::Maid &maid, uint32_t poly)
 Apply a new (external) polyphony value. More...
 
virtual const Resourceplugin () const
 Information about the Plugin this Block is an instance of. More...
 
virtual const PluginImplplugin_impl () const
 Information about the Plugin this Block is an instance of. More...
 
virtual void plugin (PluginImpl *pi)
 
GraphImplparent_graph () const
 The Graph this Block belongs to. More...
 
uint32_t num_ports () const
 
virtual uint32_t polyphony () const
 
Mark get_mark () const
 
void set_mark (Mark m)
 
- Public Member Functions inherited from Ingen::Server::NodeImpl
const Raul::Symbol & symbol () const
 
Nodegraph_parent () const
 
NodeImplparent () const
 
virtual void set_path (const Raul::Path &new_path)
 Rename.
 
const Atomget_property (const Raul::URI &key) const
 Get a single property value. More...
 
const Raul::Path & path () const
 
- Public Member Functions inherited from Ingen::Node
Arcs & arcs ()
 
const Arcs & arcs () const
 
virtual LilvInstance * instance ()
 
virtual bool save_state (const std::string &dir) const
 
Raul::URI base_uri () const
 
- Public Member Functions inherited from Ingen::Resource
 Resource (const URIs &uris, const Raul::URI &uri)
 
Resourceoperator= (const Resource &rhs)
 
virtual const Atomset_property (const Raul::URI &uri, const Atom &value, Graph ctx=Graph::DEFAULT)
 Set (replace) a property value. More...
 
virtual const Atomset_property (const Raul::URI &uri, const URIs::Quark &value, Graph ctx=Graph::DEFAULT)
 Set (replace) a property value. More...
 
virtual bool add_property (const Raul::URI &uri, const Atom &value, Graph ctx=Graph::DEFAULT)
 Add a property value. More...
 
virtual void remove_property (const Raul::URI &uri, const Atom &value)
 Remove a property. More...
 
virtual void remove_property (const Raul::URI &uri, const URIs::Quark &value)
 Remove a property. More...
 
virtual bool has_property (const Raul::URI &uri, const Atom &value) const
 Return true iff a property is set with a specific value. More...
 
virtual bool has_property (const Raul::URI &uri, const URIs::Quark &value) const
 Return true iff a property is set with a specific value. More...
 
void set_properties (const Properties &p)
 Set (replace) several properties at once. More...
 
void add_properties (const Properties &p)
 Add several properties at once. More...
 
void remove_properties (const Properties &p)
 Remove several properties at once. More...
 
virtual void on_property (const Raul::URI &uri, const Atom &value)
 Hook called whenever a property is added. More...
 
virtual void on_property_removed (const Raul::URI &uri, const Atom &value)
 Hook called whenever a property value is removed. More...
 
virtual void set_uri (const Raul::URI &uri)
 
Properties properties (Resource::Graph ctx) const
 Get all the properties with a given context. More...
 
const URIsuris () const
 
const Raul::URI & uri () const
 
const Propertiesproperties () const
 
Propertiesproperties ()
 

Additional Inherited Members

- Static Public Member Functions inherited from Ingen::Node
static Raul::URI main_uri ()
 
static bool uri_is_path (const Raul::URI &uri)
 
static Raul::Path uri_to_path (const Raul::URI &uri)
 
static Raul::URI path_to_uri (const Raul::Path &path)
 
- Static Public Member Functions inherited from Ingen::Resource
static Raul::URI graph_to_uri (Graph g)
 
static Graph uri_to_graph (const char *uri)
 
static bool type (const URIs &uris, const Properties &properties, bool &graph, bool &block, bool &port, bool &is_output)
 Get the ingen type from a set of Properties. More...
 
- Protected Member Functions inherited from Ingen::Server::BlockImpl
PortImplnth_port_by_type (uint32_t n, bool input, PortType type)
 
- Protected Member Functions inherited from Ingen::Server::NodeImpl
 NodeImpl (const Ingen::URIs &uris, NodeImpl *parent, const Raul::Symbol &symbol)
 
- Protected Member Functions inherited from Ingen::Node
 Node (const URIs &uris, const Raul::Path &path)
 
- Protected Member Functions inherited from Ingen::Resource
const Atomset_property (const Raul::URI &uri, const Atom &value) const
 
- Protected Attributes inherited from Ingen::Server::BlockImpl
PluginImpl_plugin
 
Raul::Array< PortImpl * > * _ports
 Access in audio thread only.
 
uint32_t _polyphony
 
std::set< BlockImpl * > _providers
 Blocks connected to this one's input ports.
 
std::set< BlockImpl * > _dependants
 Blocks this one's output ports are connected to.
 
Mark _mark
 Mark for graph compilation algorithm.
 
bool _polyphonic
 
bool _activated
 
bool _enabled
 
- Protected Attributes inherited from Ingen::Server::NodeImpl
NodeImpl_parent
 
Raul::Path _path
 
Raul::Symbol _symbol
 
- Protected Attributes inherited from Ingen::Node
Arcs _arcs
 Graphs only.
 
- Protected Attributes inherited from Ingen::Resource
const URIs_uris
 

Detailed Description

A group of blocks in a graph, possibly polyphonic.

Note that this is also a Block, just one which contains Blocks. Therefore infinite subgraphing is possible, of polyphonic graphs of polyphonic blocks etc. etc.

Member Function Documentation

§ duplicate()

BlockImpl * Ingen::Server::GraphImpl::duplicate ( Engine engine,
const Raul::Symbol &  symbol,
GraphImpl parent 
)
virtual

§ activate()

void Ingen::Server::GraphImpl::activate ( BufferFactory bufs)
virtual

Activate this Block.

This function must be called in a non-realtime thread before it is inserted in to a graph. Any non-realtime actions that need to be done before the Block is ready for use should be done here.

Reimplemented from Ingen::Server::BlockImpl.

Referenced by Ingen::Server::Engine::activate().

§ deactivate()

void Ingen::Server::GraphImpl::deactivate ( )
virtual

Deactivate this Block.

This function must be called in a non-realtime thread after the block has been removed from its graph (i.e. processing is finished).

Reimplemented from Ingen::Server::BlockImpl.

§ process()

void Ingen::Server::GraphImpl::process ( RunContext context)
virtual

Run block for an entire process cycle (calls run()).

Reimplemented from Ingen::Server::BlockImpl.

§ run()

void Ingen::Server::GraphImpl::run ( RunContext context)
virtual

Run block for a portion of process cycle (called from process()).

Implements Ingen::Server::BlockImpl.

§ prepare_internal_poly()

bool Ingen::Server::GraphImpl::prepare_internal_poly ( BufferFactory bufs,
uint32_t  poly 
)

Prepare for a new (internal) polyphony value.

Pre-process thread, poly is actually applied by apply_internal_poly.

Returns
true on success.

§ apply_internal_poly()

bool Ingen::Server::GraphImpl::apply_internal_poly ( RunContext context,
BufferFactory bufs,
Raul::Maid &  maid,
uint32_t  poly 
)

Apply a new (internal) polyphony value.

Audio thread.

Parameters
contextProcess context
bufsNew set of buffers
polyMust be < the most recent value passed to prepare_internal_poly.
maidAny objects no longer needed will be pushed to this

§ add_block()

void Ingen::Server::GraphImpl::add_block ( BlockImpl block)

Add a block to this graph.

Pre-process thread only.

Referenced by duplicate().

§ remove_block()

void Ingen::Server::GraphImpl::remove_block ( BlockImpl block)

Remove a block from this graph.

Pre-process thread only.

§ remove_port()

void Ingen::Server::GraphImpl::remove_port ( DuplexPort port)

Remove port from ports list used in pre-processing thread.

Port is not removed from ports array for process thread (which could be simultaneously running).

Pre-processing thread or situations that won't cause races with it only.

§ clear_ports()

void Ingen::Server::GraphImpl::clear_ports ( )

Remove all ports from ports list used in pre-processing thread.

Ports are not removed from ports array for process thread (which could be simultaneously running). Returned is a (inputs, outputs) pair.

Pre-processing thread or situations that won't cause races with it only.

§ add_arc()

void Ingen::Server::GraphImpl::add_arc ( SPtr< ArcImpl arc)

Add an arc to this graph.

Pre-processing thread only.

Referenced by duplicate().

§ remove_arc()

SPtr< ArcImpl > Ingen::Server::GraphImpl::remove_arc ( const PortImpl tail,
const PortImpl head 
)

Remove an arc from this graph.

Pre-processing thread only.

§ swap_compiled_graph()

CompiledGraph * Ingen::Server::GraphImpl::swap_compiled_graph ( CompiledGraph cp)

Set a new compiled graph to run, and return the old one.


The documentation for this class was generated from the following files: