Convert shorts so that 0 remains 0
This commit is contained in:
parent
9fa2db0227
commit
7e362249ff
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user