make handling of sends-only feed-based solo propagation symmetrical upstream and...
authorPaul Davis <paul@linuxaudiosystems.com>
Wed, 10 Aug 2011 15:13:15 +0000 (15:13 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Wed, 10 Aug 2011 15:13:15 +0000 (15:13 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@9972 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/ardour/session.cc

index 631a20aac7f42c374691cb6c3c11644a802fa3ca..e735eca8e7d0a610e0179a8f6a7058d13bd83ca2 100644 (file)
@@ -2309,6 +2309,8 @@ Session::route_solo_isolated_changed (void* /*src*/, boost::weak_ptr<Route> wpr)
 void
 Session::route_solo_changed (bool self_solo_change, void* /*src*/, boost::weak_ptr<Route> wpr)
 {
+       DEBUG_TRACE (DEBUG::Solo, string_compose ("route solo change, self = %1\n", self_solo_change));
+
        if (!self_solo_change) {
                // session doesn't care about changes to soloed-by-others
                return;
@@ -2316,16 +2318,12 @@ Session::route_solo_changed (bool self_solo_change, void* /*src*/, boost::weak_p
 
        if (solo_update_disabled) {
                // We know already
+               DEBUG_TRACE (DEBUG::Solo, "solo update disabled - changed ignored\n");
                return;
        }
 
        boost::shared_ptr<Route> route = wpr.lock ();
-
-       if (!route) {
-               /* should not happen */
-               error << string_compose (_("programming error: %1"), X_("invalid route weak ptr passed to route_solo_changed")) << endmsg;
-               return;
-       }
+       assert (route);
 
        boost::shared_ptr<RouteList> r = routes.reader ();
        int32_t delta;
@@ -2352,10 +2350,14 @@ Session::route_solo_changed (bool self_solo_change, void* /*src*/, boost::weak_p
                }
        }
 
+       DEBUG_TRACE (DEBUG::Solo, string_compose ("propagate solo change, delta = %1\n", delta));
+
        solo_update_disabled = true;
 
        RouteList uninvolved;
 
+       DEBUG_TRACE (DEBUG::Solo, string_compose ("%1\n", route->name()));
+
        for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
                bool via_sends_only;
                bool in_signal_flow;
@@ -2367,18 +2369,42 @@ Session::route_solo_changed (bool self_solo_change, void* /*src*/, boost::weak_p
 
                in_signal_flow = false;
 
+               DEBUG_TRACE (DEBUG::Solo, string_compose ("check feed from %1\n", (*i)->name()));
+               
                if ((*i)->feeds (route, &via_sends_only)) {
                        if (!via_sends_only) {
                                if (!route->soloed_by_others_upstream()) {
                                        (*i)->mod_solo_by_others_downstream (delta);
                                }
-                               in_signal_flow = true;
                        }
+                       in_signal_flow = true;
+               } else {
+                       DEBUG_TRACE (DEBUG::Solo, "\tno feed from\n");
                }
+               
+               DEBUG_TRACE (DEBUG::Solo, string_compose ("check feed to %1\n", (*i)->name()));
 
                if (route->feeds (*i, &via_sends_only)) {
-                       (*i)->mod_solo_by_others_upstream (delta);
+                       /* propagate solo upstream only if routing other than
+                          sends is involved, but do consider the other route
+                          (*i) to be part of the signal flow even if only
+                          sends are involved.
+                       */
+                       DEBUG_TRACE (DEBUG::Solo, string_compose ("%1 feeds %2 via sends only %3 sboD %4 sboU %5\n",
+                                                                 route->name(),
+                                                                 (*i)->name(),
+                                                                 via_sends_only,
+                                                                 route->soloed_by_others_downstream(),
+                                                                 route->soloed_by_others_upstream()));
+                       if (!via_sends_only) {
+                               if (!route->soloed_by_others_downstream()) {
+                                       DEBUG_TRACE (DEBUG::Solo, string_compose ("\tmod %1 by %2\n", (*i)->name(), delta));
+                                       (*i)->mod_solo_by_others_upstream (delta);
+                               }
+                       }
                        in_signal_flow = true;
+               } else {
+                       DEBUG_TRACE (DEBUG::Solo, "\tno feed to\n");
                }
 
                if (!in_signal_flow) {
@@ -2387,6 +2413,8 @@ Session::route_solo_changed (bool self_solo_change, void* /*src*/, boost::weak_p
        }
 
        solo_update_disabled = false;
+       DEBUG_TRACE (DEBUG::Solo, "propagation complete\n");
+
        update_route_solo_state (r);
 
        /* now notify that the mute state of the routes not involved in the signal
@@ -2394,6 +2422,7 @@ Session::route_solo_changed (bool self_solo_change, void* /*src*/, boost::weak_p
        */
 
        for (RouteList::iterator i = uninvolved.begin(); i != uninvolved.end(); ++i) {
+               DEBUG_TRACE (DEBUG::Solo, string_compose ("mute change for %1\n", (*i)->name()));
                (*i)->mute_changed (this);
        }