diff options
-rw-r--r-- | alc/backends/coreaudio.cpp | 2 | ||||
-rw-r--r-- | alc/backends/wasapi.cpp | 7 | ||||
-rw-r--r-- | core/converter.cpp | 2 | ||||
-rw-r--r-- | core/converter.h | 7 |
4 files changed, 9 insertions, 9 deletions
diff --git a/alc/backends/coreaudio.cpp b/alc/backends/coreaudio.cpp index d6392271..8b0e75fd 100644 --- a/alc/backends/coreaudio.cpp +++ b/alc/backends/coreaudio.cpp @@ -805,7 +805,7 @@ void CoreAudioCapture::open(const char *name) /* Set up sample converter if needed */ if(outputFormat.mSampleRate != mDevice->Frequency) - mConverter = CreateSampleConverter(mDevice->FmtType, mDevice->FmtType, + mConverter = SampleConverter::Create(mDevice->FmtType, mDevice->FmtType, mFormat.mChannelsPerFrame, static_cast<uint>(hardwareFormat.mSampleRate), mDevice->Frequency, Resampler::FastBSinc24); diff --git a/alc/backends/wasapi.cpp b/alc/backends/wasapi.cpp index 6bbc4439..504313b4 100644 --- a/alc/backends/wasapi.cpp +++ b/alc/backends/wasapi.cpp @@ -1200,7 +1200,7 @@ HRESULT WasapiPlayback::resetProxy() mBufferFilled = 0; if(mDevice->Frequency != mFormat.Format.nSamplesPerSec) { - mResampler = CreateSampleConverter(mDevice->FmtType, mDevice->FmtType, + mResampler = SampleConverter::Create(mDevice->FmtType, mDevice->FmtType, mFormat.Format.nChannels, mDevice->Frequency, mFormat.Format.nSamplesPerSec, Resampler::FastBSinc24); mResampleBuffer = std::make_unique<char[]>(size_t{mDevice->UpdateSize} * @@ -1769,8 +1769,9 @@ HRESULT WasapiCapture::resetProxy() if(mDevice->Frequency != InputType.Format.nSamplesPerSec || mDevice->FmtType != srcType) { - mSampleConv = CreateSampleConverter(srcType, mDevice->FmtType, mDevice->channelsFromFmt(), - InputType.Format.nSamplesPerSec, mDevice->Frequency, Resampler::FastBSinc24); + mSampleConv = SampleConverter::Create(srcType, mDevice->FmtType, + mDevice->channelsFromFmt(), InputType.Format.nSamplesPerSec, mDevice->Frequency, + Resampler::FastBSinc24); if(!mSampleConv) { ERR("Failed to create converter for %s format, dst: %s %uhz, src: %s %luhz\n", diff --git a/core/converter.cpp b/core/converter.cpp index 69e0d8dd..75c37149 100644 --- a/core/converter.cpp +++ b/core/converter.cpp @@ -156,7 +156,7 @@ void Multi2Mono(uint chanmask, const size_t step, const float scale, float *REST } // namespace -SampleConverterPtr CreateSampleConverter(DevFmtType srcType, DevFmtType dstType, size_t numchans, +SampleConverterPtr SampleConverter::Create(DevFmtType srcType, DevFmtType dstType, size_t numchans, uint srcRate, uint dstRate, Resampler resampler) { if(numchans < 1 || srcRate < 1 || dstRate < 1) diff --git a/core/converter.h b/core/converter.h index d3a4da08..b6ff3ba5 100644 --- a/core/converter.h +++ b/core/converter.h @@ -45,14 +45,13 @@ struct SampleConverter { return SampleOffset{(prep<<MixerFracBits) + mFracOffset}; } + static std::unique_ptr<SampleConverter> Create(DevFmtType srcType, DevFmtType dstType, + size_t numchans, uint srcRate, uint dstRate, Resampler resampler); + DEF_FAM_NEWDEL(SampleConverter, mChan) }; using SampleConverterPtr = std::unique_ptr<SampleConverter>; -SampleConverterPtr CreateSampleConverter(DevFmtType srcType, DevFmtType dstType, size_t numchans, - uint srcRate, uint dstRate, Resampler resampler); - - struct ChannelConverter { DevFmtType mSrcType{}; uint mSrcStep{}; |