From bedb89eb09478a27d647bc44e7c355305d6aa694 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sat, 30 Jan 2021 15:11:47 -0800 Subject: Avoid copying buffers for aligning overlapped windows --- alc/effects/fshifter.cpp | 39 ++++++++++++++++++++++----------------- alc/effects/pshifter.cpp | 36 ++++++++++++++++++++---------------- 2 files changed, 42 insertions(+), 33 deletions(-) diff --git a/alc/effects/fshifter.cpp b/alc/effects/fshifter.cpp index 1f881f9d..4037f46b 100644 --- a/alc/effects/fshifter.cpp +++ b/alc/effects/fshifter.cpp @@ -63,6 +63,7 @@ alignas(16) const std::array HannWindow = InitHannWindow(); struct FshifterState final : public EffectState { /* Effect parameters */ size_t mCount{}; + size_t mPos{}; uint mPhaseStep[2]{}; uint mPhase[2]{}; double mSign[2]{}; @@ -95,7 +96,8 @@ struct FshifterState final : public EffectState { void FshifterState::deviceUpdate(const ALCdevice*, const Buffer&) { /* (Re-)initializing parameters and clear the buffers. */ - mCount = FIFO_LATENCY; + mCount = 0; + mPos = FIFO_LATENCY; std::fill(std::begin(mPhaseStep), std::end(mPhaseStep), 0u); std::fill(std::begin(mPhase), std::end(mPhase), 0u); @@ -160,38 +162,41 @@ void FshifterState::process(const size_t samplesToDo, const al::span float { return static_cast(d); }); @@ -161,14 +163,17 @@ void PshifterState::process(const size_t samplesToDo, const al::span