13
0

triggerbox: 2 possible follow actions

This commit is contained in:
Paul Davis 2021-08-11 22:54:13 -06:00
parent 6854c66f6f
commit 4ee02182fe
2 changed files with 16 additions and 10 deletions

View File

@ -103,8 +103,8 @@ class LIBARDOUR_API Trigger : public PBD::Stateful {
OtherTrigger,
};
FollowAction follow_action() const { return _follow_action; }
void set_follow_action (FollowAction);
FollowAction follow_action (size_t n) const { assert (n < 2); return _follow_action[n]; }
void set_follow_action (FollowAction, size_t n);
virtual int set_region (boost::shared_ptr<Region>) = 0;
boost::shared_ptr<Region> region() const { return _region; }
@ -154,7 +154,7 @@ class LIBARDOUR_API Trigger : public PBD::Stateful {
size_t _index;
int _next_trigger;
LaunchStyle _launch_style;
FollowAction _follow_action;
FollowAction _follow_action[2];
boost::shared_ptr<Region> _region;
Temporal::BBT_Offset _quantization;

View File

@ -42,7 +42,7 @@ Trigger::Trigger (size_t n, TriggerBox& b)
, _index (n)
, _next_trigger (-1)
, _launch_style (Toggle)
, _follow_action (NextTrigger)
, _follow_action { { NextTrigger }, { Stop } }
, _quantization (Temporal::BBT_Offset (0, 1, 0))
{
}
@ -60,9 +60,10 @@ Trigger::unbang ()
}
void
Trigger::set_follow_action (FollowAction f)
Trigger::set_follow_action (FollowAction f, size_t n)
{
_follow_action = f;
assert (n < 2);
_follow_action[n] = f;
}
void
@ -558,7 +559,7 @@ AudioTrigger::run (BufferSet& bufs, pframes_t nframes, pframes_t dest_offset, bo
/* We reached the end */
if (_follow_action == Again) {
if (_follow_action[0] == Again) {
nframes -= this_read;
dest_offset += this_read;
DEBUG_TRACE (DEBUG::Triggers, string_compose ("%1 was reached end, but set to loop, so retrigger\n", index()));
@ -916,7 +917,7 @@ TriggerBox::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_samp
if (trigger.state() == Trigger::Stopped) {
if (trigger.follow_action() != Trigger::Stop) {
if (trigger.follow_action(0) != Trigger::Stop) {
int nxt = trigger.next_trigger();
@ -949,7 +950,7 @@ TriggerBox::set_next_trigger (size_t current)
}
}
switch (all_triggers[current]->follow_action()) {
switch (all_triggers[current]->follow_action(0)) {
case Trigger::Stop:
return;
case Trigger::QueuedTrigger:
@ -962,7 +963,12 @@ TriggerBox::set_next_trigger (size_t current)
}
}
switch (all_triggers[current]->follow_action()) {
switch (all_triggers[current]->follow_action(0)) {
case Trigger::Again:
all_triggers[current]->set_next_trigger (current);
return;
case Trigger::NextTrigger:
n = current;
while (true) {