triggerbox: clean up part of the state machine for audio triggers
This commit is contained in:
parent
91f38f9c4e
commit
97eb164b91
@ -919,6 +919,7 @@ AudioTrigger::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sa
|
||||
case WaitingForRetrigger:
|
||||
case WaitingToStart:
|
||||
/* did everything we could do */
|
||||
std::cerr << name() << " when i run, stretching will be: " << stretching << std::endl;
|
||||
return nframes;
|
||||
case Running:
|
||||
case WaitingToStop:
|
||||
@ -1105,7 +1106,7 @@ AudioTrigger::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sa
|
||||
}
|
||||
}
|
||||
|
||||
if (_state == Stopped) {
|
||||
if (_state == Stopped || _state == Stopping) {
|
||||
|
||||
if (_loop_cnt == _follow_count) {
|
||||
|
||||
@ -1114,6 +1115,16 @@ AudioTrigger::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sa
|
||||
DEBUG_TRACE (DEBUG::Triggers, string_compose ("%1 loop cnt %2 satisfied, now stopped\n", index(), _follow_count));
|
||||
shutdown ();
|
||||
|
||||
} else if (_state == Stopping) {
|
||||
|
||||
/* did not reach the end of the data. Presumably
|
||||
* another trigger was explicitly queued, and we
|
||||
* stopped
|
||||
*/
|
||||
|
||||
DEBUG_TRACE (DEBUG::Triggers, string_compose ("%1 not at end, but ow stopped\n", index()));
|
||||
shutdown ();
|
||||
|
||||
} else {
|
||||
|
||||
/* reached the end, but we haven't done that enough
|
||||
@ -1122,8 +1133,9 @@ AudioTrigger::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sa
|
||||
*/
|
||||
|
||||
DEBUG_TRACE (DEBUG::Triggers, string_compose ("%1 was stopping, now waiting to retrigger, loop cnt %2 fc %3\n", index(), _loop_cnt, _follow_count));
|
||||
retrigger ();
|
||||
_state = WaitingToStart;
|
||||
retrigger ();
|
||||
PropertyChanged (ARDOUR::Properties::running);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2060,13 +2072,22 @@ TriggerBox::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_samp
|
||||
|
||||
} else {
|
||||
|
||||
/* no legato-switch, but just begin stoppingthe
|
||||
* currently playing slot
|
||||
*/
|
||||
/* no legato-switch */
|
||||
|
||||
if (_currently_playing->state() != Trigger::WaitingToStop) {
|
||||
if (_currently_playing->state() == Trigger::Stopped) {
|
||||
|
||||
explicit_queue.increment_read_idx (1); /* consume the entry we peeked at */
|
||||
nxt->startup ();
|
||||
DEBUG_TRACE (DEBUG::Triggers, string_compose ("%1 was finished, started %2\n", _currently_playing->index(), nxt->index()));
|
||||
_currently_playing = nxt;
|
||||
PropertyChanged (Properties::currently_playing);
|
||||
|
||||
} else if (_currently_playing->state() != Trigger::WaitingToStop) {
|
||||
|
||||
/* but just begin stoppingthe currently playing slot */
|
||||
_currently_playing->begin_stop ();
|
||||
DEBUG_TRACE (DEBUG::Triggers, string_compose ("start stop for %1 before switching to %2\n", _currently_playing->index(), nxt->index()));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user