aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-02-23 01:43:55 -0800
committerChris Robinson <[email protected]>2019-02-23 01:43:55 -0800
commit42934b09e5b83c21e8a03438c7e1f0eb91310328 (patch)
treef07fdc101d7856e184048452ecc9649a941053f6 /Alc
parent3683e31662f187ef539ab65134176b96f9c40b3e (diff)
Avoid multiple int-to-float conversions
Diffstat (limited to 'Alc')
-rw-r--r--Alc/effects/reverb.cpp29
1 files changed, 17 insertions, 12 deletions
diff --git a/Alc/effects/reverb.cpp b/Alc/effects/reverb.cpp
index 3f0aef5c..00a9e30f 100644
--- a/Alc/effects/reverb.cpp
+++ b/Alc/effects/reverb.cpp
@@ -673,13 +673,12 @@ ALfloat CalcLimitedHfRatio(const ALfloat hfRatio, const ALfloat airAbsorptionGai
* decay times for each band split at two reference frequencies.
*/
void CalcT60DampingCoeffs(const ALfloat length, const ALfloat lfDecayTime,
- const ALfloat mfDecayTime, const ALfloat hfDecayTime,
- const ALfloat lf0norm, const ALfloat hf0norm,
- T60Filter *filter)
+ const ALfloat mfDecayTime, const ALfloat hfDecayTime, const ALfloat lf0norm,
+ const ALfloat hf0norm, T60Filter *filter)
{
- ALfloat lfGain{CalcDecayCoeff(length, lfDecayTime)};
- ALfloat mfGain{CalcDecayCoeff(length, mfDecayTime)};
- ALfloat hfGain{CalcDecayCoeff(length, hfDecayTime)};
+ const ALfloat lfGain{CalcDecayCoeff(length, lfDecayTime)};
+ const ALfloat mfGain{CalcDecayCoeff(length, mfDecayTime)};
+ const ALfloat hfGain{CalcDecayCoeff(length, hfDecayTime)};
filter->MidGain[1] = mfGain;
filter->LFFilter.setParams(BiquadType::LowShelf, lfGain/mfGain, lf0norm,
@@ -689,7 +688,8 @@ void CalcT60DampingCoeffs(const ALfloat length, const ALfloat lfDecayTime,
}
/* Update the offsets for the main effect delay line. */
-ALvoid UpdateDelayLine(const ALfloat earlyDelay, const ALfloat lateDelay, const ALfloat density, const ALfloat decayTime, const ALuint frequency, ReverbState *State)
+void UpdateDelayLine(const ALfloat earlyDelay, const ALfloat lateDelay, const ALfloat density,
+ const ALfloat decayTime, const ALfloat frequency, ReverbState *State)
{
const ALfloat multiplier{CalcDelayLengthMult(density)};
@@ -717,7 +717,8 @@ ALvoid UpdateDelayLine(const ALfloat earlyDelay, const ALfloat lateDelay, const
}
/* Update the early reflection line lengths and gain coefficients. */
-ALvoid UpdateEarlyLines(const ALfloat density, const ALfloat diffusion, const ALfloat decayTime, const ALuint frequency, EarlyReflections *Early)
+void UpdateEarlyLines(const ALfloat density, const ALfloat diffusion, const ALfloat decayTime,
+ const ALfloat frequency, EarlyReflections *Early)
{
const ALfloat multiplier{CalcDelayLengthMult(density)};
@@ -744,12 +745,14 @@ ALvoid UpdateEarlyLines(const ALfloat density, const ALfloat diffusion, const AL
}
/* Update the late reverb line lengths and T60 coefficients. */
-ALvoid UpdateLateLines(const ALfloat density, const ALfloat diffusion, const ALfloat lfDecayTime, const ALfloat mfDecayTime, const ALfloat hfDecayTime, const ALfloat lf0norm, const ALfloat hf0norm, const ALuint frequency, LateReverb *Late)
+void UpdateLateLines(const ALfloat density, const ALfloat diffusion, const ALfloat lfDecayTime,
+ const ALfloat mfDecayTime, const ALfloat hfDecayTime, const ALfloat lf0norm,
+ const ALfloat hf0norm, const ALfloat frequency, LateReverb *Late)
{
/* Scaling factor to convert the normalized reference frequencies from
* representing 0...freq to 0...max_reference.
*/
- const ALfloat norm_weight_factor = static_cast<ALfloat>(frequency) / AL_EAXREVERB_MAX_HFREFERENCE;
+ const ALfloat norm_weight_factor{frequency / AL_EAXREVERB_MAX_HFREFERENCE};
/* To compensate for changes in modal density and decay time of the late
* reverb signal, the input is attenuated based on the maximal energy of
@@ -854,7 +857,9 @@ alu::Matrix GetTransformFromVector(const ALfloat *vec)
}
/* Update the early and late 3D panning gains. */
-ALvoid Update3DPanning(const ALfloat *ReflectionsPan, const ALfloat *LateReverbPan, const ALfloat earlyGain, const ALfloat lateGain, const EffectTarget &target, ReverbState *State)
+void Update3DPanning(const ALfloat *ReflectionsPan, const ALfloat *LateReverbPan,
+ const ALfloat earlyGain, const ALfloat lateGain, const EffectTarget &target,
+ ReverbState *State)
{
/* Create matrices that transform a B-Format signal according to the
* panning vectors.
@@ -881,7 +886,7 @@ void ReverbState::update(const ALCcontext *Context, const ALeffectslot *Slot, co
{
const ALCdevice *Device{Context->Device};
const ALlistener &Listener = Context->Listener;
- const ALuint frequency{Device->Frequency};
+ const auto frequency = static_cast<ALfloat>(Device->Frequency);
/* Calculate the master filters */
ALfloat hf0norm{minf(props->Reverb.HFReference / frequency, 0.49f)};