audio_wasapi.h
Windows audio output (WASAPI, shared mode, event driven).
#include <sonore/audio_wasapi.h>- 1type
- Guides: Platforms and formats
On this page
Design notes
Output only, deliberately: the standalone exists to AUDITION a plugin, and shared-mode render is the path that works on every Windows box without touching exclusive mode, sample-rate negotiation, or capture privacy prompts. An effect gets its input from the standalone's internal source (or a WAV, once the user drops one); live microphone input is a later feature, not a missing piece of this one.
Shared mode means the DEVICE picks the sample rate (the mix rate) and we prepare the DSP at that rate: resampling to fight the mixer would add latency and code for zero fidelity gain.
Types 1
One output device in WASAPI shared mode: the standalone's speakers on Windows. See the file comment for why it is shared mode and output only.
Three steps, all from the MAIN thread: open() picks the device (setDeviceIndex first; 0 is the system default) and learns the rate and channel count of its mix, which the device chooses; the caller prepares its DSP at sampleRate(); run() starts a render thread of its own, which calls the RenderFn with interleaved 32-bit float in as many channels as the mix has -- not always two. stop() and the destructor join that thread and release everything, on the thread that called open(), whose COM initialisation they balance.
A device that goes away ends the render thread and sets takeDeviceLost(); the owner polls it and opens again, since nothing reopens itself.