summaryrefslogtreecommitdiff
path: root/libs/surfaces/faderport8
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2017-05-05 16:48:11 +0200
committerRobin Gareus <robin@gareus.org>2017-05-05 17:08:42 +0200
commit417f63a29e54bc962eeb9e5855656f7f7da8c55f (patch)
tree2c0eb6ede9194d83de963826a0b828c678dcbb6d /libs/surfaces/faderport8
parentd2c8d357dabb1f58bc5992e82232cdbbe99fb774 (diff)
FP8: use new libardour API
Diffstat (limited to 'libs/surfaces/faderport8')
-rw-r--r--libs/surfaces/faderport8/actions.cc53
-rw-r--r--libs/surfaces/faderport8/callbacks.cc18
2 files changed, 15 insertions, 56 deletions
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<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
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<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 ();