Use more proper enum names for the resampler

This commit is contained in:
Chris Robinson 2012-02-12 08:45:19 -08:00
parent 9f073b6f1b
commit e394d14cda
6 changed files with 25 additions and 29 deletions

View File

@ -588,17 +588,17 @@ static void alc_initconfig(void)
if(ConfigValueStr(NULL, "resampler", &str))
{
if(strcasecmp(str, "point") == 0 || strcasecmp(str, "none") == 0)
DefaultResampler = POINT_RESAMPLER;
DefaultResampler = PointResampler;
else if(strcasecmp(str, "linear") == 0)
DefaultResampler = LINEAR_RESAMPLER;
DefaultResampler = LinearResampler;
else if(strcasecmp(str, "cubic") == 0)
DefaultResampler = CUBIC_RESAMPLER;
DefaultResampler = CubicResampler;
else
{
char *end;
n = strtol(str, &end, 0);
if(*end == '\0' && n < RESAMPLER_MAX && n > RESAMPLER_MIN)
if(*end == '\0' && (n == PointResampler || n == LinearResampler || n == CubicResampler))
DefaultResampler = n;
else
WARN("Invalid resampler: %s\n", str);

View File

@ -173,10 +173,10 @@ ALvoid CalcNonAttnSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
}
if(!DirectChannels && Device->Hrtf)
ALSource->Params.DoMix = SelectHrtfMixer((ALSource->Params.Step==FRACTIONONE) ?
POINT_RESAMPLER : Resampler);
PointResampler : Resampler);
else
ALSource->Params.DoMix = SelectMixer((ALSource->Params.Step==FRACTIONONE) ?
POINT_RESAMPLER : Resampler);
PointResampler : Resampler);
/* Calculate gains */
DryGain = clampf(SourceVolume, MinVolume, MaxVolume);
@ -676,10 +676,10 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
}
if(Device->Hrtf)
ALSource->Params.DoMix = SelectHrtfMixer((ALSource->Params.Step==FRACTIONONE) ?
POINT_RESAMPLER : Resampler);
PointResampler : Resampler);
else
ALSource->Params.DoMix = SelectMixer((ALSource->Params.Step==FRACTIONONE) ?
POINT_RESAMPLER : Resampler);
PointResampler : Resampler);
if(Device->Hrtf)
{

View File

@ -439,14 +439,13 @@ MixerFunc SelectMixer(enum Resampler Resampler)
{
switch(Resampler)
{
case POINT_RESAMPLER:
case PointResampler:
return Mix_ALfloat_point32;
case LINEAR_RESAMPLER:
case LinearResampler:
return Mix_ALfloat_lerp32;
case CUBIC_RESAMPLER:
case CubicResampler:
return Mix_ALfloat_cubic32;
case RESAMPLER_MIN:
case RESAMPLER_MAX:
case ResamplerMax:
break;
}
return NULL;
@ -456,14 +455,13 @@ MixerFunc SelectHrtfMixer(enum Resampler Resampler)
{
switch(Resampler)
{
case POINT_RESAMPLER:
case PointResampler:
return Mix_Hrtf_ALfloat_point32;
case LINEAR_RESAMPLER:
case LinearResampler:
return Mix_Hrtf_ALfloat_lerp32;
case CUBIC_RESAMPLER:
case CubicResampler:
return Mix_Hrtf_ALfloat_cubic32;
case RESAMPLER_MIN:
case RESAMPLER_MAX:
case ResamplerMax:
break;
}
return NULL;

View File

@ -17,8 +17,8 @@ extern "C" {
extern enum Resampler DefaultResampler;
extern const ALsizei ResamplerPadding[RESAMPLER_MAX];
extern const ALsizei ResamplerPrePadding[RESAMPLER_MAX];
extern const ALsizei ResamplerPadding[ResamplerMax];
extern const ALsizei ResamplerPrePadding[ResamplerMax];
typedef struct ALbufferlistitem

View File

@ -127,13 +127,11 @@ typedef ALvoid (*MixerFunc)(struct ALsource *self, ALCdevice *Device,
ALuint BufferSize);
enum Resampler {
POINT_RESAMPLER = 0,
LINEAR_RESAMPLER,
CUBIC_RESAMPLER,
PointResampler,
LinearResampler,
CubicResampler,
RESAMPLER_MAX,
RESAMPLER_MIN = -1,
RESAMPLER_DEFAULT = LINEAR_RESAMPLER
ResamplerMax,
};
enum Channel {

View File

@ -33,13 +33,13 @@
#include "alAuxEffectSlot.h"
enum Resampler DefaultResampler = RESAMPLER_DEFAULT;
const ALsizei ResamplerPadding[RESAMPLER_MAX] = {
enum Resampler DefaultResampler = LinearResampler;
const ALsizei ResamplerPadding[ResamplerMax] = {
0, /* Point */
1, /* Linear */
2, /* Cubic */
};
const ALsizei ResamplerPrePadding[RESAMPLER_MAX] = {
const ALsizei ResamplerPrePadding[ResamplerMax] = {
0, /* Point */
0, /* Linear */
1, /* Cubic */