diff options
author | Chris Robinson <[email protected]> | 2019-08-05 11:37:05 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-08-05 11:37:05 -0700 |
commit | 3154a915b1f811416f3c29c6af0c0f13fc3acd3e (patch) | |
tree | ca8f86ca621f06037a360513f30748dac87fe3a0 /alc/effects/reverb.cpp | |
parent | 3bc9490fd2861bdb28951bae5af37500e93de7ad (diff) |
Remove the ReverbSpeedOfSound hack
No other effect depends on context or listener properties, so reverb being the
only exception for speed of sound and meters per unit was putting extra work on
the effect engine for no real reason. Especially since the reverb decay time
should be the time actual time to decay irrespective of other settings.
Diffstat (limited to 'alc/effects/reverb.cpp')
-rw-r--r-- | alc/effects/reverb.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/alc/effects/reverb.cpp b/alc/effects/reverb.cpp index a8c4523e..eb8db3d1 100644 --- a/alc/effects/reverb.cpp +++ b/alc/effects/reverb.cpp @@ -675,14 +675,15 @@ inline ALvoid CalcMatrixCoeffs(const ALfloat diffusion, ALfloat *x, ALfloat *y) * filters. */ ALfloat CalcLimitedHfRatio(const ALfloat hfRatio, const ALfloat airAbsorptionGainHF, - const ALfloat decayTime, const ALfloat SpeedOfSound) + const ALfloat decayTime) { /* Find the attenuation due to air absorption in dB (converting delay * time to meters using the speed of sound). Then reversing the decay * equation, solve for HF ratio. The delay length is cancelled out of * the equation, so it can be calculated once for all lines. */ - ALfloat limitRatio{1.0f / (CalcDecayLength(airAbsorptionGainHF, decayTime) * SpeedOfSound)}; + ALfloat limitRatio{1.0f / + (CalcDecayLength(airAbsorptionGainHF, decayTime) * SPEEDOFSOUNDMETRESPERSEC)}; /* Using the limit calculated above, apply the upper bound to the HF ratio. */ @@ -906,7 +907,6 @@ void ReverbState::update3DPanning(const ALfloat *ReflectionsPan, const ALfloat * void ReverbState::update(const ALCcontext *Context, const ALeffectslot *Slot, const EffectProps *props, const EffectTarget target) { const ALCdevice *Device{Context->mDevice.get()}; - const ALlistener &Listener = Context->mListener; const auto frequency = static_cast<ALfloat>(Device->Frequency); /* Calculate the master filters */ @@ -944,8 +944,7 @@ void ReverbState::update(const ALCcontext *Context, const ALeffectslot *Slot, co ALfloat hfRatio{props->Reverb.DecayHFRatio}; if(props->Reverb.DecayHFLimit && props->Reverb.AirAbsorptionGainHF < 1.0f) hfRatio = CalcLimitedHfRatio(hfRatio, props->Reverb.AirAbsorptionGainHF, - props->Reverb.DecayTime, Listener.Params.ReverbSpeedOfSound - ); + props->Reverb.DecayTime); /* Calculate the LF/HF decay times. */ const ALfloat lfDecayTime{clampf(props->Reverb.DecayTime * props->Reverb.DecayLFRatio, |