WASAPICapture Initializes the client in a manner that disregards the rules in the API docs
Which sample are you reporting a bug in?
Example: WASAPICapture
Describe the bug
The WASAPICapture seems to Initialize the client in a way that's forbidden according to the API documentation.
At https://github.com/microsoft/Windows-universal-samples/blob/0db108e9d0af7386767194b3293c4082c1c8daa7/Samples/WindowsAudioSession/cpp/WASAPICapture.cpp#L230-L235 The sample calls IAudioClient::Initialize with on a shared mode (AUDCLNT_SHAREMODE_SHARED), event driven (AUDCLNT_STREAMFLAGS_EVENTCALLBACK) stream with an hnsBufferDuration of 200000 (20 ms)
But the API documentation at https://learn.microsoft.com/en-us/windows/win32/api/audioclient/nf-audioclient-iaudioclient-initialize clearly states:
"For a shared-mode stream that uses event-driven buffering, the caller must set both hnsPeriodicity and hnsBufferDuration to 0."
But in the above call hnsBufferDuration is demonstrably non-zero.
To Reproduce Steps to reproduce the behavior: N/A Docs mismatch
Expected behavior I expect the sample to conform the the rules for calling the API.
Screenshots If applicable, add screenshots to help explain your problem.
Configuration
- Language/architecture/flavor: example: C++ x64 Debug
- Windows platform and build number: 22631.4037
- Visual Studio version: 17.11.2
Additional context N/A
Source: microsoft/Windows-universal-samples