diff options
author | Chris Robinson <[email protected]> | 2008-11-18 06:35:00 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2008-11-18 06:35:00 -0800 |
commit | c8123756ffa2ad4b4ae25c9be33e4d9500bc4a00 (patch) | |
tree | e626bcc02acac34102673f175ce05d7cde2c4bbf /Alc | |
parent | 76c7789ee785212189f86ccee7a404858d104cff (diff) |
Simplify in-sample low-pass filter coefficient calculation
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/alcReverb.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/Alc/alcReverb.c b/Alc/alcReverb.c index 35665fce..b1dfb25a 100644 --- a/Alc/alcReverb.c +++ b/Alc/alcReverb.c @@ -476,12 +476,9 @@ ALvoid VerbUpdate(ALCcontext *Context, ALeffectslot *Slot, ALeffect *Effect) length = LATE_LINE_LENGTH[index]; if(index >= 4) { - index2 = index - 3; - - length *= 1.0f + (Effect->Reverb.Density * LATE_LINE_MULTIPLIER); - // Calculate the delay offset for the variable-length delay // lines. + length *= 1.0f + (Effect->Reverb.Density * LATE_LINE_MULTIPLIER); State->Late.Offset[index] = (ALuint)(length * Context->Frequency); } // Calculate the gain (coefficient) for each line. @@ -489,6 +486,8 @@ ALvoid VerbUpdate(ALCcontext *Context, ALeffectslot *Slot, ALeffect *Effect) -60.0f / 20.0f); if(index >= 4) { + index2 = index - 3; + // Calculate the decay equation for each low-pass filter. g = pow(10.0f, length / (Effect->Reverb.DecayTime * hfRatio) * -60.0f / 20.0f) / @@ -512,8 +511,8 @@ ALvoid VerbUpdate(ALCcontext *Context, ALeffectslot *Slot, ALeffect *Effect) length = LATE_LINE_LENGTH[5] * (1.0f + Effect->Reverb.Density * LATE_LINE_MULTIPLIER) + LATE_LINE_LENGTH[6] * (1.0f + Effect->Reverb.Density * LATE_LINE_MULTIPLIER); - g = pow(10.0f, length / (Effect->Reverb.DecayTime * hfRatio) * -30.0f / 20.0f) / - pow(10.0f, length / Effect->Reverb.DecayTime * -30.0f / 20.0f); + g = pow(10.0f, ((length / (Effect->Reverb.DecayTime * hfRatio))- + (length / Effect->Reverb.DecayTime)) * -30.0f / 20.0f); g = __max(g, 0.1f); g *= g; |