From 7ae5c655804f5e58cfba60c2fb5b79b9d4eca0d1 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Sat, 21 Mar 2020 15:34:50 -0400 Subject: [PATCH] Remove test in Loudness effect for same clip boundaries in channels... ... it was not correctly written, and anyway WaveTrack::Get doesn't really report sufficient information to test as intended. --- src/effects/Loudness.cpp | 19 +++---------------- src/effects/Loudness.h | 2 +- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/src/effects/Loudness.cpp b/src/effects/Loudness.cpp index 38506fd33..4689a6f9b 100644 --- a/src/effects/Loudness.cpp +++ b/src/effects/Loudness.cpp @@ -455,8 +455,7 @@ bool EffectLoudness::ProcessOne(TrackIterRange range, bool analyse) const size_t remainingLen = (end - s).as_size_t(); blockLen = blockLen > remainingLen ? remainingLen : blockLen; - if(!LoadBufferBlock(range, s, blockLen)) - return false; + LoadBufferBlock(range, s, blockLen); // Process the buffer. if(analyse) @@ -479,29 +478,17 @@ bool EffectLoudness::ProcessOne(TrackIterRange range, bool analyse) return true; } -bool EffectLoudness::LoadBufferBlock(TrackIterRange range, +void EffectLoudness::LoadBufferBlock(TrackIterRange range, sampleCount pos, size_t len) { - sampleCount read_size = -1; - sampleCount last_read_size = -1; // Get the samples from the track and put them in the buffer int idx = 0; for(auto channel : range) { - channel->Get((samplePtr) mTrackBuffer[idx].get(), floatSample, pos, len, - fillZero, true, &read_size); - // WaveTrack::Get returns the amount of read samples excluding zero - // filled samples from clip gaps. But in case of stereo tracks with - // asymmetric gaps it still returns the same number for both channels. - // - // Fail if we read different sample count from stereo pair tracks. - // Ignore this check during first iteration (last_read_size == -1). - if(read_size != last_read_size && last_read_size.as_long_long() != -1) - return false; + channel->Get((samplePtr) mTrackBuffer[idx].get(), floatSample, pos, len ); ++idx; } mTrackBufferLen = len; - return true; } /// Calculates sample sum (for DC) and EBU R128 weighted square sum diff --git a/src/effects/Loudness.h b/src/effects/Loudness.h index ece1b3ff9..49a957048 100644 --- a/src/effects/Loudness.h +++ b/src/effects/Loudness.h @@ -64,7 +64,7 @@ private: void FreeBuffers(); bool GetTrackRMS(WaveTrack* track, float& rms); bool ProcessOne(TrackIterRange range, bool analyse); - bool LoadBufferBlock(TrackIterRange range, + void LoadBufferBlock(TrackIterRange range, sampleCount pos, size_t len); bool AnalyseBufferBlock(); bool ProcessBufferBlock();