diff options
author | Chris Robinson <[email protected]> | 2009-10-21 02:03:33 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2009-10-21 02:03:33 -0700 |
commit | d3ecbd75affa0c42290c24a1cd82019e89ea3461 (patch) | |
tree | 9f271a712fc98f518e2de1139f5065c67b17d569 /Alc | |
parent | 75b65ab2a29aa10a054974f443cc94ccf5e70f3e (diff) |
Clear the echo and delay lines even if the buffer doesn't change size
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/alcEcho.c | 7 | ||||
-rw-r--r-- | Alc/alcReverb.c | 6 |
2 files changed, 6 insertions, 7 deletions
diff --git a/Alc/alcEcho.c b/Alc/alcEcho.c index 431fa08e..0c0f19ed 100644 --- a/Alc/alcEcho.c +++ b/Alc/alcEcho.c @@ -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; } diff --git a/Alc/alcReverb.c b/Alc/alcReverb.c index 7579933e..2cfe341e 100644 --- a/Alc/alcReverb.c +++ b/Alc/alcReverb.c @@ -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; } |