Move special-cased FP8 mute-state into libardour
authorRobin Gareus <robin@gareus.org>
Fri, 5 May 2017 14:47:25 +0000 (16:47 +0200)
committerRobin Gareus <robin@gareus.org>
Fri, 5 May 2017 14:47:25 +0000 (16:47 +0200)
libs/ardour/ardour/session.h
libs/ardour/session.cc

index 45f806bac40ffc22b3d113ddb05c41db5f6d71d5..dfeb1d0834cb2cdc04b633c877fe1bf95a542530 100644 (file)
@@ -836,6 +836,9 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
 
        /* session-wide solo/mute/rec-enable */
 
+       bool muted() const;
+       std::vector<boost::weak_ptr<AutomationControl> > cancel_all_mute ();
+
        bool soloing() const { return _non_soloed_outs_muted; }
        bool listening() const { return _listen_cnt > 0; }
        bool solo_isolated() const { return _solo_isolated_cnt > 0; }
index 2b86c62bea03e7a9f0a2c1e41cbbccf5ad084830..4ffb58566ed57038d5db5ab16fcea6b3be5fb6b2 100644 (file)
@@ -4174,6 +4174,59 @@ Session::update_route_solo_state (boost::shared_ptr<RouteList> r)
        set_dirty();
 }
 
+bool
+Session::muted () const
+{
+       // TODO consider caching the value on every MuteChanged signal,
+       // Note that API users may also subscribe to MuteChanged and hence
+       // this method needs to be called first.
+       bool muted = false;
+       StripableList all;
+       get_stripables (all);
+       for (StripableList::const_iterator i = all.begin(); i != all.end(); ++i) {
+               if ((*i)->is_auditioner() || (*i)->is_monitor()) {
+                       continue;
+               }
+               boost::shared_ptr<Route> r = boost::dynamic_pointer_cast<Route>(*i);
+               if (r && !r->active()) {
+                       continue;
+               }
+               boost::shared_ptr<MuteControl> mc = (*i)->mute_control();
+               if (mc && mc->muted ()) {
+                       muted = true;
+                       break;
+               }
+       }
+       return muted;
+}
+
+std::vector<boost::weak_ptr<AutomationControl> >
+Session::cancel_all_mute ()
+{
+       StripableList all;
+       get_stripables (all);
+       std::vector<boost::weak_ptr<AutomationControl> > muted;
+       boost::shared_ptr<ControlList> cl (new ControlList);
+       for (StripableList::const_iterator i = all.begin(); i != all.end(); ++i) {
+               if ((*i)->is_auditioner() || (*i)->is_monitor()) {
+                       continue;
+               }
+               boost::shared_ptr<Route> r = boost::dynamic_pointer_cast<Route> (*i);
+               if (r && !r->active()) {
+                       continue;
+               }
+               boost::shared_ptr<AutomationControl> ac = (*i)->mute_control();
+               if (ac && ac->get_value () > 0) {
+                       cl->push_back (ac);
+                       muted.push_back (boost::weak_ptr<AutomationControl>(ac));
+               }
+       }
+       if (!cl->empty ()) {
+               set_controls (cl, 0.0, PBD::Controllable::UseGroup);
+       }
+       return muted;
+}
+
 void
 Session::get_stripables (StripableList& sl) const
 {