Move special-cased FP8 mute-state into libardour

This commit is contained in:
Robin Gareus 2017-05-05 16:47:25 +02:00
parent 8288fa40b9
commit d2c8d357da
2 changed files with 56 additions and 0 deletions

View 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; }

View 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
{