From 3cffca9178965c404b60e6ef612c446df637f10d Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sat, 27 Aug 2022 08:26:08 -0600 Subject: [PATCH] control protocols: add trigger unbang method --- libs/surfaces/control_protocol/basic_ui.cc | 30 +++++++++++++++---- .../control_protocol/basic_ui.h | 4 +++ 2 files changed, 28 insertions(+), 6 deletions(-) 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 ();