From fb1fde9fb030116cdfc66af3ff7277d89a31953a Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 8 Aug 2019 12:44:53 -0700 Subject: Simplify the weighted decay time calculation --- alc/effects/reverb.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'alc') diff --git a/alc/effects/reverb.cpp b/alc/effects/reverb.cpp index 77ac0f94..423aedd8 100644 --- a/alc/effects/reverb.cpp +++ b/alc/effects/reverb.cpp @@ -767,15 +767,11 @@ void LateReverb::updateLines(const ALfloat density, const ALfloat diffusion, * approximate bandwidth. This attempts to compensate for losses of energy * that reduce decay time due to scattering into highly attenuated bands. */ - const ALfloat bandWeights[3]{ - lf0norm*norm_weight_factor, - hf0norm*norm_weight_factor - lf0norm*norm_weight_factor, - 1.0f - hf0norm*norm_weight_factor}; - DensityGain[1] = CalcDensityGain( - CalcDecayCoeff(length, - bandWeights[0]*lfDecayTime + bandWeights[1]*mfDecayTime + bandWeights[2]*hfDecayTime - ) - ); + const ALfloat decayTimeWeighted{ + (lf0norm*norm_weight_factor)*lfDecayTime + + (hf0norm*norm_weight_factor - lf0norm*norm_weight_factor)*mfDecayTime + + (1.0f - hf0norm*norm_weight_factor)*hfDecayTime}; + DensityGain[1] = CalcDensityGain(CalcDecayCoeff(length, decayTimeWeighted)); /* Calculate the all-pass feed-back/forward coefficient. */ VecAp.Coeff = std::sqrt(0.5f) * std::pow(diffusion, 2.0f); -- cgit v1.2.3