diff --git a/libs/surfaces/control_protocol/basic_ui.cc b/libs/surfaces/control_protocol/basic_ui.cc index 9cd8de5d72..6f1668eedc 100644 --- a/libs/surfaces/control_protocol/basic_ui.cc +++ b/libs/surfaces/control_protocol/basic_ui.cc @@ -826,19 +826,41 @@ BasicUI::find_trigger (int x, int y) void BasicUI::bang (int x, int y) { - TriggerPtr tp = find_trigger (x, y); + boost::shared_ptr r = session->get_remote_nth_route (x); + if (!r) { + return; + } + boost::shared_ptr tb = r->triggerbox(); + + if (!tb || !tb->active()) { + return; + } + + TriggerPtr tp (tb->trigger (y)); + + if (!tp) { + return; + } + if (tp) { tp->bang (); } } void -BasicUI::unbang (int x, int y) +BasicUI::unbang (int x) { - TriggerPtr tp = find_trigger (x, y); - if (tp) { - tp->unbang (); + boost::shared_ptr r = session->get_remote_nth_route (x); + if (!r) { + return; } + boost::shared_ptr tb = r->triggerbox(); + + if (!tb || !tb->active()) { + return; + } + + tb->stop_all_quantized (); } diff --git a/libs/surfaces/control_protocol/control_protocol/basic_ui.h b/libs/surfaces/control_protocol/control_protocol/basic_ui.h index efc39c9439..e90cdeb5ac 100644 --- a/libs/surfaces/control_protocol/control_protocol/basic_ui.h +++ b/libs/surfaces/control_protocol/control_protocol/basic_ui.h @@ -165,7 +165,8 @@ class LIBCONTROLCP_API BasicUI { bool loop_button_onoff() const; void bang (int x, int y); - void unbang (int x, int y); + /* stop whatever is playing in the nth triggerbox */ + void unbang (int x); /* it would be nice to use TriggerPtr here but that implies including ardour/triggerbox.h */ boost::shared_ptr find_trigger (int x, int y);