diff --git a/libs/surfaces/control_protocol/basic_ui.cc b/libs/surfaces/control_protocol/basic_ui.cc index 6a33b96804..9cd8de5d72 100644 --- a/libs/surfaces/control_protocol/basic_ui.cc +++ b/libs/surfaces/control_protocol/basic_ui.cc @@ -801,26 +801,44 @@ BasicUI::goto_nth_marker (int n) } } -void -BasicUI::bang (int x, int y) +ARDOUR::TriggerPtr +BasicUI::find_trigger (int x, int y) { boost::shared_ptr r = session->get_remote_nth_route (x); if (!r) { - return; + return TriggerPtr(); } boost::shared_ptr tb = r->triggerbox(); if (!tb || !tb->active()) { - return; + return TriggerPtr(); } TriggerPtr tp (tb->trigger (y)); if (!tp) { - return; + return TriggerPtr(); } - tp->bang (); + return tp; +} + +void +BasicUI::bang (int x, int y) +{ + TriggerPtr tp = find_trigger (x, y); + if (tp) { + tp->bang (); + } +} + +void +BasicUI::unbang (int x, int y) +{ + TriggerPtr tp = find_trigger (x, y); + if (tp) { + tp->unbang (); + } } diff --git a/libs/surfaces/control_protocol/control_protocol/basic_ui.h b/libs/surfaces/control_protocol/control_protocol/basic_ui.h index 74b5a3e049..efc39c9439 100644 --- a/libs/surfaces/control_protocol/control_protocol/basic_ui.h +++ b/libs/surfaces/control_protocol/control_protocol/basic_ui.h @@ -41,6 +41,7 @@ namespace ARDOUR { class Session; class SessionEvent; class Stripable; + class Trigger; } class LIBCONTROLCP_API BasicUI { @@ -164,6 +165,9 @@ class LIBCONTROLCP_API BasicUI { bool loop_button_onoff() const; void bang (int x, int y); + void unbang (int x, int y); + /* it would be nice to use TriggerPtr here but that implies including ardour/triggerbox.h */ + boost::shared_ptr find_trigger (int x, int y); protected: BasicUI ();