From 81a65ce67fd975fc352db36c278ca36a07dc43b1 Mon Sep 17 00:00:00 2001 From: David Reid Date: Wed, 18 Sep 2019 17:47:46 +1000 Subject: [PATCH] WASAPI: Disable auto-SRC when requesting default sample rate. --- miniaudio.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/miniaudio.h b/miniaudio.h index a9e846df..43166911 100644 --- a/miniaudio.h +++ b/miniaudio.h @@ -7953,8 +7953,13 @@ ma_result ma_device_init_internal__wasapi(ma_context* pContext, ma_device_type d goto done; } - /* Override the native sample rate with the one requested by the caller. We'll use WASAPI to perform the sample rate conversion. */ - wf.Format.nSamplesPerSec = pData->sampleRateIn; + /* + Override the native sample rate with the one requested by the caller, but only if we're not using the default sample rate. We'll use + WASAPI to perform the sample rate conversion. + */ + if (!pData->usingDefaultSampleRate) { + wf.Format.nSamplesPerSec = pData->sampleRateIn; + } pData->formatOut = ma_format_from_WAVEFORMATEX((WAVEFORMATEX*)&wf); pData->channelsOut = wf.Format.nChannels;