diff options
-rw-r--r-- | al/source.cpp | 4 | ||||
-rw-r--r-- | al/state.cpp | 15 | ||||
-rw-r--r-- | alc/alu.cpp | 8 | ||||
-rw-r--r-- | alc/alu.h | 16 | ||||
-rw-r--r-- | alc/backends/coreaudio.cpp | 2 | ||||
-rw-r--r-- | alc/backends/wasapi.cpp | 2 | ||||
-rw-r--r-- | alc/converter.cpp | 4 | ||||
-rw-r--r-- | alc/mixvoice.cpp | 22 |
8 files changed, 37 insertions, 36 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; diff --git a/alc/alu.cpp b/alc/alu.cpp index 606d8fdb..8affbde4 100644 --- a/alc/alu.cpp +++ b/alc/alu.cpp @@ -947,9 +947,9 @@ void CalcNonAttnSourceParams(ALvoice *voice, const ALvoicePropsBase *props, cons voice->mStep = MAX_PITCH<<FRACTIONBITS; else voice->mStep = maxu(fastf2u(Pitch * FRACTIONONE), 1); - if(props->mResampler == BSinc24Resampler) + if(props->mResampler == Resampler::BSinc24) BsincPrepare(voice->mStep, &voice->mResampleState.bsinc, &bsinc24); - else if(props->mResampler == BSinc12Resampler) + else if(props->mResampler == Resampler::BSinc12) BsincPrepare(voice->mStep, &voice->mResampleState.bsinc, &bsinc12); voice->mResampler = SelectResampler(props->mResampler); @@ -1277,9 +1277,9 @@ void CalcAttnSourceParams(ALvoice *voice, const ALvoicePropsBase *props, const A voice->mStep = MAX_PITCH<<FRACTIONBITS; else voice->mStep = maxu(fastf2u(Pitch * FRACTIONONE), 1); - if(props->mResampler == BSinc24Resampler) + if(props->mResampler == Resampler::BSinc24) BsincPrepare(voice->mStep, &voice->mResampleState.bsinc, &bsinc24); - else if(props->mResampler == BSinc12Resampler) + else if(props->mResampler == Resampler::BSinc12) BsincPrepare(voice->mStep, &voice->mResampleState.bsinc, &bsinc12); voice->mResampler = SelectResampler(props->mResampler); @@ -42,14 +42,14 @@ enum SpatializeMode { SpatializeAuto = AL_AUTO_SOFT }; -enum Resampler { - PointResampler, - LinearResampler, - FIR4Resampler, - BSinc12Resampler, - BSinc24Resampler, - - ResamplerMax = BSinc24Resampler +enum class Resampler { + Point, + Linear, + Cubic, + BSinc12, + BSinc24, + + Max = BSinc24 }; extern Resampler ResamplerDefault; diff --git a/alc/backends/coreaudio.cpp b/alc/backends/coreaudio.cpp index 72754718..9e8291e2 100644 --- a/alc/backends/coreaudio.cpp +++ b/alc/backends/coreaudio.cpp @@ -618,7 +618,7 @@ ALCenum CoreAudioCapture::open(const ALCchar *name) if(outputFormat.mSampleRate != mDevice->Frequency) mConverter = CreateSampleConverter(mDevice->FmtType, mDevice->FmtType, mFormat.mChannelsPerFrame, static_cast<ALuint>(hardwareFormat.mSampleRate), - mDevice->Frequency, BSinc24Resampler); + mDevice->Frequency, Resampler::BSinc24); mRing = CreateRingBuffer(outputFrameCount, mFrameSize, false); if(!mRing) return ALC_INVALID_VALUE; diff --git a/alc/backends/wasapi.cpp b/alc/backends/wasapi.cpp index 1271eeaa..e1a8dc6f 100644 --- a/alc/backends/wasapi.cpp +++ b/alc/backends/wasapi.cpp @@ -1568,7 +1568,7 @@ HRESULT WasapiCapture::resetProxy() if(mDevice->Frequency != OutputType.Format.nSamplesPerSec || mDevice->FmtType != srcType) { mSampleConv = CreateSampleConverter(srcType, mDevice->FmtType, mDevice->channelsFromFmt(), - OutputType.Format.nSamplesPerSec, mDevice->Frequency, BSinc24Resampler); + OutputType.Format.nSamplesPerSec, mDevice->Frequency, Resampler::BSinc24); if(!mSampleConv) { ERR("Failed to create converter for %s format, dst: %s %uhz, src: %s %luhz\n", diff --git a/alc/converter.cpp b/alc/converter.cpp index 2ad2ac3b..6622a997 100644 --- a/alc/converter.cpp +++ b/alc/converter.cpp @@ -167,9 +167,9 @@ SampleConverterPtr CreateSampleConverter(DevFmtType srcType, DevFmtType dstType, converter->mResample = Resample_<CopyTag,CTag>; else { - if(resampler == BSinc24Resampler) + if(resampler == Resampler::BSinc24) BsincPrepare(converter->mIncrement, &converter->mState.bsinc, &bsinc24); - else if(resampler == BSinc12Resampler) + else if(resampler == Resampler::BSinc12) BsincPrepare(converter->mIncrement, &converter->mState.bsinc, &bsinc12); converter->mResample = SelectResampler(resampler); } diff --git a/alc/mixvoice.cpp b/alc/mixvoice.cpp index bf10444a..99e4dc48 100644 --- a/alc/mixvoice.cpp +++ b/alc/mixvoice.cpp @@ -70,7 +70,7 @@ static_assert((INT_MAX>>FRACTIONBITS)/MAX_PITCH > BUFFERSIZE, static_assert(MAX_RESAMPLE_PADDING >= 24, "MAX_RESAMPLE_PADDING must be at least 24!"); -Resampler ResamplerDefault = LinearResampler; +Resampler ResamplerDefault{Resampler::Linear}; MixerFunc MixSamples = Mix_<CTag>; RowMixerFunc MixRowSamples = MixRow_<CTag>; @@ -139,9 +139,9 @@ ResamplerFunc SelectResampler(Resampler resampler) { switch(resampler) { - case PointResampler: + case Resampler::Point: return Resample_<PointTag,CTag>; - case LinearResampler: + case Resampler::Linear: #ifdef HAVE_NEON if((CPUCapFlags&CPU_CAP_NEON)) return Resample_<LerpTag,NEONTag>; @@ -155,10 +155,10 @@ ResamplerFunc SelectResampler(Resampler resampler) return Resample_<LerpTag,SSE2Tag>; #endif return Resample_<LerpTag,CTag>; - case FIR4Resampler: + case Resampler::Cubic: return Resample_<CubicTag,CTag>; - case BSinc12Resampler: - case BSinc24Resampler: + case Resampler::BSinc12: + case Resampler::BSinc24: #ifdef HAVE_NEON if((CPUCapFlags&CPU_CAP_NEON)) return Resample_<BSincTag,NEONTag>; @@ -183,11 +183,11 @@ void aluInitMixer() const Resampler resampler; }; constexpr ResamplerEntry ResamplerList[]{ - { "none", PointResampler }, - { "point", PointResampler }, - { "cubic", FIR4Resampler }, - { "bsinc12", BSinc12Resampler }, - { "bsinc24", BSinc24Resampler }, + { "none", Resampler::Point }, + { "point", Resampler::Point }, + { "cubic", Resampler::Cubic }, + { "bsinc12", Resampler::BSinc12 }, + { "bsinc24", Resampler::BSinc24 }, }; const char *str{resopt->c_str()}; |