From 98cd0f1ba3136cd60de71931da66e5bf40a2c7e5 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 13 Jan 2022 12:07:26 -0700 Subject: [PATCH] triggerbox: fix for handling follow lengths, previously for MIDITrigger now for Audio --- libs/ardour/triggerbox.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libs/ardour/triggerbox.cc b/libs/ardour/triggerbox.cc index ce2dfe74c4..e30bfd0808 100644 --- a/libs/ardour/triggerbox.cc +++ b/libs/ardour/triggerbox.cc @@ -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_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 (end_by_follow_length) { + if (_follow_length != Temporal::BBT_Offset()) { expected_end_sample = std::min (end_by_follow_length, end_by_barcnt); } else { expected_end_sample = end_by_barcnt; } } 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); } else { expected_end_sample = end_by_data_length; } } - if (end_by_follow_length) { + if (_follow_length != Temporal::BBT_Offset()) { final_sample = end_by_follow_length; } else { final_sample = expected_end_sample; @@ -942,7 +942,7 @@ AudioTrigger::set_expected_end_sample (Temporal::TempoMap::SharedPtr const & tma 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)); } else { usable_length = data.length;