a better, deeper fix for "cancel all solo", as Session::cancel_all_solo()
authorPaul Davis <paul@linuxaudiosystems.com>
Wed, 13 Jul 2016 18:33:23 +0000 (14:33 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Wed, 13 Jul 2016 18:33:23 +0000 (14:33 -0400)
libs/ardour/ardour/session.h
libs/ardour/ardour/utils.h
libs/ardour/session.cc

index 696e97ca9d5ae063d1c785b1c345255a032be45e..c6f32bbe07bf95cfdcd5c3cfe29a0ca3161defff 100644 (file)
@@ -791,6 +791,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
        bool soloing() const { return _non_soloed_outs_muted; }
        bool listening() const { return _listen_cnt > 0; }
        bool solo_isolated() const { return _solo_isolated_cnt > 0; }
+       void cancel_all_solo ();
 
        static const SessionEvent::RTeventCallback rt_cleanup;
 
index 4edf9fb446f92a74fc6976567783d93ae7754bc8..cc6e5044cef0e017bc740f7c5a2752c9a6575cfc 100644 (file)
@@ -187,6 +187,17 @@ template<typename T> boost::shared_ptr<ControlList> route_list_to_control_list (
        return cl;
 }
 
+template<typename T> boost::shared_ptr<ControlList> stripable_list_to_control_list (StripableList& sl, boost::shared_ptr<T> (Stripable::*get_control)() const) {
+       boost::shared_ptr<ControlList> cl (new ControlList);
+       for (StripableList::const_iterator s = sl.begin(); s != sl.end(); ++s) {
+               boost::shared_ptr<AutomationControl> ac = ((*s).get()->*get_control)();
+               if (ac) {
+                       cl->push_back (ac);
+               }
+       }
+       return cl;
+}
+
 #if __APPLE__
 LIBARDOUR_API std::string CFStringRefToStdString(CFStringRef stringRef);
 #endif // __APPLE__
index 9e9b530ce3bf0de1a19ea78f72d17d3f25090689..67f43dc470ff565ff04bbe17978e631d51dbb0b7 100644 (file)
@@ -7041,3 +7041,14 @@ Session::auto_connect_thread_run ()
        }
        pthread_mutex_unlock (&_auto_connect_mutex);
 }
+
+void
+Session::cancel_all_solo ()
+{
+       StripableList sl;
+
+       get_stripables (sl);
+
+       set_controls (stripable_list_to_control_list (sl, &Stripable::solo_control), 0.0, Controllable::NoGroup);
+       clear_all_solo_state (routes.reader());
+}