From 13448519123227631abd9de756c80203554a66a7 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 18 Sep 2023 19:56:06 -0600 Subject: [PATCH] fix Region::set_position_internal() to use TempoMap provided conversions rolling our own beat<->audio conversion code here was doomed to fail. this fixes the absurd length of a consolidated region. --- libs/ardour/region.cc | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc index b99e142ada..8c2f2a36b0 100644 --- a/libs/ardour/region.cc +++ b/libs/ardour/region.cc @@ -764,15 +764,11 @@ Region::set_position_internal (timepos_t const & pos) */ if (td != _length.val().position().time_domain()) { - switch (td) { - case Temporal::AudioTime: - _length = timecnt_t::from_superclock (superclock_t (_length.val().distance()), timepos_t::from_superclock (pos.superclocks())); - break; - default: - _length = timecnt_t::from_ticks (int64_t (_length.val().distance()), timepos_t::from_ticks (pos.ticks())); - break; - } - } else { + timecnt_t l = _length.val(); + l.set_position (pos); + l.set_time_domain (td); + _length = l; + } else { /* time domain of position not changing */ _length = timecnt_t (_length.val().distance(), pos); }