summaryrefslogtreecommitdiffstats
path: root/Alc/hrtf.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2012-03-12 13:31:19 -0700
committerChris Robinson <[email protected]>2012-03-12 13:31:19 -0700
commitf7a8e3db3578e439f3620979409357f37d0c0383 (patch)
treebd27d6ee7893b1f7f74ef98b4348599360900ea9 /Alc/hrtf.c
parent7747c320a824beb88dd527ebc2191f97d7472aa9 (diff)
Don't assume the calculated HRTF delta for the gain difference is less than 1
Diffstat (limited to 'Alc/hrtf.c')
-rw-r--r--Alc/hrtf.c5
1 files 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