aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-01-15 09:17:15 -0800
committerChris Robinson <[email protected]>2018-01-15 09:17:15 -0800
commit47c9b0a17e7e497aeeadea32ddb48e62bcf4a9ce (patch)
tree334632aa3ba74327652faf8be39a764a80591154
parent44795b8614564ea65ae864419dedaa610742350c (diff)
Simplify preparing the T60 filters
-rw-r--r--Alc/effects/reverb.c61
1 files changed, 11 insertions, 50 deletions
diff --git a/Alc/effects/reverb.c b/Alc/effects/reverb.c
index 39d449ee..76f9b2d6 100644
--- a/Alc/effects/reverb.c
+++ b/Alc/effects/reverb.c
@@ -713,7 +713,6 @@ static inline void CalcHighpassCoeffs(const ALfloat gain, const ALfloat w, ALflo
coeffs[0] = 1.0f;
coeffs[1] = 0.0f;
coeffs[2] = 0.0f;
-
return;
}
@@ -758,7 +757,6 @@ static inline void CalcLowpassCoeffs(const ALfloat gain, const ALfloat w, ALfloa
coeffs[0] = 1.0f;
coeffs[1] = 0.0f;
coeffs[2] = 0.0f;
-
return;
}
@@ -830,7 +828,6 @@ static inline void CalcLowShelfCoeffs(const ALfloat gain, const ALfloat w, ALflo
coeffs[0] = 1.0f;
coeffs[1] = 0.0f;
coeffs[2] = 0.0f;
-
return;
}
@@ -902,7 +899,6 @@ static inline void CalcHighShelfCoeffs(const ALfloat gain, const ALfloat w, ALfl
coeffs[0] = 1.0f;
coeffs[1] = 0.0f;
coeffs[2] = 0.0f;
-
return;
}
@@ -933,71 +929,36 @@ static void CalcT60DampingCoeffs(const ALfloat length, const ALfloat lfDecayTime
ALfloat mfGain = CalcDecayCoeff(length, mfDecayTime);
ALfloat hfGain = CalcDecayCoeff(length, hfDecayTime);
- if(lfGain < mfGain)
+ if(lfGain <= mfGain)
{
CalcHighpassCoeffs(lfGain / mfGain, lfW, lfcoeffs);
- if(mfGain < hfGain)
- {
- CalcLowShelfCoeffs(mfGain / hfGain, hfW, hfcoeffs);
- hfcoeffs[0] *= hfGain; hfcoeffs[1] *= hfGain;
- }
- else if(mfGain > hfGain)
+ if(mfGain >= hfGain)
{
CalcLowpassCoeffs(hfGain / mfGain, hfW, hfcoeffs);
hfcoeffs[0] *= mfGain; hfcoeffs[1] *= mfGain;
}
else
{
- hfcoeffs[0] = mfGain;
- hfcoeffs[1] = 0.0f;
- hfcoeffs[2] = 0.0f;
+ CalcLowShelfCoeffs(mfGain / hfGain, hfW, hfcoeffs);
+ hfcoeffs[0] *= hfGain; hfcoeffs[1] *= hfGain;
}
}
- else if(lfGain > mfGain)
+ else
{
CalcHighShelfCoeffs(mfGain / lfGain, lfW, lfcoeffs);
- if(mfGain < hfGain)
- {
- ALfloat hg = mfGain / lfGain;
- ALfloat lg = mfGain / hfGain;
- ALfloat mg = maxf(lfGain, hfGain) / maxf(hg, lg);
-
- CalcLowShelfCoeffs(lg, hfW, hfcoeffs);
- hfcoeffs[0] *= mg; hfcoeffs[1] *= mg;
- }
- else if(mfGain > hfGain)
+ if(mfGain >= hfGain)
{
CalcLowpassCoeffs(hfGain / mfGain, hfW, hfcoeffs);
hfcoeffs[0] *= lfGain; hfcoeffs[1] *= lfGain;
}
else
{
- hfcoeffs[0] = lfGain;
- hfcoeffs[1] = 0.0f;
- hfcoeffs[2] = 0.0f;
- }
- }
- else
- {
- lfcoeffs[0] = 1.0f;
- lfcoeffs[1] = 0.0f;
- lfcoeffs[2] = 0.0f;
+ ALfloat hg = mfGain / lfGain;
+ ALfloat lg = mfGain / hfGain;
+ ALfloat mg = maxf(lfGain, hfGain) / maxf(hg, lg);
- if(mfGain < hfGain)
- {
- CalcLowShelfCoeffs(mfGain / hfGain, hfW, hfcoeffs);
- hfcoeffs[0] *= hfGain; hfcoeffs[1] *= hfGain;
- }
- else if(mfGain > hfGain)
- {
- CalcLowpassCoeffs(hfGain / mfGain, hfW, hfcoeffs);
- hfcoeffs[0] *= mfGain; hfcoeffs[1] *= mfGain;
- }
- else
- {
- hfcoeffs[0] = mfGain;
- hfcoeffs[1] = 0.0f;
- hfcoeffs[2] = 0.0f;
+ CalcLowShelfCoeffs(lg, hfW, hfcoeffs);
+ hfcoeffs[0] *= mg; hfcoeffs[1] *= mg;
}
}
}