13
0

triggerbox: add Forward/ReverseTrigger follow actions

Live's Next/Prev do not skip empty slots or wrap. So do both-and
This commit is contained in:
Paul Davis 2022-01-02 17:09:58 -07:00
parent 8e7810f40c
commit 0f6aa118f0
3 changed files with 25 additions and 1 deletions

View File

@ -171,6 +171,8 @@ class LIBARDOUR_API Trigger : public PBD::Stateful {
QueuedTrigger, /* DP-style */ QueuedTrigger, /* DP-style */
NextTrigger, /* Live-style, and below */ NextTrigger, /* Live-style, and below */
PrevTrigger, PrevTrigger,
ForwardTrigger, /* any "next" skipping empties */
ReverseTrigger, /* any "prev" skipping empties */
FirstTrigger, FirstTrigger,
LastTrigger, LastTrigger,
AnyTrigger, AnyTrigger,

View File

@ -859,6 +859,8 @@ setup_enum_writer ()
REGISTER_CLASS_ENUM (Trigger, QueuedTrigger); REGISTER_CLASS_ENUM (Trigger, QueuedTrigger);
REGISTER_CLASS_ENUM (Trigger, NextTrigger); REGISTER_CLASS_ENUM (Trigger, NextTrigger);
REGISTER_CLASS_ENUM (Trigger, PrevTrigger); REGISTER_CLASS_ENUM (Trigger, PrevTrigger);
REGISTER_CLASS_ENUM (Trigger, ForwardTrigger);
REGISTER_CLASS_ENUM (Trigger, ReverseTrigger);
REGISTER_CLASS_ENUM (Trigger, FirstTrigger); REGISTER_CLASS_ENUM (Trigger, FirstTrigger);
REGISTER_CLASS_ENUM (Trigger, LastTrigger); REGISTER_CLASS_ENUM (Trigger, LastTrigger);
REGISTER_CLASS_ENUM (Trigger, AnyTrigger); REGISTER_CLASS_ENUM (Trigger, AnyTrigger);

View File

@ -2695,7 +2695,26 @@ TriggerBox::determine_next_trigger (uint32_t current)
case Trigger::Again: case Trigger::Again:
return current; return current;
case Trigger::NextTrigger: case Trigger::NextTrigger:
n = current + 1;
if (n < all_triggers.size()) {
if (all_triggers[n]->region()) {
return n;
}
}
break;
case Trigger::PrevTrigger:
if (current > 0) {
n = current - 1;
if (all_triggers[n]->region()) {
return n;
}
}
break;
case Trigger::ForwardTrigger:
n = current; n = current;
while (true) { while (true) {
++n; ++n;
@ -2715,7 +2734,8 @@ TriggerBox::determine_next_trigger (uint32_t current)
} }
} }
break; break;
case Trigger::PrevTrigger:
case Trigger::ReverseTrigger:
n = current; n = current;
while (true) { while (true) {
if (n == 0) { if (n == 0) {