From 32f47edaa1c4c712bc03d044f32b3ff4942f2a31 Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Wed, 23 Jul 2008 23:33:32 -0500 Subject: [PATCH] Make normalization work properly with looped regions. --- Timeline/Audio_Region.C | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Timeline/Audio_Region.C b/Timeline/Audio_Region.C index 8b35345..e2d70f0 100644 --- a/Timeline/Audio_Region.C +++ b/Timeline/Audio_Region.C @@ -775,7 +775,9 @@ Audio_Region::normalize ( void ) int peaks, channels; Peak *pbuf; - if ( _clip->read_peaks( length(), offset(), offset() + length(), &peaks, &pbuf, &channels ) && + const nframes_t npeaks = _loop ? _loop : length(); + + if ( _clip->read_peaks( npeaks, offset(), offset() + npeaks, &peaks, &pbuf, &channels ) && peaks ) _scale = pbuf->normalization_factor();