provisional changes to speed up solo changes to large numbers of routes.
authorPaul Davis <paul@linuxaudiosystems.com>
Fri, 25 Nov 2016 10:29:16 +0000 (10:29 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Fri, 25 Nov 2016 10:29:42 +0000 (10:29 +0000)
Moves global update of solo state and emission of Session::SoloChanged to
a single point after 1 to N solo controls are changed.

Also avoid unnecessarily emitted Activated() signal for listen controls,
though Process::{activate,deactive}() should probably be redesigned to
avoid this in a "deeper" way

libs/ardour/route.cc
libs/ardour/session.cc
libs/ardour/session_rtevents.cc

index c12c971caaeebdaf1a5a2c0c1ac053a2567bf34c..b31bfccf75f80a874e85cabf76f8fb3ceccdf82a 100644 (file)
@@ -627,6 +627,9 @@ void
 Route::set_listen (bool yn)
 {
        if (_monitor_send) {
+               if (_monitor_send->active() == yn) {
+                       return;
+               }
                if (yn) {
                        _monitor_send->activate ();
                } else {
index cfb08b48ecad0819c6e42536223520ecad3ec20a..b00c8a1d8f07dec28926f97f9ca2c362edd27bbf 100644 (file)
@@ -3790,8 +3790,6 @@ Session::route_listen_changed (Controllable::GroupControlDisposition group_overr
 
                _listen_cnt--;
        }
-
-       update_route_solo_state ();
 }
 
 void
@@ -3825,7 +3823,7 @@ Session::route_solo_isolated_changed (boost::weak_ptr<Route> wpr)
 void
 Session::route_solo_changed (bool self_solo_changed, Controllable::GroupControlDisposition group_override,  boost::weak_ptr<Route> wpr)
 {
-       DEBUG_TRACE (DEBUG::Solo, string_compose ("route solo change, self = %1\n", self_solo_changed));
+       DEBUG_TRACE (DEBUG::Solo, string_compose ("route solo change, self = %1, update\n", self_solo_changed));
 
        boost::shared_ptr<Route> route (wpr.lock());
 
@@ -3878,6 +3876,8 @@ Session::route_solo_changed (bool self_solo_changed, Controllable::GroupControlD
        RouteGroup* rg = route->route_group ();
        const bool group_already_accounted_for = (group_override == Controllable::ForGroup);
 
+       DEBUG_TRACE (DEBUG::Solo, string_compose ("propagate to session, group accounted for ? %1\n", group_already_accounted_for));
+
        if (delta == 1 && Config->get_exclusive_solo()) {
 
                /* new solo: disable all other solos, but not the group if its solo-enabled */
@@ -3991,8 +3991,6 @@ Session::route_solo_changed (bool self_solo_changed, Controllable::GroupControlD
 
        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
           pathway of the just-solo-changed route may have altered.
        */
@@ -4000,11 +3998,10 @@ Session::route_solo_changed (bool self_solo_changed, Controllable::GroupControlD
        for (RouteList::iterator i = uninvolved.begin(); i != uninvolved.end(); ++i) {
                DEBUG_TRACE (DEBUG::Solo, string_compose ("mute change for %1, which neither feeds or is fed by %2\n", (*i)->name(), route->name()));
                (*i)->act_on_mute ();
-               (*i)->mute_control()->Changed (false, Controllable::NoGroup);
+               /* Session will emit SoloChanged() after all solo changes are
+                * complete, which should be used by UIs to update mute status
+                */
        }
-
-       SoloChanged (); /* EMIT SIGNAL */
-       set_dirty();
 }
 
 void
@@ -4024,13 +4021,13 @@ Session::update_route_solo_state (boost::shared_ptr<RouteList> r)
        for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
                if ((*i)->can_solo()) {
                        if (Config->get_solo_control_is_listen_control()) {
-                               if ((*i)->self_soloed() || (*i)->solo_control()->get_masters_value()) {
+                               if ((*i)->solo_control()->soloed_by_self_or_masters()) {
                                        listeners++;
                                        something_listening = true;
                                }
                        } else {
                                (*i)->set_listen (false);
-                               if ((*i)->can_solo() && ((*i)->self_soloed() || (*i)->solo_control()->get_masters_value())) {
+                               if ((*i)->can_solo() && (*i)->solo_control()->soloed_by_self_or_masters()) {
                                        something_soloed = true;
                                }
                        }
@@ -4060,6 +4057,10 @@ Session::update_route_solo_state (boost::shared_ptr<RouteList> r)
 
        DEBUG_TRACE (DEBUG::Solo, string_compose ("solo state updated by session, soloed? %1 listeners %2 isolated %3\n",
                                                  something_soloed, listeners, isolated));
+
+
+       SoloChanged (); /* EMIT SIGNAL */
+       set_dirty();
 }
 
 void
index 00d966acaae62d4c92cc006a1c4b6d1123969127..5f1c7a54cba0f3ffeea5a9906978d2325f263cea 100644 (file)
@@ -64,9 +64,28 @@ Session::set_control (boost::shared_ptr<AutomationControl> ac, double val, Contr
 void
 Session::rt_set_controls (boost::shared_ptr<ControlList> cl, double val, Controllable::GroupControlDisposition gcd)
 {
+       /* Note that we require that all controls in the ControlList are of the
+          same type.
+       */
+       if (cl->empty()) {
+               return;
+       }
+
        for (ControlList::iterator c = cl->begin(); c != cl->end(); ++c) {
                (*c)->set_value (val, gcd);
        }
+
+       /* some controls need global work to take place after they are set. Do
+        * that here.
+        */
+
+       switch (cl->front()->parameter().type()) {
+       case SoloAutomation:
+               update_route_solo_state ();
+               break;
+       default:
+               break;
+       }
 }
 
 void