summaryrefslogtreecommitdiffstats
path: root/src/server/events/Connect.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2015-11-23 14:24:07 -0500
committerDavid Robillard <d@drobilla.net>2016-10-02 12:24:56 -0400
commit938456884934a74a2850c02edc17575021131709 (patch)
treeca3b5296ee9ab3b911499f2fbef8eafdc826bc0c /src/server/events/Connect.cpp
parenta077166ec6c31ad4aaab738b9dffc139bf3a4d50 (diff)
downloadingen-938456884934a74a2850c02edc17575021131709.tar.gz
ingen-938456884934a74a2850c02edc17575021131709.tar.bz2
ingen-938456884934a74a2850c02edc17575021131709.zip
Add parallelism-aware graph traversal
Diffstat (limited to 'src/server/events/Connect.cpp')
-rw-r--r--src/server/events/Connect.cpp34
1 files changed, 24 insertions, 10 deletions
diff --git a/src/server/events/Connect.cpp b/src/server/events/Connect.cpp
index 66f726a6..57bfb975 100644
--- a/src/server/events/Connect.cpp
+++ b/src/server/events/Connect.cpp
@@ -27,6 +27,7 @@
#include "OutputPort.hpp"
#include "PortImpl.hpp"
#include "types.hpp"
+#include "internals/BlockDelay.hpp"
namespace Ingen {
namespace Server {
@@ -111,19 +112,31 @@ Connect::pre_process()
provider...
*/
if (tail_block != head_block && tail_block->parent() == head_block->parent()) {
+ // Connection is between blocks inside a graph, compile graph
+
// The tail block is now a dependency (provider) of the head block
head_block->providers().insert(tail_block);
- tail_block->dependants().insert(head_block);
+
+ if (!dynamic_cast<Internals::BlockDelayNode*>(tail_block)) {
+ /* Arcs leaving a delay node are ignored for the purposes of
+ compilation, since the output is from the previous cycle and
+ does not affect execution order. Otherwise, the head block is
+ now a dependant of the head block. */
+ tail_block->dependants().insert(head_block);
+ }
+
+ if (_graph->enabled()) {
+ if (!(_compiled_graph = CompiledGraph::compile(_graph))) {
+ head_block->providers().erase(tail_block);
+ tail_block->dependants().erase(head_block);
+ return Event::pre_process_done(Status::COMPILATION_FAILED);
+ }
+ }
}
_graph->add_arc(_arc);
_head->increment_num_arcs();
- tail_output->inherit_neighbour(_head, _tail_remove, _tail_add);
- _head->inherit_neighbour(tail_output, _head_remove, _head_add);
-
- lock.unlock();
-
if (!_head->is_driver_port()) {
_voices = new Raul::Array<PortImpl::Voice>(_head->poly());
_head->get_buffers(*_engine.buffer_factory(),
@@ -132,9 +145,8 @@ Connect::pre_process()
false);
}
- if (_graph->enabled()) {
- _compiled_graph = _graph->compile();
- }
+ tail_output->inherit_neighbour(_head, _tail_remove, _tail_add);
+ _head->inherit_neighbour(tail_output, _head_remove, _head_add);
return Event::pre_process_done(Status::SUCCESS);
}
@@ -148,7 +160,9 @@ Connect::execute(RunContext& context)
_engine.maid()->dispose(_head->set_voices(context, _voices));
}
_head->connect_buffers();
- _graph->set_compiled_graph(_compiled_graph);
+ if (_compiled_graph) {
+ _graph->set_compiled_graph(_compiled_graph);
+ }
}
}