Fix region-peak display for trimmed regions

This commit is contained in:
Robin Gareus 2021-03-23 20:37:57 +01:00
parent 5cd26221ce
commit 41c52882af
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
1 changed files with 4 additions and 1 deletions

View File

@ -87,12 +87,15 @@ RegionPeakCursor::set (AudioRegionView* arv, samplepos_t when, samplecnt_t sampl
assert (ar);
assert (ar->n_channels () > 0);
sampleoffset_t s = when + ar->start () - ar->position ();
sampleoffset_t s = when - ar->position ();
if (s < 0 || s > ar->length ()) {
hide ();
return;
}
/* read_peaks() offset is relative to the region's source */
s += ar->start ();
PeakData p;
for (uint32_t chn = 0; chn < ar->n_channels (); ++chn) {
PeakData pc;