aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/hrtf.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2011-08-16 04:21:58 -0700
committerChris Robinson <[email protected]>2011-08-16 04:21:58 -0700
commit8a51a7ea2d5234555f00cf9a391eefceb1989efa (patch)
tree394772e084fd2a21776a1872bdc267bd9f6de53c /Alc/hrtf.c
parentb3cb511c06e669a2024025fc3b3206674c70d737 (diff)
Use inline minF/maxF/clampF functions instead of the __min/__max macros
Diffstat (limited to 'Alc/hrtf.c')
-rw-r--r--Alc/hrtf.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/Alc/hrtf.c b/Alc/hrtf.c
index c90a45dc..4b3b2160 100644
--- a/Alc/hrtf.c
+++ b/Alc/hrtf.c
@@ -65,7 +65,7 @@ static void CalcEvIndices(ALfloat ev, ALuint *evidx, ALfloat *evmu)
{
ev = (M_PI/2.0f + ev) * (ELEV_COUNT-1) / M_PI;
evidx[0] = (ALuint)ev;
- evidx[1] = __min(evidx[0] + 1, ELEV_COUNT-1);
+ evidx[1] = minF(evidx[0] + 1, ELEV_COUNT-1);
*evmu = ev - evidx[0];
}
@@ -86,11 +86,11 @@ 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, delta;
+ ALfloat gainChange, angleChange;
// Calculate the normalized dB gain change.
- newGain = __max(newGain, 0.0001f);
- oldGain = __max(oldGain, 0.0001f);
+ newGain = maxF(newGain, 0.0001f);
+ oldGain = maxF(oldGain, 0.0001f);
gainChange = aluFabs(log10(newGain / oldGain) / log10(0.0001f));
// Calculate the normalized listener to source angle change when there is
@@ -109,8 +109,7 @@ 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.
- delta = __max(gainChange, angleChange) * 2.0f;
- return __min(delta, 1.0f);
+ return clampF(angleChange*2.0f, gainChange*2.0f, 1.0f);
}
// Calculates static HRIR coefficients and delays for the given polar
@@ -224,8 +223,7 @@ ALuint GetMovingHrtfCoeffs(ALfloat elevation, ALfloat azimuth, ALfloat gain, ALf
ridx[3] = evOffset[evidx[1]] + ((azCount[evidx[1]]-azidx[1]) % azCount[evidx[1]]);
// Calculate the stepping parameters.
- delta = floor(delta*(Hrtf.sampleRate*0.015f) + 0.5);
- delta = __max(delta, 1.0f);
+ delta = maxF(floor(delta*(Hrtf.sampleRate*0.015f) + 0.5), 1.0f);
step = 1.0f / delta;
// Calculate the normalized and attenuated target HRIR coefficients using