summaryrefslogtreecommitdiffstats
path: root/src/libs/engine/Patch.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2006-06-21 03:27:16 +0000
committerDavid Robillard <d@drobilla.net>2006-06-21 03:27:16 +0000
commita603f4a917bd5a7d806ff8394e2bfbe0f64acc64 (patch)
treecb2fe94e1bb08c8d603918bf94d8ee362e98d4eb /src/libs/engine/Patch.cpp
parent032d526710d174b30e0c9f33ff9f7e60e99fb172 (diff)
downloadingen-a603f4a917bd5a7d806ff8394e2bfbe0f64acc64.tar.gz
ingen-a603f4a917bd5a7d806ff8394e2bfbe0f64acc64.tar.bz2
ingen-a603f4a917bd5a7d806ff8394e2bfbe0f64acc64.zip
Got the audio flowing
git-svn-id: http://svn.drobilla.net/lad/grauph@70 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/engine/Patch.cpp')
-rw-r--r--src/libs/engine/Patch.cpp23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/libs/engine/Patch.cpp b/src/libs/engine/Patch.cpp
index 8a8ca60a..634b3bbd 100644
--- a/src/libs/engine/Patch.cpp
+++ b/src/libs/engine/Patch.cpp
@@ -348,14 +348,14 @@ Patch::remove_port(const Port* port)
Array<Node*>*
Patch::build_process_order() const
{
- Node* node = NULL;
Array<Node*>* const process_order = new Array<Node*>(_nodes.size());
+ // FIXME: tweak algorithm so it just ends up like this and save the iteration?
for (List<Node*>::const_iterator i = _nodes.begin(); i != _nodes.end(); ++i)
(*i)->traversed(false);
// Traverse backwards starting at outputs
- for (List<Port*>::const_iterator p = _output_ports.begin(); p != _output_ports.end(); ++p) {
+ //for (List<Port*>::const_iterator p = _output_ports.begin(); p != _output_ports.end(); ++p) {
/*const Port* const port = (*p);
for (List<Connection*>::const_iterator c = port->connections().begin();
@@ -366,16 +366,31 @@ Patch::build_process_order() const
assert(connection->src_port()->parent_node());
build_process_order_recursive(connection->src_port()->parent_node(), process_order);
}*/
- }
+ //}
+
// Add any (disjoint) nodes that weren't hit by the traversal
- for (List<Node*>::const_iterator i = _nodes.begin(); i != _nodes.end(); ++i) {
+ /*for (List<Node*>::const_iterator i = _nodes.begin(); i != _nodes.end(); ++i) {
node = (*i);
if ( ! node->traversed()) {
process_order->push_back(*i);
node->traversed(true);
}
+ }*/
+
+ for (List<Node*>::const_iterator i = _nodes.begin(); i != _nodes.end(); ++i) {
+ Node* const node = (*i);
+ // Either a sink or connected to our output ports:
+ if ( (!node->traversed()) && node->dependants()->size() == 0)
+ build_process_order_recursive(node, process_order);
+ }
+
+ cerr << "----------------------------------------\n";
+ for (size_t i=0; i < process_order->size(); ++i) {
+ assert(process_order->at(i));
+ cerr << process_order->at(i)->path() << endl;
}
+ cerr << "----------------------------------------\n";
assert(process_order->size() == _nodes.size());