diff options
Diffstat (limited to 'src/server')
-rw-r--r-- | src/server/Engine.cpp | 18 | ||||
-rw-r--r-- | src/server/Engine.hpp | 3 | ||||
-rw-r--r-- | src/server/events/Copy.cpp | 2 | ||||
-rw-r--r-- | src/server/events/CreateBlock.cpp | 2 | ||||
-rw-r--r-- | src/server/events/CreateGraph.cpp | 5 | ||||
-rw-r--r-- | src/server/events/CreatePort.cpp | 2 |
6 files changed, 25 insertions, 7 deletions
diff --git a/src/server/Engine.cpp b/src/server/Engine.cpp index 35b71a39..eb7c94ee 100644 --- a/src/server/Engine.cpp +++ b/src/server/Engine.cpp @@ -525,6 +525,24 @@ Engine::process_all_events() } void +Engine::add_to_store(Node* const node) +{ + store()->add(node); + + if (BlockImpl* const block = dynamic_cast<BlockImpl*>(node)) { + for (uint32_t i = 0; i < block->num_ports(); ++i) { + store()->add(block->port(i)); + } + } + + if (GraphImpl* const graph = dynamic_cast<GraphImpl*>(node)) { + for (BlockImpl& block : graph->blocks()) { + store()->add(&block); + } + } +} + +void Engine::register_client(SPtr<Interface> client) { log().info(fmt("Registering client <%1%>\n") % client->uri().c_str()); diff --git a/src/server/Engine.hpp b/src/server/Engine.hpp index f735aedd..adae816b 100644 --- a/src/server/Engine.hpp +++ b/src/server/Engine.hpp @@ -124,6 +124,9 @@ public: /** Process all events (no RT limits). */ unsigned process_all_events(); + /** Add `node` and all its children to the store. */ + void add_to_store(Node* node); + Ingen::World* world() const { return _world; } Interface* interface() const { return _interface.get(); } diff --git a/src/server/events/Copy.cpp b/src/server/events/Copy.cpp index 53f62958..4a066691 100644 --- a/src/server/events/Copy.cpp +++ b/src/server/events/Copy.cpp @@ -120,7 +120,7 @@ Copy::engine_to_engine(PreProcessContext& ctx) // Add block to the store and the graph's pre-processor only block list _parent->add_block(*_block); - _engine.store()->add(_block); + _engine.add_to_store(_block); // Compile graph with new block added for insertion in audio thread _compiled_graph = ctx.maybe_compile(*_engine.maid(), *_parent); diff --git a/src/server/events/CreateBlock.cpp b/src/server/events/CreateBlock.cpp index eb696c6b..1910ef80 100644 --- a/src/server/events/CreateBlock.cpp +++ b/src/server/events/CreateBlock.cpp @@ -142,7 +142,7 @@ CreateBlock::pre_process(PreProcessContext& ctx) // Add block to the store and the graph's pre-processor only block list _graph->add_block(*_block); - store->add(_block); + _engine.add_to_store(_block); /* Compile graph with new block added for insertion in audio thread TODO: Since the block is not connected at this point, a full compilation diff --git a/src/server/events/CreateGraph.cpp b/src/server/events/CreateGraph.cpp index 99b29b66..3ac37d51 100644 --- a/src/server/events/CreateGraph.cpp +++ b/src/server/events/CreateGraph.cpp @@ -175,11 +175,8 @@ CreateGraph::pre_process(PreProcessContext& ctx) _graph->activate(*_engine.buffer_factory()); // Insert into store and build update to send to clients - _engine.store()->add(_graph); + _engine.add_to_store(_graph); _update.put_graph(_graph); - for (BlockImpl& block : _graph->blocks()) { - _engine.store()->add(&block); - } // Build and pre-process child events to create standard ports build_child_events(); diff --git a/src/server/events/CreatePort.cpp b/src/server/events/CreatePort.cpp index 3adf2f8b..0f63cc46 100644 --- a/src/server/events/CreatePort.cpp +++ b/src/server/events/CreatePort.cpp @@ -146,7 +146,7 @@ CreatePort::pre_process(PreProcessContext& ctx) (_flow == Flow::INPUT && _graph_port->is_input())); _graph_port->properties().insert(_properties.begin(), _properties.end()); - _engine.store()->add(_graph_port); + _engine.add_to_store(_graph_port); if (_flow == Flow::OUTPUT) { _graph->add_output(*_graph_port); } else { |