From e394d14cdab07cab5fce75a2e175a3439c8c8edd Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 12 Feb 2012 08:45:19 -0800 Subject: [PATCH] Use more proper enum names for the resampler --- Alc/ALc.c | 8 ++++---- Alc/ALu.c | 8 ++++---- Alc/mixer.c | 18 ++++++++---------- OpenAL32/Include/alSource.h | 4 ++-- OpenAL32/Include/alu.h | 10 ++++------ OpenAL32/alSource.c | 6 +++--- 6 files changed, 25 insertions(+), 29 deletions(-) diff --git a/Alc/ALc.c b/Alc/ALc.c index a528aa69..1c786919 100644 --- a/Alc/ALc.c +++ b/Alc/ALc.c @@ -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); diff --git a/Alc/ALu.c b/Alc/ALu.c index ba43cb36..21d484c3 100644 --- a/Alc/ALu.c +++ b/Alc/ALu.c @@ -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) { diff --git a/Alc/mixer.c b/Alc/mixer.c index 8b3c754e..ed2f49a5 100644 --- a/Alc/mixer.c +++ b/Alc/mixer.c @@ -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; diff --git a/OpenAL32/Include/alSource.h b/OpenAL32/Include/alSource.h index bed7cfec..be3210bd 100644 --- a/OpenAL32/Include/alSource.h +++ b/OpenAL32/Include/alSource.h @@ -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 diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h index 64e5f2e2..fa71480a 100644 --- a/OpenAL32/Include/alu.h +++ b/OpenAL32/Include/alu.h @@ -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 { diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index d62a5c76..d52c69da 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -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 */