X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fmute_control.cc;h=fb6c9f01404408cdac86b9e9a56b8d77d1e8c93d;hb=32b73439275dbe2cccaa2a71026a951ea46d24b9;hp=0870732c5845f9d253fe931b96897f240bb3fcb8;hpb=05647470ef5646f4443c08aada03ca46d099cb14;p=ardour.git diff --git a/libs/ardour/mute_control.cc b/libs/ardour/mute_control.cc index 0870732c58..fb6c9f0140 100644 --- a/libs/ardour/mute_control.cc +++ b/libs/ardour/mute_control.cc @@ -22,7 +22,7 @@ #include "ardour/session.h" #include "ardour/mute_control.h" -#include "i18n.h" +#include "pbd/i18n.h" using namespace ARDOUR; using namespace std; @@ -52,7 +52,7 @@ MuteControl::post_add_master (boost::shared_ptr m) if (!muted_by_self() && !get_boolean_masters()) { _muteable.mute_master()->set_muted_by_masters (true); - Changed (false, Controllable::NoGroup); + Changed (false, Controllable::NoGroup); /* EMIT SIGNAL */ } } } @@ -67,9 +67,10 @@ MuteControl::pre_remove_master (boost::shared_ptr m) return; } - if (m->get_value()) { - if (!muted_by_self() && (get_boolean_masters() == 1)) { - Changed (false, Controllable::NoGroup); + if (m->get_value() && get_boolean_masters() == 1) { + _muteable.mute_master()->set_muted_by_masters (false); + if (!muted_by_self()) { + Changed (false, Controllable::NoGroup); /* EMIT SIGNAL */ } } } @@ -89,38 +90,40 @@ MuteControl::actually_set_value (double val, Controllable::GroupControlDispositi SlavableAutomationControl::actually_set_value (val, gcd); } -void -MuteControl::master_changed (bool self_change, Controllable::GroupControlDisposition gcd, boost::shared_ptr m) +bool +MuteControl::handle_master_change (boost::shared_ptr m) { bool send_signal = false; boost::shared_ptr mc = boost::dynamic_pointer_cast (m); + if (!mc) { + return false; + } if (m->get_value()) { /* this master is now enabled */ - if (!muted_by_self() && get_boolean_masters() == 0) { + if (get_boolean_masters() == 0) { _muteable.mute_master()->set_muted_by_masters (true); - send_signal = true; + if (!muted_by_self()) { + send_signal = true; + } } } else { /* this master is disabled and there was only 1 enabled before */ - if (!muted_by_self() && get_boolean_masters() == 1) { + if (get_boolean_masters() == 1) { _muteable.mute_master()->set_muted_by_masters (false); - send_signal = true; + if (!muted_by_self()) { + send_signal = true; + } } } - - update_boolean_masters_records (m); - - if (send_signal) { - Changed (false, Controllable::NoGroup); - } + return send_signal; } double MuteControl::get_value () const { if (slaved ()) { - return muted_by_self() || get_masters_value (); + return muted_by_self() || muted_by_masters (); } if (_list && boost::dynamic_pointer_cast(_list)->automation_playback()) { @@ -155,7 +158,7 @@ MuteControl::muted () const Control, or the Muteable that we sort-of proxy for. Since this method is called by ::get_value(), use the latter to avoid recursion. */ - return _muteable.mute_master()->muted_by_self() || get_masters_value (); + return _muteable.mute_master()->muted_by_self() || muted_by_masters (); } bool @@ -167,7 +170,7 @@ MuteControl::muted_by_self () const bool MuteControl::muted_by_masters () const { - return get_masters_value (); + return _muteable.mute_master()->muted_by_masters (); } bool @@ -175,3 +178,39 @@ MuteControl::muted_by_others_soloing () const { return _muteable.muted_by_others_soloing (); } + +void +MuteControl::automation_run (samplepos_t start, pframes_t len) +{ + boolean_automation_run (start, len); + + bool valid = false; + bool mute = false; + + if (list() && automation_playback()) { + mute = list()->rt_safe_eval (start, valid) >= 0.5; + } + + if (!valid) { + return; + } + + if (muted_by_masters ()) { + /* already muted, no need to check further, + * except we need to up update implicit/explict mute + */ + if (muted_by_self () != mute) { + set_value_unchecked (mute ? 1. : 0.); + Changed (false, Controllable::NoGroup); /* EMIT SIGNAL */ + } + return; + } + + if (mute && !muted()) { + set_value_unchecked (1.0); // mute + Changed (false, Controllable::NoGroup); /* EMIT SIGNAL */ + } else if (!mute && muted()) { + set_value_unchecked (0.0); // unmute + Changed (false, Controllable::NoGroup); /* EMIT SIGNAL */ + } +}