SDL_AudioDeviceEvent(3type)

πŸ’– SDL_AudioDeviceEvent πŸ’–

okay bestie, welcome to the SDL_AudioDeviceEvent page from the SDL3 DATATYPES era of the SDL3 manual β€” this is the one that tells you when audio devices show up, dip out, or switch up their whole format. 🎧✨


✨ NAME ✨

SDL_AudioDeviceEvent β€” the audio device event structure, aka all the event.adevice.* goodness 🫢


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_events.h>

typedef struct SDL_AudioDeviceEvent
{
    SDL_EventType type; /**< SDL_EVENT_AUDIO_DEVICE_ADDED, or SDL_EVENT_AUDIO_DEVICE_REMOVED, or SDL_EVENT_AUDIO_DEVICE_FORMAT_CHANGED */
    Uint32 reserved;
    Uint64 timestamp;   /**< In nanoseconds, populated using SDL_GetTicksNS() */
    SDL_AudioDeviceID which;       /**< SDL_AudioDeviceID for the device being added or removed or changing */
    bool recording; /**< false if a playback device, true if a recording device. */
    Uint8 padding1;
    Uint8 padding2;
    Uint8 padding3;
} SDL_AudioDeviceEvent;

πŸŽ€ DESCRIPTION πŸŽ€

so like. the tea is that SDL is gonna hit you with a SDL_EVENT_AUDIO_DEVICE_ADDED event for every single device it discovers during initialization. every one. no skipping. πŸ’…

and after that? that's it, that's the whole hotplug situation β€” this event only rolls up again when a device gets hotplugged while your program is actually running. main character device energy only. πŸ‘‘


πŸ’œ AVAILABILITY πŸ’œ

this struct has been around since SDL 3.2.0. iconic behavior, fr fr. 🌈


that's the whole page, bestie β€” go forth and handle those device events. mwah πŸ’‹

this has been Simple Directmedia Layer's SDL 3.4.18, SDL_AudioDeviceEvent(3type), signing off πŸŽ€βœ¨ bye babes πŸ¦‹

πŸ“¦ where this page comes from