Clear the echo and delay lines even if the buffer doesn't change size
This commit is contained in:
+3
-4
@@ -88,7 +88,7 @@ ALvoid EchoDestroy(ALeffectState *effect)
|
||||
ALboolean EchoDeviceUpdate(ALeffectState *effect, ALCdevice *Device)
|
||||
{
|
||||
ALechoState *state = (ALechoState*)effect;
|
||||
ALuint maxlen;
|
||||
ALuint maxlen, i;
|
||||
|
||||
// Use the next power of 2 for the buffer length, so the tap offsets can be
|
||||
// wrapped using a mask instead of a modulo
|
||||
@@ -99,7 +99,6 @@ ALboolean EchoDeviceUpdate(ALeffectState *effect, ALCdevice *Device)
|
||||
if(maxlen != state->BufferLength)
|
||||
{
|
||||
void *temp;
|
||||
ALuint i;
|
||||
|
||||
temp = realloc(state->SampleBuffer, maxlen * sizeof(ALfloat));
|
||||
if(!temp)
|
||||
@@ -108,9 +107,9 @@ ALboolean EchoDeviceUpdate(ALeffectState *effect, ALCdevice *Device)
|
||||
return AL_FALSE;
|
||||
}
|
||||
state->BufferLength = maxlen;
|
||||
for(i = 0;i < state->BufferLength;i++)
|
||||
state->SampleBuffer[i] = 0.0f;
|
||||
}
|
||||
for(i = 0;i < state->BufferLength;i++)
|
||||
state->SampleBuffer[i] = 0.0f;
|
||||
|
||||
return AL_TRUE;
|
||||
}
|
||||
|
||||
+3
-3
@@ -431,9 +431,6 @@ ALboolean VerbDeviceUpdate(ALeffectState *effect, ALCdevice *Device)
|
||||
State->TotalLength = totalLength;
|
||||
State->SampleBuffer = temp;
|
||||
|
||||
for(index = 0; index < totalLength;index++)
|
||||
State->SampleBuffer[index] = 0.0f;
|
||||
|
||||
// All lines share a single sample buffer
|
||||
State->Delay.Mask = length[0] - 1;
|
||||
State->Delay.Line = &State->SampleBuffer[0];
|
||||
@@ -466,6 +463,9 @@ ALboolean VerbDeviceUpdate(ALeffectState *effect, ALCdevice *Device)
|
||||
Device->Frequency);
|
||||
}
|
||||
|
||||
for(index = 0;index < State->TotalLength;index++)
|
||||
State->SampleBuffer[index] = 0.0f;
|
||||
|
||||
return AL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user