FP8: use new libardour API
authorRobin Gareus <robin@gareus.org>
Fri, 5 May 2017 14:48:11 +0000 (16:48 +0200)
committerRobin Gareus <robin@gareus.org>
Fri, 5 May 2017 15:08:42 +0000 (17:08 +0200)
libs/surfaces/faderport8/actions.cc
libs/surfaces/faderport8/callbacks.cc

index 5789961ea1965c5432a27c6140413ad764a67424..9b7bd547885caff74df178a6ca65dc8b53b25e7e 100644 (file)
@@ -287,54 +287,29 @@ FaderPort8::button_solo_clear ()
 void
 FaderPort8::button_mute_clear ()
 {
-       StripableList all;
-       session->get_stripables (all);
-       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);
-               }
-       }
-
-       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<ControlList> cl (new ControlList);
                for (std::vector <boost::weak_ptr<AutomationControl> >::const_iterator i = _mute_state.begin(); i != _mute_state.end(); ++i) {
                        boost::shared_ptr<AutomationControl> 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<AutomationControl>(*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
index 28fa9fd95448d8f0e5055569ba88df2e72baf33a..78dc7f7a7870974aeca2e74536ed52cec132e8e3 100644 (file)
@@ -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<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;
-               }
-       }
+       bool muted = session->muted ();
 #ifdef FP8_MUTESOLO_UNDO
        if (muted) {
                _mute_state.clear ();