Fix potential discontinuity when window size is reduced due to change in ratio

This commit is contained in:
Chris Cannam
2020-09-21 13:48:45 +01:00
parent 661a1d05eb
commit d65f5ebe34

View File

@@ -1018,7 +1018,7 @@ RubberBandStretcher::Impl::synthesiseChunk(size_t channel,
m_swindow->cut(fltbuf); m_swindow->cut(fltbuf);
v_add(accumulator, fltbuf, wsz); v_add(accumulator, fltbuf, wsz);
cd.accumulatorFill = wsz; cd.accumulatorFill = std::max(cd.accumulatorFill, size_t(wsz));
if (wsz > fsz) { if (wsz > fsz) {
// reuse fltbuf to calculate interpolating window shape for // 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__ accumulator = cd.accumulator;
float *const R__ windowAccumulator = cd.windowAccumulator; float *const R__ windowAccumulator = cd.windowAccumulator;
const int sz = m_sWindowSize; const int sz = cd.accumulatorFill;
const int si = shiftIncrement; const int si = shiftIncrement;
if (m_debugLevel > 2) { if (m_debugLevel > 2) {