aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-11-28 23:19:25 -0800
committerChris Robinson <[email protected]>2018-11-28 23:19:25 -0800
commit57bb4670727c3c26644933b19d4620d565a177e2 (patch)
tree1e9b5c1fc185634b31704ef44208524b94b8c975
parente017d9e40f4ce1698d31adc2d2a6ac4f13159a39 (diff)
Pass the desired resampler to CreateSampleConverter
-rw-r--r--Alc/backends/wasapi.cpp2
-rw-r--r--Alc/converter.cpp12
-rw-r--r--Alc/converter.h4
3 files changed, 12 insertions, 6 deletions
diff --git a/Alc/backends/wasapi.cpp b/Alc/backends/wasapi.cpp
index dfc91489..04afe807 100644
--- a/Alc/backends/wasapi.cpp
+++ b/Alc/backends/wasapi.cpp
@@ -1666,7 +1666,7 @@ HRESULT ALCwasapiCapture::resetProxy()
{
mSampleConv = CreateSampleConverter(
srcType, device->FmtType, ChannelsFromDevFmt(device->FmtChans, device->mAmbiOrder),
- OutputType.Format.nSamplesPerSec, device->Frequency
+ OutputType.Format.nSamplesPerSec, device->Frequency, BSinc24Resampler
);
if(!mSampleConv)
{
diff --git a/Alc/converter.cpp b/Alc/converter.cpp
index d16d2cb7..958936a1 100644
--- a/Alc/converter.cpp
+++ b/Alc/converter.cpp
@@ -136,7 +136,9 @@ void Stereo2Mono(ALfloat *RESTRICT dst, const void *src, ALsizei frames)
} // namespace
-SampleConverter *CreateSampleConverter(enum DevFmtType srcType, enum DevFmtType dstType, ALsizei numchans, ALsizei srcRate, ALsizei dstRate)
+SampleConverter *CreateSampleConverter(enum DevFmtType srcType, enum DevFmtType dstType,
+ ALsizei numchans, ALsizei srcRate, ALsizei dstRate,
+ Resampler resampler)
{
if(numchans <= 0 || srcRate <= 0 || dstRate <= 0)
return nullptr;
@@ -161,9 +163,11 @@ SampleConverter *CreateSampleConverter(enum DevFmtType srcType, enum DevFmtType
converter->mResample = Resample_copy_C;
else
{
- /* TODO: Allow other resamplers. */
- BsincPrepare(converter->mIncrement, &converter->mState.bsinc, &bsinc12);
- converter->mResample = SelectResampler(BSinc12Resampler);
+ if(resampler == BSinc24Resampler)
+ BsincPrepare(converter->mIncrement, &converter->mState.bsinc, &bsinc24);
+ else if(resampler == BSinc12Resampler)
+ BsincPrepare(converter->mIncrement, &converter->mState.bsinc, &bsinc12);
+ converter->mResample = SelectResampler(resampler);
}
return converter;
diff --git a/Alc/converter.h b/Alc/converter.h
index 326c8033..e0aeb7d4 100644
--- a/Alc/converter.h
+++ b/Alc/converter.h
@@ -29,7 +29,9 @@ struct SampleConverter {
DEF_PLACE_NEWDEL()
};
-SampleConverter *CreateSampleConverter(enum DevFmtType srcType, enum DevFmtType dstType, ALsizei numchans, ALsizei srcRate, ALsizei dstRate);
+SampleConverter *CreateSampleConverter(enum DevFmtType srcType, enum DevFmtType dstType,
+ ALsizei numchans, ALsizei srcRate, ALsizei dstRate,
+ Resampler resampler);
void DestroySampleConverter(SampleConverter **converter);
ALsizei SampleConverterInput(SampleConverter *converter, const ALvoid **src, ALsizei *srcframes, ALvoid *dst, ALsizei dstframes);