diff options
author | Chris Robinson <[email protected]> | 2010-09-25 21:13:40 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2010-09-25 21:13:40 -0700 |
commit | 7e362249ff57109dcb8dfb4abbade46edea5746c (patch) | |
tree | f045cca08bfdd23dccd8aac663b1947f23424a5d /Alc | |
parent | 9fa2db0227e8fabb3fa26e3e299602321fe14c79 (diff) |
Convert shorts so that 0 remains 0
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/mixer.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Alc/mixer.c b/Alc/mixer.c index 56315097..a5c3d3c1 100644 --- a/Alc/mixer.c +++ b/Alc/mixer.c @@ -48,7 +48,7 @@ static __inline ALshort aluF2S(ALfloat Value) if(Value <= -1.0f) i = -32768; else if(Value >= 1.0f) i = 32767; - else i = (ALint)(Value*32767.5f - 0.5f); + else i = (ALint)(Value*32767.0f); return ((ALshort)i); } @@ -78,20 +78,20 @@ static __inline ALfloat cos_lerp32(ALfloat val1, ALfloat val2, ALint frac) static __inline ALfloat point16(ALfloat val1, ALfloat val2, ALint frac) { - return (val1+0.5f) / 32767.5f; + return val1 / 32767.0f; (void)val2; (void)frac; } static __inline ALfloat lerp16(ALfloat val1, ALfloat val2, ALint frac) { val1 += ((val2-val1)*(frac * (1.0f/(1<<FRACTIONBITS)))); - return (val1+0.5f) / 32767.5f; + return val1 / 32767.0f; } static __inline ALfloat cos_lerp16(ALfloat val1, ALfloat val2, ALint frac) { ALfloat mult = (1.0f-cos(frac * (1.0f/(1<<FRACTIONBITS)) * M_PI)) * 0.5f; val1 += ((val2-val1)*mult); - return (val1+0.5f) / 32767.5f; + return val1 / 32767.0f; } |