aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/hrtf.c
diff options
context:
space:
mode:
Diffstat (limited to 'Alc/hrtf.c')
-rw-r--r--Alc/hrtf.c38
1 files changed, 11 insertions, 27 deletions
diff --git a/Alc/hrtf.c b/Alc/hrtf.c
index e1c1d7b3..91895cb9 100644
--- a/Alc/hrtf.c
+++ b/Alc/hrtf.c
@@ -77,10 +77,9 @@ static ALsizei CalcAzIndex(ALsizei azcount, ALfloat az)
}
/* Calculates static HRIR coefficients and delays for the given polar elevation
- * and azimuth in radians. The coefficients are normalized and attenuated by
- * the specified gain.
+ * and azimuth in radians. The coefficients are normalized.
*/
-void GetHrtfCoeffs(const struct Hrtf *Hrtf, ALfloat elevation, ALfloat azimuth, ALfloat spread, ALfloat gain, ALfloat (*coeffs)[2], ALsizei *delays)
+void GetHrtfCoeffs(const struct Hrtf *Hrtf, ALfloat elevation, ALfloat azimuth, ALfloat spread, ALfloat (*coeffs)[2], ALsizei *delays)
{
ALsizei evidx, azidx, lidx, ridx;
ALsizei azcount, evoffset;
@@ -102,36 +101,21 @@ void GetHrtfCoeffs(const struct Hrtf *Hrtf, ALfloat elevation, ALfloat azimuth,
ridx = evoffset + ((azcount-azidx) % azcount);
/* Calculate the HRIR delays. */
- delays[0] = fastf2i(Hrtf->delays[lidx]*dirfact + 0.5f) << HRTFDELAY_BITS;
- delays[1] = fastf2i(Hrtf->delays[ridx]*dirfact + 0.5f) << HRTFDELAY_BITS;
+ delays[0] = fastf2i(Hrtf->delays[lidx]*dirfact + 0.5f);
+ delays[1] = fastf2i(Hrtf->delays[ridx]*dirfact + 0.5f);
/* Calculate the sample offsets for the HRIR indices. */
lidx *= Hrtf->irSize;
ridx *= Hrtf->irSize;
- /* Calculate the normalized and attenuated HRIR coefficients. Zero the
- * coefficients if gain is too low.
- */
- if(gain > 0.0001f)
- {
- gain /= 32767.0f;
-
- i = 0;
- coeffs[i][0] = lerp(PassthruCoeff, Hrtf->coeffs[lidx+i], dirfact)*gain;
- coeffs[i][1] = lerp(PassthruCoeff, Hrtf->coeffs[ridx+i], dirfact)*gain;
- for(i = 1;i < Hrtf->irSize;i++)
- {
- coeffs[i][0] = Hrtf->coeffs[lidx+i]*gain * dirfact;
- coeffs[i][1] = Hrtf->coeffs[ridx+i]*gain * dirfact;
- }
- }
- else
+ /* Calculate the normalized and attenuated HRIR coefficients. */
+ i = 0;
+ coeffs[i][0] = lerp(PassthruCoeff, Hrtf->coeffs[lidx+i], dirfact) * (1.0f/32767.0f);
+ coeffs[i][1] = lerp(PassthruCoeff, Hrtf->coeffs[ridx+i], dirfact) * (1.0f/32767.0f);
+ for(i = 1;i < Hrtf->irSize;i++)
{
- for(i = 0;i < Hrtf->irSize;i++)
- {
- coeffs[i][0] = 0.0f;
- coeffs[i][1] = 0.0f;
- }
+ coeffs[i][0] = Hrtf->coeffs[lidx+i]*(1.0f/32767.0f) * dirfact;
+ coeffs[i][1] = Hrtf->coeffs[ridx+i]*(1.0f/32767.0f) * dirfact;
}
}