From d2c8d357dabb1f58bc5992e82232cdbbe99fb774 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Fri, 5 May 2017 16:47:25 +0200 Subject: [PATCH] Move special-cased FP8 mute-state into libardour --- libs/ardour/ardour/session.h | 3 ++ libs/ardour/session.cc | 53 ++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) 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 > 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 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 r = boost::dynamic_pointer_cast(*i); + if (r && !r->active()) { + continue; + } + boost::shared_ptr mc = (*i)->mute_control(); + if (mc && mc->muted ()) { + muted = true; + break; + } + } + return muted; +} + +std::vector > +Session::cancel_all_mute () +{ + StripableList all; + get_stripables (all); + std::vector > muted; + boost::shared_ptr 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 r = boost::dynamic_pointer_cast (*i); + if (r && !r->active()) { + continue; + } + boost::shared_ptr ac = (*i)->mute_control(); + if (ac && ac->get_value () > 0) { + cl->push_back (ac); + muted.push_back (boost::weak_ptr(ac)); + } + } + if (!cl->empty ()) { + set_controls (cl, 0.0, PBD::Controllable::UseGroup); + } + return muted; +} + void Session::get_stripables (StripableList& sl) const { -- 2.30.2