From f7a8e3db3578e439f3620979409357f37d0c0383 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 12 Mar 2012 13:31:19 -0700 Subject: [PATCH] Don't assume the calculated HRTF delta for the gain difference is less than 1 --- Alc/hrtf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Alc/hrtf.c b/Alc/hrtf.c index db14d634..24277898 100644 --- a/Alc/hrtf.c +++ b/Alc/hrtf.c @@ -79,7 +79,7 @@ static void CalcAzIndices(ALuint evidx, ALfloat az, ALuint *azidx, ALfloat *azmu // values. ALfloat CalcHrtfDelta(ALfloat oldGain, ALfloat newGain, const ALfloat olddir[3], const ALfloat newdir[3]) { - ALfloat gainChange, angleChange; + ALfloat gainChange, angleChange, change; // Calculate the normalized dB gain change. newGain = maxf(newGain, 0.0001f); @@ -102,7 +102,8 @@ ALfloat CalcHrtfDelta(ALfloat oldGain, ALfloat newGain, const ALfloat olddir[3], // Use the largest of the two changes for the delta factor, and apply a // significance shaping function to it. - return clampf(angleChange*2.0f, gainChange*2.0f, 1.0f); + change = maxf(angleChange, gainChange) * 2.0f; + return minf(change, 1.0f); } // Calculates static HRIR coefficients and delays for the given polar -- 2.11.4.GIT