From 88aaf587adbf29e89eee5bbeaa821dbc9947ff51 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Tue, 2 Jun 2015 12:08:02 -0400 Subject: AudioRegion::read_peaks() should return 0 or the number of peaks read, not the number of samples --- libs/ardour/audioregion.cc | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'libs/ardour/audioregion.cc') diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc index 61d8952e52..8113b261f9 100644 --- a/libs/ardour/audioregion.cc +++ b/libs/ardour/audioregion.cc @@ -426,15 +426,16 @@ AudioRegion::read_peaks (PeakData *buf, framecnt_t npeaks, framecnt_t offset, fr if (audio_source(chan_n)->read_peaks (buf, npeaks, offset, cnt, frames_per_pixel)) { return 0; - } else { - if (_scale_amplitude != 1.0f) { - for (framecnt_t n = 0; n < npeaks; ++n) { - buf[n].max *= _scale_amplitude; - buf[n].min *= _scale_amplitude; - } + } + + if (_scale_amplitude != 1.0f) { + for (framecnt_t n = 0; n < npeaks; ++n) { + buf[n].max *= _scale_amplitude; + buf[n].min *= _scale_amplitude; } - return cnt; } + + return npeaks; } /** @param buf Buffer to write data to (existing data will be overwritten). -- cgit v1.2.3