diff --git a/libs/surfaces/faderport8/actions.cc b/libs/surfaces/faderport8/actions.cc index 5789961ea1..9b7bd54788 100644 --- a/libs/surfaces/faderport8/actions.cc +++ b/libs/surfaces/faderport8/actions.cc @@ -287,54 +287,29 @@ FaderPort8::button_solo_clear () void FaderPort8::button_mute_clear () { - StripableList all; - session->get_stripables (all); - 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); - } - } - - bool mute = false; #ifdef FP8_MUTESOLO_UNDO - if (cl->empty ()) { + if (session->muted ()) { + _mute_state = session->cancel_all_mute (); + } else { /* restore mute */ + boost::shared_ptr cl (new ControlList); for (std::vector >::const_iterator i = _mute_state.begin(); i != _mute_state.end(); ++i) { boost::shared_ptr ac = (*i).lock(); - if (ac) { - cl->push_back (ac); + if (!ac) { + continue; + } + cl->push_back (ac); + if (ac->automation_state() == Touch && !ac->touching ()) { + ac->start_touch (ac->session().transport_frame()); } } - mute = true; - } else { - /* save muted control IDs */ - _mute_state.clear (); - for (ControlList::const_iterator i = cl->begin (); i != cl->end (); ++i) { - _mute_state.push_back (boost::weak_ptr(*i)); + if (!cl->empty()) { + session->set_controls (cl, 1.0, PBD::Controllable::NoGroup); } } +#else + session->cancel_all_mute (); #endif - - if (cl->empty ()) { - return; - } - - for (ControlList::const_iterator i = cl->begin (); i != cl->end (); ++i) { - if ((*i)->automation_state() == Touch && !(*i)->touching ()) { - (*i)->start_touch ((*i)->session().transport_frame()); - } - } - - session->set_controls (cl, mute ? 1.0 : 0.0, mute ? PBD::Controllable::NoGroup : PBD::Controllable::UseGroup); } void diff --git a/libs/surfaces/faderport8/callbacks.cc b/libs/surfaces/faderport8/callbacks.cc index 28fa9fd954..78dc7f7a78 100644 --- a/libs/surfaces/faderport8/callbacks.cc +++ b/libs/surfaces/faderport8/callbacks.cc @@ -196,23 +196,7 @@ FaderPort8::notify_solo_changed () void FaderPort8::notify_mute_changed () { - bool muted = false; - StripableList all; - session->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; - } - } + bool muted = session->muted (); #ifdef FP8_MUTESOLO_UNDO if (muted) { _mute_state.clear ();