remove unimplemented bang_trigger() and replace with bang_trigger_at(n)

normally we operate on TriggerPtr's which are a safe way to track
 trigger lifetime, safely modify their properties, and launch them.

bang_trigger_at() is a convenience function to look up a trigger by index,
 and launch it, in one step.  Potentially useful for control surfaces.
This commit is contained in:
Ben Loftis 2022-09-30 08:37:05 -05:00
parent 1e283adb22
commit 07f47ff6a5
2 changed files with 27 additions and 2 deletions

View File

@ -726,8 +726,9 @@ class LIBARDOUR_API TriggerBox : public Processor
TriggerPtr trigger (Triggers::size_type);
bool bang_trigger (TriggerPtr);
bool unbang_trigger (TriggerPtr);
void bang_trigger_at (Triggers::size_type row);
void unbang_trigger_at (Triggers::size_type row);
void add_trigger (TriggerPtr);
void fast_forward (CueEvents const &, samplepos_t transport_postiion);

View File

@ -3668,6 +3668,30 @@ TriggerBox::stop_all_quantized ()
}
}
void
TriggerBox::bang_trigger_at (Triggers::size_type row)
{
TriggerPtr t = trigger(row);
if (t) {
t->bang();
} else {
/* by convention, an empty slot is effectively a STOP button */
stop_all_quantized();
}
}
void
TriggerBox::unbang_trigger_at (Triggers::size_type row)
{
TriggerPtr t = trigger(row);
if (t) {
t->unbang();
} else {
/* by convention, an empty slot is effectively a STOP button */
/* ...but you shouldn't be able to unbang an empty slot; so if this occurs, let's just ignore it */
}
}
void
TriggerBox::drop_triggers ()
{