aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32
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 /OpenAL32
parentb3cb511c06e669a2024025fc3b3206674c70d737 (diff)
Use inline minF/maxF/clampF functions instead of the __min/__max macros
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/Include/alu.h8
-rw-r--r--OpenAL32/alFilter.c4
2 files changed, 11 insertions, 1 deletions
diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h
index 609978f5..65d8d3a7 100644
--- a/OpenAL32/Include/alu.h
+++ b/OpenAL32/Include/alu.h
@@ -127,6 +127,14 @@ enum DistanceModel {
#endif
+static __inline ALfloat minF(ALfloat a, ALfloat b)
+{ return ((a > b) ? b : a); }
+static __inline ALfloat maxF(ALfloat a, ALfloat b)
+{ return ((a > b) ? a : b); }
+static __inline ALfloat clampF(ALfloat val, ALfloat mn, ALfloat mx)
+{ return minF(mx, maxF(mn, val)); }
+
+
static __inline ALdouble lerp(ALdouble val1, ALdouble val2, ALdouble mu)
{
return val1 + (val2-val1)*mu;
diff --git a/OpenAL32/alFilter.c b/OpenAL32/alFilter.c
index 063c26c9..13391ab0 100644
--- a/OpenAL32/alFilter.c
+++ b/OpenAL32/alFilter.c
@@ -385,10 +385,12 @@ ALfloat lpCoeffCalc(ALfloat g, ALfloat cw)
/* Be careful with gains < 0.01, as that causes the coefficient
* head towards 1, which will flatten the signal */
- g = __max(g, 0.01f);
if(g < 0.9999f) /* 1-epsilon */
+ {
+ g = maxF(g, 0.01f);
a = (1 - g*cw - aluSqrt(2*g*(1-cw) - g*g*(1 - cw*cw))) /
(1 - g);
+ }
return a;
}