13
0

Fix region-gain when region-start is trimmed

Region-gain (unlike other automation) is specific to the
region and independent of the source. Region::start() offset
does not apply. When region-start is trimmed the region's
envelope is modified (not just offset). The event-list is truncated.

Any audio-region envelope does (and must) have a point exactly
at the start and end of the region.

truncate_start() can thus calculate the earliest position of
valid events with the new length relative to the last event.

The mathematical operator for that is subtraction, not distance.
This commit is contained in:
Robin Gareus 2022-03-17 23:42:59 +01:00
parent e64fdcfb55
commit 176c41a485
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -1370,7 +1370,7 @@ ControlList::truncate_start (timecnt_t const & overall)
/* shrinking at front */
first_legal_coordinate = _events.back()->when.distance (overall_length);
first_legal_coordinate = _events.back()->when.earlier (overall_length);
first_legal_value = unlocked_eval (first_legal_coordinate);
first_legal_value = max ((double)_desc.lower, first_legal_value);
first_legal_value = min ((double)_desc.upper, first_legal_value);