diff options
Diffstat (limited to 'OpenAL32')
-rw-r--r-- | OpenAL32/Include/alu.h | 8 | ||||
-rw-r--r-- | OpenAL32/alFilter.c | 4 |
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; } |