aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/mixer.c
diff options
context:
space:
mode:
Diffstat (limited to 'Alc/mixer.c')
-rw-r--r--Alc/mixer.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/Alc/mixer.c b/Alc/mixer.c
index 2daac85b..356a760f 100644
--- a/Alc/mixer.c
+++ b/Alc/mixer.c
@@ -44,18 +44,13 @@ static __inline ALfloat aluF2F(ALfloat Value)
static __inline ALshort aluF2S(ALfloat Value)
{
- ALint i;
+ ALint i = 0;
+
+ if(Value < -1.0f) i = -32768;
+ else if(Value < 0.0f) i = (ALint)(Value*32768.0f);
+ else if(Value > 1.0f) i = 32767;
+ else if(Value > 0.0f) i = (ALint)(Value*32767.0f);
- if(Value < 0.0f)
- {
- i = (ALint)(Value*32768.0f);
- i = max(-32768, i);
- }
- else
- {
- i = (ALint)(Value*32767.0f);
- i = min( 32767, i);
- }
return ((ALshort)i);
}