Commit 1d04f03a authored by David Reid's avatar David Reid

WASAPI: Get WASAPI to perform automatic resampling.

parent 4ad67a66
...@@ -7862,7 +7862,7 @@ ma_result ma_device_init_internal__wasapi(ma_context* pContext, ma_device_type d ...@@ -7862,7 +7862,7 @@ ma_result ma_device_init_internal__wasapi(ma_context* pContext, ma_device_type d
pData->pRenderClient = NULL; pData->pRenderClient = NULL;
pData->pCaptureClient = NULL; pData->pCaptureClient = NULL;
streamFlags = MA_AUDCLNT_STREAMFLAGS_EVENTCALLBACK; streamFlags = MA_AUDCLNT_STREAMFLAGS_EVENTCALLBACK | MA_AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM | MA_AUDCLNT_STREAMFLAGS_SRC_DEFAULT_QUALITY;
if (deviceType == ma_device_type_loopback) { if (deviceType == ma_device_type_loopback) {
streamFlags |= MA_AUDCLNT_STREAMFLAGS_LOOPBACK; streamFlags |= MA_AUDCLNT_STREAMFLAGS_LOOPBACK;
} }
...@@ -7953,6 +7953,9 @@ ma_result ma_device_init_internal__wasapi(ma_context* pContext, ma_device_type d ...@@ -7953,6 +7953,9 @@ ma_result ma_device_init_internal__wasapi(ma_context* pContext, ma_device_type d
goto done; 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;
pData->formatOut = ma_format_from_WAVEFORMATEX((WAVEFORMATEX*)&wf); pData->formatOut = ma_format_from_WAVEFORMATEX((WAVEFORMATEX*)&wf);
pData->channelsOut = wf.Format.nChannels; pData->channelsOut = wf.Format.nChannels;
pData->sampleRateOut = wf.Format.nSamplesPerSec; pData->sampleRateOut = wf.Format.nSamplesPerSec;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment