aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/hrtf.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2012-07-20 15:08:11 -0700
committerChris Robinson <[email protected]>2012-07-20 15:08:11 -0700
commit1323e11701984d93c34b7049929b1f1d3bc418bc (patch)
tree3d30d3cc3e38b6c20f96ab76226291cd063ccede /Alc/hrtf.c
parent7ac9944bb3638845a168a99f4c302822932853b6 (diff)
Interpolate between HRTF delay samples using the delay fraction
Diffstat (limited to 'Alc/hrtf.c')
-rw-r--r--Alc/hrtf.c8
1 files changed, 4 insertions, 4 deletions
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));