From a582b24fcddea0fc55b31dd567982227c5e3c890 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 29 Jul 2019 03:48:52 +0200 Subject: [PATCH] Fix rendering of region waveform left-edge The left-most part may be a partial block of a given "sample per pixel" range. Also previously there was an off-by-one [block] in case sample_pos was an even multiple of samples_per_visual_peak. --- libs/ardour/audiosource.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libs/ardour/audiosource.cc b/libs/ardour/audiosource.cc index aafc639fed..ecb4358d70 100644 --- a/libs/ardour/audiosource.cc +++ b/libs/ardour/audiosource.cc @@ -647,9 +647,8 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, samplecnt_t npeaks, samplepos samplecnt_t chunksize = (samplecnt_t) min (cnt, (samplecnt_t) 4096); boost::scoped_array raw_staging(new Sample[chunksize]); - samplepos_t sample_pos = start; - double pixel_pos = floor (sample_pos / samples_per_visual_peak); - double next_pixel_pos = ceil (sample_pos / samples_per_visual_peak); + double pixel_pos = start / samples_per_visual_peak; + double next_pixel_pos = 1.0 + floor (pixel_pos); double pixels_per_sample = 1.0 / samples_per_visual_peak; xmin = 1.0;