diff options
author | Chris Robinson <[email protected]> | 2020-09-08 22:56:30 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2020-09-08 23:20:06 -0700 |
commit | f4a55cc8c2e8093e1156686292a38ae10a738a08 (patch) | |
tree | 443e84925803dac41ec667491a8615a8d4ae6ec1 /alc/effects/pshifter.cpp | |
parent | 29566b995cfd80f00f8c4c7e2c3d4c798bcffdfe (diff) |
Don't leave the negative frequencies as 0 for inverse FFT
Diffstat (limited to 'alc/effects/pshifter.cpp')
-rw-r--r-- | alc/effects/pshifter.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/alc/effects/pshifter.cpp b/alc/effects/pshifter.cpp index 18be0e38..01d24333 100644 --- a/alc/effects/pshifter.cpp +++ b/alc/effects/pshifter.cpp @@ -226,15 +226,15 @@ void PshifterState::process(const size_t samplesToDo, const al::span<const Float mFftBuffer[k] = std::polar(mSynthesisBuffer[k].Amplitude, mSumPhase[k]); } - /* Clear negative frequencies to recontruct the time-domain signal. */ - std::fill(mFftBuffer.begin()+STFT_HALF_SIZE+1, mFftBuffer.end(), complex_d{}); + for(size_t k{STFT_HALF_SIZE+1};k < STFT_SIZE;++k) + mFftBuffer[k] = std::conj(mFftBuffer[STFT_SIZE-k]); /* Apply an inverse FFT to get the time-domain siganl, and accumulate * for the output with windowing. */ complex_fft(mFftBuffer, 1.0); for(size_t k{0u};k < STFT_SIZE;k++) - mOutputAccum[k] += HannWindow[k]*mFftBuffer[k].real() * (2.0/STFT_HALF_SIZE/OVERSAMP); + mOutputAccum[k] += HannWindow[k]*mFftBuffer[k].real() * (2.0/STFT_SIZE/OVERSAMP); /* Shift FIFO and accumulator. */ fifo_iter = std::copy(mFIFO.begin()+STFT_STEP, mFIFO.end(), mFIFO.begin()); |