diff options
Diffstat (limited to 'src/server/events/CreateBlock.cpp')
-rw-r--r-- | src/server/events/CreateBlock.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/server/events/CreateBlock.cpp b/src/server/events/CreateBlock.cpp index 28afe4b2..231df4e2 100644 --- a/src/server/events/CreateBlock.cpp +++ b/src/server/events/CreateBlock.cpp @@ -28,6 +28,7 @@ #include "GraphImpl.hpp" #include "PluginImpl.hpp" #include "PortImpl.hpp" +#include "PreProcessContext.hpp" namespace Ingen { namespace Server { @@ -53,7 +54,7 @@ CreateBlock::~CreateBlock() } bool -CreateBlock::pre_process() +CreateBlock::pre_process(PreProcessContext& ctx) { typedef Resource::Properties::const_iterator iterator; @@ -137,8 +138,8 @@ CreateBlock::pre_process() /* Compile graph with new block added for insertion in audio thread TODO: Since the block is not connected at this point, a full compilation could be avoided and the block simply appended. */ - if (_graph->enabled()) { - _compiled_graph = _graph->compile(); + if (ctx.must_compile(_graph)) { + _compiled_graph = CompiledGraph::compile(_graph); } _update.put_block(_block); @@ -149,9 +150,8 @@ CreateBlock::pre_process() void CreateBlock::execute(RunContext& context) { - if (_block) { - _graph->set_compiled_graph(_compiled_graph); - _compiled_graph = NULL; // Graph takes ownership + if (_status == Status::SUCCESS && _compiled_graph) { + _compiled_graph = _graph->swap_compiled_graph(_compiled_graph); } } |