From e12432cc632125821d6ed192d129ef385fb25002 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sat, 5 Nov 2011 15:58:38 +0000 Subject: A few comments. git-svn-id: svn://localhost/ardour2/branches/3.0@10459 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/graph.cc | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'libs/ardour/graph.cc') diff --git a/libs/ardour/graph.cc b/libs/ardour/graph.cc index cb5ac65f11..0950ee28c0 100644 --- a/libs/ardour/graph.cc +++ b/libs/ardour/graph.cc @@ -238,8 +238,9 @@ Graph::dec_ref() { if (g_atomic_int_dec_and_test (&_finished_refcount)) { - // ok... this cycle is finished now. - // we are the only thread alive. + /* We have run all the nodes that are at the `output' end of + the graph, so there is nothing more to do this time around. + */ this->restart_cycle(); } @@ -306,11 +307,19 @@ Graph::rechain (boost::shared_ptr routelist) DEBUG_TRACE (DEBUG::Graph, string_compose ("============== setup %1\n", chain)); // set all refcounts to 0; + /* This will become the number of nodes that do not feed any other node; + once we have processed this number of those nodes, we have finished. + */ _init_finished_refcount[chain] = 0; + + /* This will become a list of nodes that are not fed by another node, ie + those at the `input' end. + */ _init_trigger_list[chain].clear(); _nodes_rt[chain].clear(); + /* Clear things out, and make _nodes_rt[chain] a copy of routelist */ for (RouteList::iterator ri=routelist->begin(); ri!=routelist->end(); ri++) { node_ptr_t n = boost::dynamic_pointer_cast (*ri); @@ -322,9 +331,21 @@ Graph::rechain (boost::shared_ptr routelist) // now add refs for the connections. for (ni=_nodes_rt[chain].begin(); ni!=_nodes_rt[chain].end(); ni++) { + + /* We will set this to true if the node *ni is directly or + indirectly fed by anything (without feedback) + */ bool has_input = false; + + /* We will set this to true if the node *ni directly feeds + anything (without feedback) + */ bool has_output = false; + /* We will also set up *ni's _activation_set to contain any nodes + that it directly feeds. + */ + boost::shared_ptr rp = boost::dynamic_pointer_cast( *ni); for (RouteList::iterator ri=routelist->begin(); ri!=routelist->end(); ri++) { @@ -346,6 +367,7 @@ Graph::rechain (boost::shared_ptr routelist) } } + /* Increment the refcount of any route that we directly feed */ for (node_set_t::iterator ai=(*ni)->_activation_set[chain].begin(); ai!=(*ni)->_activation_set[chain].end(); ai++) { (*ai)->_init_refcount[chain] += 1; } -- cgit v1.2.3