From 8ba21e7fff39f7cc389549b7f21bbe5a35bb2b15 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 26 Sep 2022 14:56:50 +0200 Subject: [PATCH] Fix region-gain when trimming, cutting or partitioning regions The during trim-front, the call order is 1. Region::set_position_internal 2. Region::set_length_internal ::set_position_internal sets `_last_length.set_position (position());` but the later call ::set_length_internal does `_last_length = _length;` This sets last_position() == position(), and later Region::mid_thaw() does not call Region::recompute_at_start(). Region gain envelope was not updated. see also 00a1b7cb240556c and 13d10582f0ce4 --- libs/ardour/region.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc index 019ccac905..9b90a2a10e 100644 --- a/libs/ardour/region.cc +++ b/libs/ardour/region.cc @@ -492,10 +492,13 @@ void Region::set_length_internal (timecnt_t const & len) { timecnt_t l (len); + timepos_t p (_last_length.position()); l.set_position (position()); _last_length = _length; + _last_length.set_position (p); + _length = l; }