AudioEffectPitchShift: Prevent negative size memset (GCC warning)
This commit is contained in:
parent
ab4c5a594a
commit
3ba724e715
1 changed files with 5 additions and 3 deletions
|
@ -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];
|
||||
|
|
Loading…
Reference in a new issue