13
0

control protocols: fix design of trigger unbang method

This commit is contained in:
Paul Davis 2022-08-27 08:32:03 -06:00
parent 3cffca9178
commit 19db8f9c68
2 changed files with 29 additions and 6 deletions

View File

@ -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<Route> r = session->get_remote_nth_route (x);
if (!r) {
return;
}
boost::shared_ptr<TriggerBox> 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<Route> r = session->get_remote_nth_route (x);
if (!r) {
return;
}
boost::shared_ptr<TriggerBox> tb = r->triggerbox();
if (!tb || !tb->active()) {
return;
}
tb->stop_all_quantized ();
}

View File

@ -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<ARDOUR::Trigger> find_trigger (int x, int y);