diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-02-20 17:13:28 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-02-20 17:13:28 +0100 |
commit | dbf598034e673dc65e539c2cb9c9c56b5976903b (patch) | |
tree | 0e72b66c7582ee45e3bc58c406de1dbf5781f4dd /servers | |
parent | b652a81da7b4184a4eacd2665004791a0053c971 (diff) | |
parent | 3ba724e7156d6a007abb34cb5168a00385ee2702 (diff) | |
download | redot-engine-dbf598034e673dc65e539c2cb9c9c56b5976903b.tar.gz |
Merge pull request #88509 from akien-mga/pitchshift-unsigned-fft-size
AudioEffectPitchShift: Prevent negative size memset (GCC warning)
Diffstat (limited to 'servers')
-rw-r--r-- | servers/audio/effects/audio_effect_pitch_shift.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/servers/audio/effects/audio_effect_pitch_shift.cpp b/servers/audio/effects/audio_effect_pitch_shift.cpp index 11c1d44472..ddb17e050a 100644 --- a/servers/audio/effects/audio_effect_pitch_shift.cpp +++ b/servers/audio/effects/audio_effect_pitch_shift.cpp @@ -87,8 +87,10 @@ 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; @@ -160,8 +162,8 @@ void SMBPitchShift::PitchShift(float pitchShift, long numSampsToProcess, long ff /* ***************** PROCESSING ******************* */ /* this does the actual pitch shifting */ - memset(gSynMagn, 0, fftFrameSize*sizeof(float)); - memset(gSynFreq, 0, fftFrameSize*sizeof(float)); + memset(gSynMagn, 0, fftFrameBufferSize); + memset(gSynFreq, 0, fftFrameBufferSize); for (k = 0; k <= fftFrameSize2; k++) { index = k*pitchShift; if (index <= fftFrameSize2) { @@ -214,7 +216,7 @@ void SMBPitchShift::PitchShift(float pitchShift, long numSampsToProcess, long ff } /* shift accumulator */ - memmove(gOutputAccum, gOutputAccum+stepSize, fftFrameSize*sizeof(float)); + memmove(gOutputAccum, gOutputAccum+stepSize, fftFrameBufferSize); /* move input FIFO */ for (k = 0; k < inFifoLatency; k++) { gInFIFO[k] = gInFIFO[k+stepSize]; |