Use float types for the resamplers instead of double

This commit is contained in:
Chris Robinson
2011-09-23 23:03:59 -07:00
parent a9b6b284c0
commit b4f9f89480
3 changed files with 26 additions and 26 deletions
+2 -2
View File
@@ -584,8 +584,8 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
if(Angle >= InnerAngle && Angle <= OuterAngle)
{
ALfloat scale = (Angle-InnerAngle) / (OuterAngle-InnerAngle);
ConeVolume = lerp(1.0, ALSource->flOuterGain, scale);
ConeHF = lerp(1.0, ALSource->OuterGainHF, scale);
ConeVolume = lerp(1.0f, ALSource->flOuterGain, scale);
ConeHF = lerp(1.0f, ALSource->OuterGainHF, scale);
}
else if(Angle > OuterAngle)
{
+17 -17
View File
@@ -37,29 +37,29 @@
#include "bs2b.h"
static __inline ALdouble point32(const ALfloat *vals, ALint step, ALint frac)
static __inline ALfloat point32(const ALfloat *vals, ALint step, ALint frac)
{ return vals[0]; (void)step; (void)frac; }
static __inline ALdouble lerp32(const ALfloat *vals, ALint step, ALint frac)
{ return lerp(vals[0], vals[step], frac * (1.0/FRACTIONONE)); }
static __inline ALdouble cubic32(const ALfloat *vals, ALint step, ALint frac)
static __inline ALfloat lerp32(const ALfloat *vals, ALint step, ALint frac)
{ return lerp(vals[0], vals[step], frac * (1.0f/FRACTIONONE)); }
static __inline ALfloat cubic32(const ALfloat *vals, ALint step, ALint frac)
{ return cubic(vals[-step], vals[0], vals[step], vals[step+step],
frac * (1.0/FRACTIONONE)); }
frac * (1.0f/FRACTIONONE)); }
static __inline ALdouble point16(const ALshort *vals, ALint step, ALint frac)
{ return vals[0] * (1.0/32767.0); (void)step; (void)frac; }
static __inline ALdouble lerp16(const ALshort *vals, ALint step, ALint frac)
{ return lerp(vals[0], vals[step], frac * (1.0/FRACTIONONE)) * (1.0/32767.0); }
static __inline ALdouble cubic16(const ALshort *vals, ALint step, ALint frac)
static __inline ALfloat point16(const ALshort *vals, ALint step, ALint frac)
{ return vals[0] * (1.0f/32767.0f); (void)step; (void)frac; }
static __inline ALfloat lerp16(const ALshort *vals, ALint step, ALint frac)
{ return lerp(vals[0], vals[step], frac * (1.0f/FRACTIONONE)) * (1.0f/32767.0f); }
static __inline ALfloat cubic16(const ALshort *vals, ALint step, ALint frac)
{ return cubic(vals[-step], vals[0], vals[step], vals[step+step],
frac * (1.0/FRACTIONONE)) * (1.0/32767.0); }
frac * (1.0f/FRACTIONONE)) * (1.0f/32767.0f); }
static __inline ALdouble point8(const ALbyte *vals, ALint step, ALint frac)
{ return vals[0] * (1.0/127.0); (void)step; (void)frac; }
static __inline ALdouble lerp8(const ALbyte *vals, ALint step, ALint frac)
{ return lerp(vals[0], vals[step], frac * (1.0/FRACTIONONE)) * (1.0/127.0); }
static __inline ALdouble cubic8(const ALbyte *vals, ALint step, ALint frac)
static __inline ALfloat point8(const ALbyte *vals, ALint step, ALint frac)
{ return vals[0] * (1.0f/127.0f); (void)step; (void)frac; }
static __inline ALfloat lerp8(const ALbyte *vals, ALint step, ALint frac)
{ return lerp(vals[0], vals[step], frac * (1.0f/FRACTIONONE)) * (1.0f/127.0f); }
static __inline ALfloat cubic8(const ALbyte *vals, ALint step, ALint frac)
{ return cubic(vals[-step], vals[0], vals[step], vals[step+step],
frac * (1.0/FRACTIONONE)) * (1.0/127.0); }
frac * (1.0f/FRACTIONONE)) * (1.0f/127.0f); }
#ifdef __GNUC__
#define LIKELY(x) __builtin_expect(!!(x), 1)
+7 -7
View File
@@ -162,17 +162,17 @@ static __inline ALint clampi(ALint val, ALint min, ALint max)
{ return mini(max, maxi(min, val)); }
static __inline ALdouble lerp(ALdouble val1, ALdouble val2, ALdouble mu)
static __inline ALfloat lerp(ALfloat val1, ALfloat val2, ALfloat mu)
{
return val1 + (val2-val1)*mu;
}
static __inline ALdouble cubic(ALdouble val0, ALdouble val1, ALdouble val2, ALdouble val3, ALdouble mu)
static __inline ALfloat cubic(ALfloat val0, ALfloat val1, ALfloat val2, ALfloat val3, ALfloat mu)
{
ALdouble mu2 = mu*mu;
ALdouble a0 = -0.5*val0 + 1.5*val1 + -1.5*val2 + 0.5*val3;
ALdouble a1 = val0 + -2.5*val1 + 2.0*val2 + -0.5*val3;
ALdouble a2 = -0.5*val0 + 0.5*val2;
ALdouble a3 = val1;
ALfloat mu2 = mu*mu;
ALfloat a0 = -0.5f*val0 + 1.5f*val1 + -1.5f*val2 + 0.5f*val3;
ALfloat a1 = val0 + -2.5f*val1 + 2.0f*val2 + -0.5f*val3;
ALfloat a2 = -0.5f*val0 + 0.5f*val2;
ALfloat a3 = val1;
return a0*mu*mu2 + a1*mu2 + a2*mu + a3;
}