A callback that fires around an audio device's processing work.
Defined in <SDL3/SDL_audio.h>
typedef void (SDLCALL *SDL_AudioIterationCallback)(void *userdata, SDL_AudioDeviceID devid, bool start);
userdata | a pointer provided by the app through SDL_SetAudioPostmixCallback, for its own use. |
devid | the audio device this callback is running for. |
start | true if this is the start of the iteration, false if the end. |
This callback fires when a logical audio device is about to start accessing its bound audio streams, and fires again when it has finished accessing them. It covers the range of one "iteration" of the audio device.
It can be useful to use this callback to update state that must apply to all bound audio streams atomically: to make sure state changes don't happen while half of the streams are already processed for the latest audio buffer.
This callback should run as quickly as possible and not block for any significant time, as this callback delays submission of data to the audio device, which can cause audio playback problems. This callback delays all audio processing across a single physical audio device: all its logical devices and all bound audio streams. Use it carefully.
This will run from a background thread owned by SDL. The application is responsible for locking resources the callback touches that need to be protected.
This datatype is available since SDL 3.4.0.