From b884f7c534ba65c13b947102baadfc5d65ad0cc6 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 20 Jan 2022 14:03:40 -0700 Subject: [PATCH] triggerbox: do not use follow length when (left) follow action is None --- libs/ardour/ardour/triggerbox.h | 2 ++ libs/ardour/triggerbox.cc | 18 ++++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/libs/ardour/ardour/triggerbox.h b/libs/ardour/ardour/triggerbox.h index 05eb518100..b88723dc39 100644 --- a/libs/ardour/ardour/triggerbox.h +++ b/libs/ardour/ardour/triggerbox.h @@ -324,6 +324,8 @@ class LIBARDOUR_API Trigger : public PBD::Stateful { void set_region_internal (boost::shared_ptr); virtual void retrigger() = 0; virtual void _startup (Temporal::BBT_Offset const &); + + bool internal_use_follow_length() const; }; typedef boost::shared_ptr TriggerPtr; diff --git a/libs/ardour/triggerbox.cc b/libs/ardour/triggerbox.cc index d10d4d2fd2..14bfc940c8 100644 --- a/libs/ardour/triggerbox.cc +++ b/libs/ardour/triggerbox.cc @@ -407,6 +407,12 @@ Trigger::set_use_follow_length (bool ufl) _box.session().set_dirty(); } +bool +Trigger::internal_use_follow_length () const +{ + return (_follow_action0.val().type != None) && _use_follow_length; +} + void Trigger::set_legato (bool yn) { @@ -1055,20 +1061,20 @@ AudioTrigger::set_expected_end_sample (Temporal::TempoMap::SharedPtr const & tma end_by_follow_length, _follow_length, end_by_barcnt, end_by_data_length)); if (stretching()) { - if (_use_follow_length) { + if (internal_use_follow_length()) { expected_end_sample = std::min (end_by_follow_length, end_by_barcnt); } else { expected_end_sample = end_by_barcnt; } } else { - if (_use_follow_length) { + if (internal_use_follow_length()) { expected_end_sample = std::min (end_by_follow_length, end_by_data_length); } else { expected_end_sample = end_by_data_length; } } - if (_use_follow_length) { + if (internal_use_follow_length()) { final_sample = end_by_follow_length - transition_sample; } else { final_sample = expected_end_sample - transition_sample; @@ -1076,7 +1082,7 @@ AudioTrigger::set_expected_end_sample (Temporal::TempoMap::SharedPtr const & tma samplecnt_t usable_length; - if (_use_follow_length && (end_by_follow_length < end_by_data_length)) { + if (internal_use_follow_length() && (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; @@ -1752,7 +1758,7 @@ MIDITrigger::set_expected_end_sample (Temporal::TempoMap::SharedPtr const & tmap Temporal::Beats usable_length; - if (_use_follow_length && (end_by_follow_length < end_by_data_length)) { + if (internal_use_follow_length() && (end_by_follow_length < end_by_data_length)) { usable_length = tmap->quarters_at (tmap->bbt_walk (transition_bbt, _follow_length)) - transition_beats; } else { usable_length = data_length; @@ -1762,7 +1768,7 @@ MIDITrigger::set_expected_end_sample (Temporal::TempoMap::SharedPtr const & tmap if (launch_style() != Repeat || (q == Temporal::BBT_Offset())) { - if (_use_follow_length) { + if (internal_use_follow_length()) { final_beat = end_by_follow_length; } else { final_beat = end_by_data_length;