Skip to content

WASAPICapture Initializes the client in a manner that disregards the rules in the API docs #1422

@aconverse

Description

@aconverse

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

hr = m_AudioClient->Initialize(AUDCLNT_SHAREMODE_SHARED,
AUDCLNT_STREAMFLAGS_EVENTCALLBACK,
200000,
0,
m_MixFormat,
nullptr);
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions