diff options
author | Chris Robinson <[email protected]> | 2019-09-22 21:19:19 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-09-22 21:19:19 -0700 |
commit | 24db8a3f4bdbd787c23ac6e2ec78c2bafed81f1f (patch) | |
tree | bd55bdfda7874eb56eb444fb888e896895057d63 /al | |
parent | 95996effaf04c87b7091c904e6545bc1e5e25aee (diff) |
Make the resampler type an enum class
Diffstat (limited to 'al')
-rw-r--r-- | al/source.cpp | 4 | ||||
-rw-r--r-- | al/state.cpp | 15 |
2 files changed, 10 insertions, 9 deletions
diff --git a/al/source.cpp b/al/source.cpp index 7eda4fb6..3aaaaf90 100644 --- a/al/source.cpp +++ b/al/source.cpp @@ -1295,7 +1295,7 @@ bool SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp prop, const a case AL_SOURCE_RESAMPLER_SOFT: CHECKSIZE(values, 1); - CHECKVAL(values[0] >= 0 && values[0] <= ResamplerMax); + CHECKVAL(values[0] >= 0 && values[0] <= static_cast<int>(Resampler::Max)); Source->mResampler = static_cast<Resampler>(values[0]); return UpdateSourceProps(Source, Context); @@ -1836,7 +1836,7 @@ bool GetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp prop, const a case AL_SOURCE_RESAMPLER_SOFT: CHECKSIZE(values, 1); - values[0] = Source->mResampler; + values[0] = static_cast<int>(Source->mResampler); return true; case AL_SOURCE_SPATIALIZE_SOFT: diff --git a/al/state.cpp b/al/state.cpp index 74fb3b55..8f456ed3 100644 --- a/al/state.cpp +++ b/al/state.cpp @@ -196,7 +196,7 @@ START_API_FUNC break; case AL_DEFAULT_RESAMPLER_SOFT: - value = ResamplerDefault ? AL_TRUE : AL_FALSE; + value = static_cast<int>(ResamplerDefault) ? AL_TRUE : AL_FALSE; break; default: @@ -243,7 +243,7 @@ START_API_FUNC break; case AL_NUM_RESAMPLERS_SOFT: - value = static_cast<ALdouble>(ResamplerMax + 1); + value = static_cast<ALdouble>(Resampler::Max) + 1.0; break; case AL_DEFAULT_RESAMPLER_SOFT: @@ -294,7 +294,7 @@ START_API_FUNC break; case AL_NUM_RESAMPLERS_SOFT: - value = static_cast<ALfloat>(ResamplerMax + 1); + value = static_cast<ALfloat>(Resampler::Max) + 1.0f; break; case AL_DEFAULT_RESAMPLER_SOFT: @@ -345,11 +345,11 @@ START_API_FUNC break; case AL_NUM_RESAMPLERS_SOFT: - value = ResamplerMax + 1; + value = static_cast<int>(Resampler::Max) + 1; break; case AL_DEFAULT_RESAMPLER_SOFT: - value = ResamplerDefault; + value = static_cast<int>(ResamplerDefault); break; default: @@ -396,7 +396,7 @@ START_API_FUNC break; case AL_NUM_RESAMPLERS_SOFT: - value = static_cast<ALint64SOFT>(ResamplerMax + 1); + value = static_cast<ALint64SOFT>(Resampler::Max) + 1; break; case AL_DEFAULT_RESAMPLER_SOFT: @@ -801,7 +801,8 @@ START_API_FUNC alCubicResampler, alBSinc12Resampler, alBSinc24Resampler, }; - static_assert(al::size(ResamplerNames) == ResamplerMax+1, "Incorrect ResamplerNames list"); + static_assert(al::size(ResamplerNames) == static_cast<ALuint>(Resampler::Max)+1, + "Incorrect ResamplerNames list"); ContextRef context{GetContextRef()}; if UNLIKELY(!context) return nullptr; |