Remove the cosine resampler
It's too slow when auxiliary sends are being used.
This commit is contained in:
parent
2595d85cca
commit
aaff188b3b
44
Alc/mixer.c
44
Alc/mixer.c
@ -48,25 +48,16 @@ static __inline ALdouble lerp(ALdouble val1, ALdouble val2, ALint frac)
|
||||
val1 += ((val2-val1) * (frac * (1.0/(1<<FRACTIONBITS))));
|
||||
return val1;
|
||||
}
|
||||
static __inline ALdouble cos_lerp(ALdouble val1, ALdouble val2, ALint frac)
|
||||
{
|
||||
val1 += ((val2-val1) * ((1.0-cos(frac * (1.0/(1<<FRACTIONBITS)) * M_PI)) * 0.5));
|
||||
return val1;
|
||||
}
|
||||
|
||||
static __inline ALdouble point16(ALdouble val1, ALdouble val2, ALint frac)
|
||||
{ return point(val1, val2, frac) / 32767.0; }
|
||||
static __inline ALdouble lerp16(ALdouble val1, ALdouble val2, ALint frac)
|
||||
{ return lerp(val1, val2, frac) / 32767.0; }
|
||||
static __inline ALdouble cos_lerp16(ALdouble val1, ALdouble val2, ALint frac)
|
||||
{ return cos_lerp(val1, val2, frac) / 32767.0; }
|
||||
|
||||
static __inline ALdouble point8(ALdouble val1, ALdouble val2, ALint frac)
|
||||
{ return (point(val1, val2, frac)-128.0) / 127.0; }
|
||||
static __inline ALdouble lerp8(ALdouble val1, ALdouble val2, ALint frac)
|
||||
{ return (lerp(val1, val2, frac)-128.0) / 127.0; }
|
||||
static __inline ALdouble cos_lerp8(ALdouble val1, ALdouble val2, ALint frac)
|
||||
{ return (cos_lerp(val1, val2, frac)-128.0) / 127.0; }
|
||||
|
||||
|
||||
|
||||
@ -204,15 +195,12 @@ static void Mix_##T##_Mono_##sampler(ALsource *Source, ALCdevice *Device, \
|
||||
|
||||
DECL_MIX_MONO(ALfloat, point)
|
||||
DECL_MIX_MONO(ALfloat, lerp)
|
||||
DECL_MIX_MONO(ALfloat, cos_lerp)
|
||||
|
||||
DECL_MIX_MONO(ALshort, point16)
|
||||
DECL_MIX_MONO(ALshort, lerp16)
|
||||
DECL_MIX_MONO(ALshort, cos_lerp16)
|
||||
|
||||
DECL_MIX_MONO(ALubyte, point8)
|
||||
DECL_MIX_MONO(ALubyte, lerp8)
|
||||
DECL_MIX_MONO(ALubyte, cos_lerp8)
|
||||
|
||||
|
||||
#define DECL_MIX_STEREO(T,sampler) \
|
||||
@ -361,15 +349,12 @@ static void Mix_##T##_Stereo_##sampler(ALsource *Source, ALCdevice *Device, \
|
||||
|
||||
DECL_MIX_STEREO(ALfloat, point)
|
||||
DECL_MIX_STEREO(ALfloat, lerp)
|
||||
DECL_MIX_STEREO(ALfloat, cos_lerp)
|
||||
|
||||
DECL_MIX_STEREO(ALshort, point16)
|
||||
DECL_MIX_STEREO(ALshort, lerp16)
|
||||
DECL_MIX_STEREO(ALshort, cos_lerp16)
|
||||
|
||||
DECL_MIX_STEREO(ALubyte, point8)
|
||||
DECL_MIX_STEREO(ALubyte, lerp8)
|
||||
DECL_MIX_STEREO(ALubyte, cos_lerp8)
|
||||
|
||||
|
||||
#define DECL_MIX_MC(T,chans,sampler) \
|
||||
@ -509,15 +494,12 @@ static const Channel QuadChans[] = { FRONT_LEFT, FRONT_RIGHT,
|
||||
BACK_LEFT, BACK_RIGHT };
|
||||
DECL_MIX_MC(ALfloat, QuadChans, point)
|
||||
DECL_MIX_MC(ALfloat, QuadChans, lerp)
|
||||
DECL_MIX_MC(ALfloat, QuadChans, cos_lerp)
|
||||
|
||||
DECL_MIX_MC(ALshort, QuadChans, point16)
|
||||
DECL_MIX_MC(ALshort, QuadChans, lerp16)
|
||||
DECL_MIX_MC(ALshort, QuadChans, cos_lerp16)
|
||||
|
||||
DECL_MIX_MC(ALubyte, QuadChans, point8)
|
||||
DECL_MIX_MC(ALubyte, QuadChans, lerp8)
|
||||
DECL_MIX_MC(ALubyte, QuadChans, cos_lerp8)
|
||||
|
||||
|
||||
static const Channel X51Chans[] = { FRONT_LEFT, FRONT_RIGHT,
|
||||
@ -525,15 +507,12 @@ static const Channel X51Chans[] = { FRONT_LEFT, FRONT_RIGHT,
|
||||
BACK_LEFT, BACK_RIGHT };
|
||||
DECL_MIX_MC(ALfloat, X51Chans, point)
|
||||
DECL_MIX_MC(ALfloat, X51Chans, lerp)
|
||||
DECL_MIX_MC(ALfloat, X51Chans, cos_lerp)
|
||||
|
||||
DECL_MIX_MC(ALshort, X51Chans, point16)
|
||||
DECL_MIX_MC(ALshort, X51Chans, lerp16)
|
||||
DECL_MIX_MC(ALshort, X51Chans, cos_lerp16)
|
||||
|
||||
DECL_MIX_MC(ALubyte, X51Chans, point8)
|
||||
DECL_MIX_MC(ALubyte, X51Chans, lerp8)
|
||||
DECL_MIX_MC(ALubyte, X51Chans, cos_lerp8)
|
||||
|
||||
|
||||
static const Channel X61Chans[] = { FRONT_LEFT, FRONT_RIGHT,
|
||||
@ -542,15 +521,12 @@ static const Channel X61Chans[] = { FRONT_LEFT, FRONT_RIGHT,
|
||||
SIDE_LEFT, SIDE_RIGHT };
|
||||
DECL_MIX_MC(ALfloat, X61Chans, point)
|
||||
DECL_MIX_MC(ALfloat, X61Chans, lerp)
|
||||
DECL_MIX_MC(ALfloat, X61Chans, cos_lerp)
|
||||
|
||||
DECL_MIX_MC(ALshort, X61Chans, point16)
|
||||
DECL_MIX_MC(ALshort, X61Chans, lerp16)
|
||||
DECL_MIX_MC(ALshort, X61Chans, cos_lerp16)
|
||||
|
||||
DECL_MIX_MC(ALubyte, X61Chans, point8)
|
||||
DECL_MIX_MC(ALubyte, X61Chans, lerp8)
|
||||
DECL_MIX_MC(ALubyte, X61Chans, cos_lerp8)
|
||||
|
||||
|
||||
static const Channel X71Chans[] = { FRONT_LEFT, FRONT_RIGHT,
|
||||
@ -559,15 +535,12 @@ static const Channel X71Chans[] = { FRONT_LEFT, FRONT_RIGHT,
|
||||
SIDE_LEFT, SIDE_RIGHT };
|
||||
DECL_MIX_MC(ALfloat, X71Chans, point)
|
||||
DECL_MIX_MC(ALfloat, X71Chans, lerp)
|
||||
DECL_MIX_MC(ALfloat, X71Chans, cos_lerp)
|
||||
|
||||
DECL_MIX_MC(ALshort, X71Chans, point16)
|
||||
DECL_MIX_MC(ALshort, X71Chans, lerp16)
|
||||
DECL_MIX_MC(ALshort, X71Chans, cos_lerp16)
|
||||
|
||||
DECL_MIX_MC(ALubyte, X71Chans, point8)
|
||||
DECL_MIX_MC(ALubyte, X71Chans, lerp8)
|
||||
DECL_MIX_MC(ALubyte, X71Chans, cos_lerp8)
|
||||
|
||||
|
||||
#define DECL_MIX(T, sampler) \
|
||||
@ -612,15 +585,12 @@ static void Mix_##T##_##sampler(ALsource *Source, ALCdevice *Device, ALuint Chan
|
||||
|
||||
DECL_MIX(ALfloat, point)
|
||||
DECL_MIX(ALfloat, lerp)
|
||||
DECL_MIX(ALfloat, cos_lerp)
|
||||
|
||||
DECL_MIX(ALshort, point16)
|
||||
DECL_MIX(ALshort, lerp16)
|
||||
DECL_MIX(ALshort, cos_lerp16)
|
||||
|
||||
DECL_MIX(ALubyte, point8)
|
||||
DECL_MIX(ALubyte, lerp8)
|
||||
DECL_MIX(ALubyte, cos_lerp8)
|
||||
|
||||
|
||||
/* Stack data size can be whatever. Larger values need more stack, while
|
||||
@ -827,20 +797,6 @@ ALvoid MixSource(ALsource *Source, ALCdevice *Device, ALuint SamplesToDo)
|
||||
SrcData, &DataPosInt, &DataPosFrac,
|
||||
j, SamplesToDo, BufferSize);
|
||||
break;
|
||||
case COSINE_RESAMPLER:
|
||||
if(Bytes == 4)
|
||||
Mix_ALfloat_cos_lerp(Source, Device, Channels,
|
||||
SrcData, &DataPosInt, &DataPosFrac,
|
||||
j, SamplesToDo, BufferSize);
|
||||
else if(Bytes == 2)
|
||||
Mix_ALshort_cos_lerp16(Source, Device, Channels,
|
||||
SrcData, &DataPosInt, &DataPosFrac,
|
||||
j, SamplesToDo, BufferSize);
|
||||
else if(Bytes == 1)
|
||||
Mix_ALubyte_cos_lerp8(Source, Device, Channels,
|
||||
SrcData, &DataPosInt, &DataPosFrac,
|
||||
j, SamplesToDo, BufferSize);
|
||||
break;
|
||||
case RESAMPLER_MIN:
|
||||
case RESAMPLER_MAX:
|
||||
break;
|
||||
|
@ -14,7 +14,6 @@ extern "C" {
|
||||
typedef enum {
|
||||
POINT_RESAMPLER = 0,
|
||||
LINEAR_RESAMPLER,
|
||||
COSINE_RESAMPLER,
|
||||
|
||||
RESAMPLER_MAX,
|
||||
RESAMPLER_MIN = -1,
|
||||
|
@ -64,7 +64,6 @@
|
||||
# Selects the resampler used when mixing sources. Valid values are:
|
||||
# 0 - None (nearest sample, no interpolation)
|
||||
# 1 - Linear (extrapolates samples using a linear slope between samples)
|
||||
# 2 - Cosine (extrapolates using a (co)sine slope)
|
||||
# Specifying other values will result in using the default (linear).
|
||||
#resampler = 1
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user