diff options
author | Chris Robinson <[email protected]> | 2018-09-23 02:22:23 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-09-23 02:22:23 -0700 |
commit | db6905bf57ba2f5243f6d9a45148c8d92818b6e8 (patch) | |
tree | 6aa873aa8488a7028f9e7ea73d38ceac58eacac8 /Alc/effects | |
parent | 800326d37ab1a5ae3036abd60d5eb205be3f2bc7 (diff) |
Clear reverb gain coefficients when doing a device update
Diffstat (limited to 'Alc/effects')
-rw-r--r-- | Alc/effects/reverb.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/Alc/effects/reverb.c b/Alc/effects/reverb.c index 882b364f..9e8b8dd4 100644 --- a/Alc/effects/reverb.c +++ b/Alc/effects/reverb.c @@ -554,6 +554,7 @@ static ALboolean ReverbState_deviceUpdate(ReverbState *State, ALCdevice *Device) { ALuint frequency = Device->Frequency; ALfloat multiplier; + ALsizei i, j; /* Allocate the delay lines. */ if(!AllocLines(frequency, State)) @@ -566,6 +567,54 @@ static ALboolean ReverbState_deviceUpdate(ReverbState *State, ALCdevice *Device) EARLY_TAP_LENGTHS[NUM_LINES-1]*multiplier) * frequency); + /* Clear filters and gain coefficients since the delay lines were all just + * cleared (if not reallocated). + */ + for(i = 0;i < NUM_LINES;i++) + { + BiquadFilter_clear(&State->Filter[i].Lp); + BiquadFilter_clear(&State->Filter[i].Hp); + } + + for(i = 0;i < NUM_LINES;i++) + { + State->EarlyDelayCoeff[i][0] = 0.0f; + State->EarlyDelayCoeff[i][1] = 0.0f; + } + + for(i = 0;i < NUM_LINES;i++) + { + State->Early.Coeff[i][0] = 0.0f; + State->Early.Coeff[i][1] = 0.0f; + } + + State->Late.DensityGain[0] = 0.0f; + State->Late.DensityGain[1] = 0.0f; + for(i = 0;i < NUM_LINES;i++) + { + State->Late.T60[i].MidGain[0] = 0.0f; + State->Late.T60[i].MidGain[1] = 0.0f; + BiquadFilter_clear(&State->Late.T60[i].HFFilter); + BiquadFilter_clear(&State->Late.T60[i].LFFilter); + } + + for(i = 0;i < NUM_LINES;i++) + { + for(j = 0;j < MAX_OUTPUT_CHANNELS;j++) + { + State->Early.CurrentGain[i][j] = 0.0f; + State->Early.PanGain[i][j] = 0.0f; + State->Late.CurrentGain[i][j] = 0.0f; + State->Late.PanGain[i][j] = 0.0f; + } + } + + /* Reset counters and offset base. */ + State->FadeCount = 0; + State->MaxUpdate[0] = MAX_UPDATE_SAMPLES; + State->MaxUpdate[1] = MAX_UPDATE_SAMPLES; + State->Offset = 0; + return AL_TRUE; } |