diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-02-22 09:59:00 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-02-22 09:59:00 +0100 |
commit | f8af9bf3e471702e96d26b91069f9fc6a4501fc2 (patch) | |
tree | a56661287e4af5ce913aa0ee03899bd600ac8dbf /servers/audio/effects/audio_effect_pitch_shift.cpp | |
parent | 846d075a2f2333b4ba4cbca48a96484015b31031 (diff) | |
download | redot-engine-f8af9bf3e471702e96d26b91069f9fc6a4501fc2.tar.gz |
AudioEffectPitchShift: Actually fix -Wstringop-overflow warning
Previous commit didn't help, so its changes are reverted.
Diffstat (limited to 'servers/audio/effects/audio_effect_pitch_shift.cpp')
-rw-r--r-- | servers/audio/effects/audio_effect_pitch_shift.cpp | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/servers/audio/effects/audio_effect_pitch_shift.cpp b/servers/audio/effects/audio_effect_pitch_shift.cpp index ddb17e050a..beca503904 100644 --- a/servers/audio/effects/audio_effect_pitch_shift.cpp +++ b/servers/audio/effects/audio_effect_pitch_shift.cpp @@ -87,10 +87,8 @@ void SMBPitchShift::PitchShift(float pitchShift, long numSampsToProcess, long ff double magn, phase, tmp, window, real, imag; double freqPerBin, expct; long i,k, qpd, index, inFifoLatency, stepSize, fftFrameSize2; - unsigned long fftFrameBufferSize; /* set up some handy variables */ - fftFrameBufferSize = (unsigned long)fftFrameSize*sizeof(float); fftFrameSize2 = fftFrameSize/2; stepSize = fftFrameSize/osamp; freqPerBin = sampleRate/(double)fftFrameSize; @@ -162,8 +160,8 @@ void SMBPitchShift::PitchShift(float pitchShift, long numSampsToProcess, long ff /* ***************** PROCESSING ******************* */ /* this does the actual pitch shifting */ - memset(gSynMagn, 0, fftFrameBufferSize); - memset(gSynFreq, 0, fftFrameBufferSize); + memset(gSynMagn, 0, fftFrameSize*sizeof(float)); + memset(gSynFreq, 0, fftFrameSize*sizeof(float)); for (k = 0; k <= fftFrameSize2; k++) { index = k*pitchShift; if (index <= fftFrameSize2) { @@ -216,7 +214,7 @@ void SMBPitchShift::PitchShift(float pitchShift, long numSampsToProcess, long ff } /* shift accumulator */ - memmove(gOutputAccum, gOutputAccum+stepSize, fftFrameBufferSize); + memmove(gOutputAccum, gOutputAccum+stepSize, fftFrameSize*sizeof(float)); /* move input FIFO */ for (k = 0; k < inFifoLatency; k++) { gInFIFO[k] = gInFIFO[k+stepSize]; @@ -358,12 +356,3 @@ void AudioEffectPitchShift::_bind_methods() { BIND_ENUM_CONSTANT(FFT_SIZE_4096); BIND_ENUM_CONSTANT(FFT_SIZE_MAX); } - -AudioEffectPitchShift::AudioEffectPitchShift() { - pitch_scale = 1.0; - oversampling = 4; - fft_size = FFT_SIZE_2048; - wet = 0.0; - dry = 0.0; - filter = false; -} |