Documentation
¶
Overview ¶
Package wasapi is the WASAPI backend of the audio service on Windows (SPEC §28.3, step 31.6): playback and capture of float32 frames through the shared mode of the Windows audio engine, driven by events, with the list of devices and the default device from the device enumerator and its notification client (a COM object that Go makes, SPEC §25.2). Every COM call is made on a thread of its own that is in the multithreaded apartment: one thread for the enumerator, and one for each open device. The design follows the WASAPI driver of SDL 3 (src/audio/wasapi/SDL_wasapi.c; zlib license, third_party/sdl/LICENSE), translated to Go and changed: each device has a thread of its own that does everything for it (SDL proxies to a management thread), the stream is made again on the new default device when the default changes, and IAudioClient3 is asked for the period the app wants.
This file and the files without an operating system in their name are plain Go (the choice of the format, the channel masks, the arithmetic of the buffers) and are tested on any host; the calls into Windows are in the files that end in _windows.go.
Flutter: no counterpart