From df6761d4244c89fefec2a500c1bd4dd339a3ac0b Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 13 Nov 2022 14:37:25 -0800 Subject: Use the correct frame size for WASAPI resampling --- alc/backends/wasapi.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'alc/backends/wasapi.cpp') diff --git a/alc/backends/wasapi.cpp b/alc/backends/wasapi.cpp index 504313b4..1ce064e8 100644 --- a/alc/backends/wasapi.cpp +++ b/alc/backends/wasapi.cpp @@ -698,7 +698,7 @@ FORCE_ALIGN int WasapiPlayback::mixerProc() SetRTPriority(); althrd_setname(MIXER_THREAD_NAME); - const uint frame_size{mDevice->frameSizeFromFmt()}; + const uint frame_size{mFormat.Format.nChannels * mFormat.Format.wBitsPerSample / 8u}; const uint update_size{mOrigUpdateSize}; const UINT32 buffer_len{mOrigBufferSize}; while(!mKillNow.load(std::memory_order_relaxed)) @@ -1204,7 +1204,7 @@ HRESULT WasapiPlayback::resetProxy() mFormat.Format.nChannels, mDevice->Frequency, mFormat.Format.nSamplesPerSec, Resampler::FastBSinc24); mResampleBuffer = std::make_unique(size_t{mDevice->UpdateSize} * - mDevice->frameSizeFromFmt()); + mFormat.Format.nChannels * mFormat.Format.wBitsPerSample / 8); TRACE("Created converter for %s/%s format, dst: %luhz (%u), src: %uhz (%u)\n", DevFmtChannelsString(mDevice->FmtChans), DevFmtTypeString(mDevice->FmtType), -- cgit v1.2.3