From d65f5ebe345b92265a1d3aadefe73ccef93cd703 Mon Sep 17 00:00:00 2001 From: Chris Cannam Date: Mon, 21 Sep 2020 13:48:45 +0100 Subject: [PATCH] Fix potential discontinuity when window size is reduced due to change in ratio --- src/StretcherProcess.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/StretcherProcess.cpp b/src/StretcherProcess.cpp index 7fc118e..39da682 100644 --- a/src/StretcherProcess.cpp +++ b/src/StretcherProcess.cpp @@ -1018,7 +1018,7 @@ RubberBandStretcher::Impl::synthesiseChunk(size_t channel, m_swindow->cut(fltbuf); v_add(accumulator, fltbuf, wsz); - cd.accumulatorFill = wsz; + cd.accumulatorFill = std::max(cd.accumulatorFill, size_t(wsz)); if (wsz > fsz) { // reuse fltbuf to calculate interpolating window shape for @@ -1041,7 +1041,7 @@ RubberBandStretcher::Impl::writeChunk(size_t channel, size_t shiftIncrement, boo float *const R__ accumulator = cd.accumulator; float *const R__ windowAccumulator = cd.windowAccumulator; - const int sz = m_sWindowSize; + const int sz = cd.accumulatorFill; const int si = shiftIncrement; if (m_debugLevel > 2) {