+void
+MuteControl::post_add_master (boost::shared_ptr<AutomationControl> m)
+{
+ if (m->get_value()) {
+
+ /* boolean masters records are not updated until AFTER
+ * ::post_add_master() is called, so we can use them to check
+ * on whether any master was already enabled before the new
+ * one was added.
+ */
+
+ if (!muted_by_self() && !get_boolean_masters()) {
+ _muteable.mute_master()->set_muted_by_masters (true);
+ Changed (false, Controllable::NoGroup);
+ }
+ }
+}
+
+void
+MuteControl::pre_remove_master (boost::shared_ptr<AutomationControl> m)
+{
+ if (!m) {
+ /* null control ptr means we're removing all masters */
+ _muteable.mute_master()->set_muted_by_masters (false);
+ /* Changed will be emitted in SlavableAutomationControl::clear_masters() */
+ return;
+ }
+
+ if (m->get_value()) {
+ if (!muted_by_self() && (get_boolean_masters() == 1)) {
+ Changed (false, Controllable::NoGroup);
+ }
+ }
+}
+