From 04921dd7275326148fb20dac7ae599c91e8f96b9 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 6 Aug 2018 23:45:32 -0700 Subject: Properly set early reflection all-pass coefficient --- Alc/effects/reverb.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Alc/effects/reverb.c b/Alc/effects/reverb.c index c2616331..dd8167ef 100644 --- a/Alc/effects/reverb.c +++ b/Alc/effects/reverb.c @@ -366,6 +366,7 @@ static void ALreverbState_Construct(ALreverbState *state) state->Early.VecAp.Delay.Mask = 0; state->Early.VecAp.Delay.Line = NULL; + state->Early.VecAp.Coeff = 0.0f; state->Early.Delay.Mask = 0; state->Early.Delay.Line = NULL; for(i = 0;i < NUM_LINES;i++) @@ -950,13 +951,16 @@ static ALvoid UpdateDelayLine(const ALfloat earlyDelay, const ALfloat lateDelay, } /* Update the early reflection line lengths and gain coefficients. */ -static ALvoid UpdateEarlyLines(const ALfloat density, const ALfloat decayTime, const ALuint frequency, EarlyReflections *Early) +static ALvoid UpdateEarlyLines(const ALfloat density, const ALfloat diffusion, const ALfloat decayTime, const ALuint frequency, EarlyReflections *Early) { ALfloat multiplier, length; ALsizei i; multiplier = CalcDelayLengthMult(density); + /* Calculate the all-pass feed-back/forward coefficient. */ + Early->VecAp.Coeff = sqrtf(0.5f) * powf(diffusion, 2.0f); + for(i = 0;i < NUM_LINES;i++) { /* Calculate the length (in seconds) of each all-pass line. */ @@ -1179,8 +1183,8 @@ static ALvoid ALreverbState_update(ALreverbState *State, const ALCcontext *Conte State); /* Update the early lines. */ - UpdateEarlyLines(props->Reverb.Density, props->Reverb.DecayTime, - frequency, &State->Early); + UpdateEarlyLines(props->Reverb.Density, props->Reverb.Diffusion, + props->Reverb.DecayTime, frequency, &State->Early); /* Get the mixing matrix coefficients. */ CalcMatrixCoeffs(props->Reverb.Diffusion, &State->MixX, &State->MixY); -- cgit v1.2.3