Skip to content

Commit

Permalink
try to setup desired sampleRate
Browse files Browse the repository at this point in the history
  • Loading branch information
wkpark committed Aug 12, 2021
1 parent 0d42110 commit 38c83fc
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions source/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,16 @@ 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<WAVEFORMATEX *>(
audioMediaType->pbFormat);
// set the desired sampleRate
wfex->nSamplesPerSec = config.sampleRate;
Debug(L"\tdesired sampleRate = %d", config.sampleRate);
wfex->nAvgBytesPerSec = wfex->nSamplesPerSec * wfex->nBlockAlign;
}
}

if (!!pinConfig) {
Expand Down

0 comments on commit 38c83fc

Please sign in to comment.