From 1323e11701984d93c34b7049929b1f1d3bc418bc Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Fri, 20 Jul 2012 15:08:11 -0700 Subject: Interpolate between HRTF delay samples using the delay fraction --- Alc/hrtf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Alc/hrtf.c') diff --git a/Alc/hrtf.c b/Alc/hrtf.c index 735e53dc..16bc85a9 100644 --- a/Alc/hrtf.c +++ b/Alc/hrtf.c @@ -170,10 +170,10 @@ void GetLerpedHrtfCoeffs(const struct Hrtf *Hrtf, ALfloat elevation, ALfloat azi // Calculate the HRIR delays using linear interpolation. delays[0] = fastf2u(lerp(lerp(Hrtf->delays[lidx[0]], Hrtf->delays[lidx[1]], mu[0]), lerp(Hrtf->delays[lidx[2]], Hrtf->delays[lidx[3]], mu[1]), - mu[2]) * 65536.0f); + mu[2]) + 0.5f) << HRTFDELAY_BITS; delays[1] = fastf2u(lerp(lerp(Hrtf->delays[ridx[0]], Hrtf->delays[ridx[1]], mu[0]), lerp(Hrtf->delays[ridx[2]], Hrtf->delays[ridx[3]], mu[1]), - mu[2]) * 65536.0f); + mu[2]) + 0.5f) << HRTFDELAY_BITS; } // Calculates the moving HRIR target coefficients, target delays, and @@ -267,10 +267,10 @@ ALuint GetMovingHrtfCoeffs(const struct Hrtf *Hrtf, ALfloat elevation, ALfloat a delays[0] = fastf2u(lerp(lerp(Hrtf->delays[lidx[0]], Hrtf->delays[lidx[1]], mu[0]), lerp(Hrtf->delays[lidx[2]], Hrtf->delays[lidx[3]], mu[1]), - mu[2]) * 65536.0f); + mu[2]) + 0.5f) << HRTFDELAY_BITS; delays[1] = fastf2u(lerp(lerp(Hrtf->delays[ridx[0]], Hrtf->delays[ridx[1]], mu[0]), lerp(Hrtf->delays[ridx[2]], Hrtf->delays[ridx[3]], mu[1]), - mu[2]) * 65536.0f); + mu[2]) + 0.5f) << HRTFDELAY_BITS; delayStep[0] = fastf2i(step * (delays[0] - left)); delayStep[1] = fastf2i(step * (delays[1] - right)); -- cgit v1.2.3