triggerbox: fix for handling follow lengths, previously for MIDITrigger now for Audio

This commit is contained in:
Paul Davis 2022-01-13 12:07:26 -07:00
parent c3732e12ea
commit 98cd0f1ba3

View File

@ -918,23 +918,23 @@ AudioTrigger::set_expected_end_sample (Temporal::TempoMap::SharedPtr const & tma
samplepos_t end_by_barcnt = tmap->sample_at (tmap->bbt_walk(transition_bbt, Temporal::BBT_Offset (round (_barcnt), 0, 0))); samplepos_t end_by_barcnt = tmap->sample_at (tmap->bbt_walk(transition_bbt, Temporal::BBT_Offset (round (_barcnt), 0, 0)));
samplepos_t end_by_data_length = transition_sample + data.length; samplepos_t end_by_data_length = transition_sample + data.length;
DEBUG_TRACE (DEBUG::Triggers, string_compose ("%1 ends: FL %2 BC %3 DL %4\n", index(), end_by_follow_length, end_by_barcnt, end_by_data_length)); DEBUG_TRACE (DEBUG::Triggers, string_compose ("%1 ends: FL %2 (from %5 + %6) BC %3 DL %4\n", index(), end_by_follow_length, end_by_barcnt, end_by_data_length, transition_bbt, _follow_length));
if (stretching()) { if (stretching()) {
if (end_by_follow_length) { if (_follow_length != Temporal::BBT_Offset()) {
expected_end_sample = std::min (end_by_follow_length, end_by_barcnt); expected_end_sample = std::min (end_by_follow_length, end_by_barcnt);
} else { } else {
expected_end_sample = end_by_barcnt; expected_end_sample = end_by_barcnt;
} }
} else { } else {
if (end_by_follow_length) { if (_follow_length != Temporal::BBT_Offset()) {
expected_end_sample = std::min (end_by_follow_length, end_by_data_length); expected_end_sample = std::min (end_by_follow_length, end_by_data_length);
} else { } else {
expected_end_sample = end_by_data_length; expected_end_sample = end_by_data_length;
} }
} }
if (end_by_follow_length) { if (_follow_length != Temporal::BBT_Offset()) {
final_sample = end_by_follow_length; final_sample = end_by_follow_length;
} else { } else {
final_sample = expected_end_sample; final_sample = expected_end_sample;
@ -942,7 +942,7 @@ AudioTrigger::set_expected_end_sample (Temporal::TempoMap::SharedPtr const & tma
samplecnt_t usable_length; samplecnt_t usable_length;
if (end_by_follow_length && (end_by_follow_length < end_by_data_length)) { if ((_follow_length != Temporal::BBT_Offset()) && (end_by_follow_length < end_by_data_length)) {
usable_length = tmap->sample_at (tmap->bbt_walk (Temporal::BBT_Time (), _follow_length)); usable_length = tmap->sample_at (tmap->bbt_walk (Temporal::BBT_Time (), _follow_length));
} else { } else {
usable_length = data.length; usable_length = data.length;