diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/GraphImpl.cpp | 41 | ||||
-rw-r--r-- | src/server/GraphImpl.hpp | 48 |
2 files changed, 45 insertions, 44 deletions
diff --git a/src/server/GraphImpl.cpp b/src/server/GraphImpl.cpp index 081b5b16..f31994b9 100644 --- a/src/server/GraphImpl.cpp +++ b/src/server/GraphImpl.cpp @@ -142,10 +142,6 @@ GraphImpl::apply_internal_poly(ProcessContext& context, return true; } -/** Run the graph for the specified number of frames. - * - * Calls all Blocks in (roughly, if parallel) the order _compiled_graph specifies. - */ void GraphImpl::process(ProcessContext& context) { @@ -176,11 +172,6 @@ GraphImpl::set_buffer_size(Context& context, (*_compiled_graph)[i].block()->set_buffer_size(context, bufs, type, size); } -// Graph specific stuff - -/** Add a block. - * Preprocessing thread only. - */ void GraphImpl::add_block(BlockImpl& block) { @@ -188,9 +179,6 @@ GraphImpl::add_block(BlockImpl& block) _blocks.push_front(block); } -/** Remove a block. - * Preprocessing thread only. - */ void GraphImpl::remove_block(BlockImpl& block) { @@ -204,9 +192,6 @@ GraphImpl::add_arc(SPtr<ArcImpl> a) _arcs.insert(make_pair(make_pair(a->tail(), a->head()), a)); } -/** Remove an arc. - * Preprocessing thread only. - */ SPtr<ArcImpl> GraphImpl::remove_arc(const PortImpl* tail, const PortImpl* dst_port) { @@ -245,8 +230,6 @@ GraphImpl::num_ports_non_rt() const return _inputs.size() + _outputs.size(); } -/** Create a port. Not realtime safe. - */ DuplexPort* GraphImpl::create_port(BufferFactory& bufs, const Raul::Symbol& symbol, @@ -270,13 +253,6 @@ GraphImpl::create_port(BufferFactory& bufs, type, buffer_type, value, buffer_size, is_output); } -/** 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. - */ void GraphImpl::remove_port(DuplexPort& port) { @@ -287,13 +263,6 @@ GraphImpl::remove_port(DuplexPort& port) } } -/** 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. - */ void GraphImpl::clear_ports() { @@ -338,16 +307,6 @@ compile_recursive(BlockImpl* n, CompiledGraph* output) output->push_back(CompiledBlock(n, n->providers().size(), n->dependants())); } -/** Find the process order for this Graph. - * - * The process order is a flat list that the graph will execute in order - * when its run() method is called. Return value is a newly allocated list - * which the caller is reponsible to delete. Note that this function does - * NOT actually set the process order, it is returned so it can be inserted - * at the beginning of an audio cycle (by various Events). - * - * Not realtime safe. - */ CompiledGraph* GraphImpl::compile() { diff --git a/src/server/GraphImpl.hpp b/src/server/GraphImpl.hpp index b6f3cf73..049d7bff 100644 --- a/src/server/GraphImpl.hpp +++ b/src/server/GraphImpl.hpp @@ -72,7 +72,7 @@ public: /** Prepare for a new (internal) polyphony value. * - * Preprocessor thread, poly is actually applied by apply_internal_poly. + * Pre-process thread, poly is actually applied by apply_internal_poly. * \return true on success. */ bool prepare_internal_poly(BufferFactory& bufs, uint32_t poly); @@ -96,7 +96,14 @@ public: typedef boost::intrusive::slist< BlockImpl, boost::intrusive::constant_time_size<true> > Blocks; + /** Add a block to this graph. + * Pre-process thread only. + */ void add_block(BlockImpl& block); + + /** Remove a block from this graph. + * Pre-process thread only. + */ void remove_block(BlockImpl& block); Blocks& blocks() { return _blocks; } @@ -104,6 +111,11 @@ public: uint32_t num_ports_non_rt() const; + /** Create a port to be later added to this graph. + * Not realtime safe. This function is to be called by events in the + * pre-process thread to create ports which will later be installed in the + * process thread. + */ DuplexPort* create_port(BufferFactory& bufs, const Raul::Symbol& symbol, PortType type, @@ -125,11 +137,32 @@ public: _outputs.push_front(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. + */ void remove_port(DuplexPort& port); + + /** 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. + */ void clear_ports(); + /** Add an arc to this graph. + * Pre-processing thread only. + */ void add_arc(SPtr<ArcImpl> arc); + /** Remove an arc from this graph. + * Pre-processing thread only. + */ SPtr<ArcImpl> remove_arc(const PortImpl* tail, const PortImpl* head); @@ -140,7 +173,16 @@ public: Raul::Array<PortImpl*>* external_ports() { return _ports; } void external_ports(Raul::Array<PortImpl*>* pa) { _ports = pa; } - CompiledGraph* compile(); + /** Compile the graph into a version suitable for real-time execution. + * + * The CompiledGraph is a flat list that the graph will execute in order + * when its run() method is called. The returned object is newly allocated + * and owned by the caller. This function is non-realtime and does not + * affect processing, to take effect the returned object must be installed + * in the audio thread with set_compiled_graph(). + */ + CompiledGraph* compile(); + Raul::Array<PortImpl*>* build_ports_array(); /** Whether to run this graph's DSP bits in the audio thread */ @@ -160,7 +202,7 @@ private: CompiledGraph* _compiled_graph; ///< Process thread only Ports _inputs; ///< Pre-process thread only Ports _outputs; ///< Pre-process thread only - Blocks _blocks; ///< Pre-process thread only + Blocks _blocks; ///< Pre-process thread only bool _process; }; |