summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libs/ardour/ardour/session.h3
-rw-r--r--libs/ardour/session.cc53
2 files changed, 56 insertions, 0 deletions
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index 45f806bac4..dfeb1d0834 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -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; }
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index 2b86c62bea..4ffb58566e 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -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
{