13
0

triggerbox: continuing fixups for MIDITrigger

This commit is contained in:
Paul Davis 2021-12-28 18:01:41 -07:00
parent be7e9df8e3
commit 2c00379220

View File

@ -1642,6 +1642,7 @@ MIDITrigger::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sam
const Temporal::Beats region_start = region_start_time.beats();
Temporal::TempoMap::SharedPtr tmap (Temporal::TempoMap::use());
samplepos_t last_event_samples = max_samplepos;
const pframes_t orig_nframes = nframes;
/* see if we're going to start or stop or retrigger in this run() call */
pframes_t extra_offset = maybe_compute_next_transition (start_sample, start_beats, end_beats, dest_offset, passthru);
@ -1730,13 +1731,18 @@ MIDITrigger::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sam
nframes = (last_event_samples - start_sample);
} else {
/* all frames covered */
nframes = 0;
}
} else {
/* we didn't reach the end of the MIDI data, ergo we covered
the entire timespan passed into us.
*/
DEBUG_TRACE (DEBUG::Triggers, string_compose ("%1 did not reach end, nframes left at %2\n", index(), nframes));
nframes = 0;
}
if (_state == Stopped || _state == Stopping) {
if ((_state == Stopped) && !_explicitly_stopped && (_launch_style == Trigger::Gate || _launch_style == Trigger::Repeat)) {
jump_start ();
@ -1775,8 +1781,9 @@ MIDITrigger::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sam
PropertyChanged (ARDOUR::Properties::running);
}
}
}
return nframes;
return orig_nframes - nframes;
}
/**************/
@ -2648,6 +2655,8 @@ TriggerBox::determine_next_trigger (uint32_t current)
* nothing or just repeat the current trigger
*/
DEBUG_TRACE (DEBUG::Triggers, string_compose ("choose next trigger using follow action %1 given prob %2 and rnd %3\n", enum_2_string (fa), all_triggers[current]->follow_action_probability(), r));
switch (fa) {
case Trigger::Stop: