aboutsummaryrefslogtreecommitdiffstats
path: root/alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-09-22 21:19:19 -0700
committerChris Robinson <[email protected]>2019-09-22 21:19:19 -0700
commit24db8a3f4bdbd787c23ac6e2ec78c2bafed81f1f (patch)
treebd55bdfda7874eb56eb444fb888e896895057d63 /alc
parent95996effaf04c87b7091c904e6545bc1e5e25aee (diff)
Make the resampler type an enum class
Diffstat (limited to 'alc')
-rw-r--r--alc/alu.cpp8
-rw-r--r--alc/alu.h16
-rw-r--r--alc/backends/coreaudio.cpp2
-rw-r--r--alc/backends/wasapi.cpp2
-rw-r--r--alc/converter.cpp4
-rw-r--r--alc/mixvoice.cpp22
6 files changed, 27 insertions, 27 deletions
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);
diff --git a/alc/alu.h b/alc/alu.h
index 33c67630..aa698f7d 100644
--- a/alc/alu.h
+++ b/alc/alu.h
@@ -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()};