From f3381a7f63ee50dad9ffdd4979deb11bf3a523e6 Mon Sep 17 00:00:00 2001 From: Won-Kyu Park Date: Mon, 26 Jul 2021 17:09:07 +0900 Subject: [PATCH] try to setup desired sampleRate --- source/device.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/source/device.cpp b/source/device.cpp index 84c9eb3..4d9155c 100644 --- a/source/device.cpp +++ b/source/device.cpp @@ -468,6 +468,15 @@ bool HDevice::SetupAudioCapture(IBaseFilter *filter, AudioConfig &config) Error(L"Could not get closest audio media type"); return false; } + } else { + // useDefaultConfig case + if (config.sampleRate != 0) { + WAVEFORMATEX *wfex = reinterpret_cast( + audioMediaType->pbFormat); + // set the desired sampleRate + wfex->nSamplesPerSec = config.sampleRate; + Debug(L"\tdesired sampleRate = %d", config.sampleRate); + } } if (!!pinConfig) {