SDL_GetAudioPlaybackDevices(3)
π SDL_GetAudioPlaybackDevices π
okay bestie, welcome to the SDL_GetAudioPlaybackDevices page of the SDL3 FUNCTIONS manual π
this one's a lil bop, let's get into it β¨
πΈ NAME πΈ
SDL_GetAudioPlaybackDevices β get a list of currently-connected audio playback devices π§
π¦ SYNOPSIS π¦
#include <SDL3/SDL_audio.h>
SDL_AudioDeviceID * SDL_GetAudioPlaybackDevices(int *count);
β¨ DESCRIPTION β¨
So like, this hands you back a whole list of the devices that play sound β think your speakers, your headphones, all the lil guys that make noise at you πΆ these are what we call "playback" devices.
Now if what you actually want is the devices that record audio β like a microphone, bestie, the ones that listen β then you want SDL_GetAudioRecordingDevices() instead, no cap π€
heads up: this only gives you the list of physical devices. it will not have any device IDs returned by SDL_OpenAudioDevice(). so don't go looking for those in here π
And if this function returns NULL, which is its way of saying "oop, error", then *count gets set to zero. periodt.
π FUNCTION PARAMETERS π
countβ a pointer that gets filled in with the number of devices returned. it may beNULL, so like, no pressure if you don't care about the count π«Ά
π RETURN VALUE π
Returns a 0 terminated array of device instance IDs, or NULL on error π if you got an error, call SDL_GetError() for the tea.
And listen β this thing should be freed with SDL_free() when you're done with it. don't be leaving it lying around, it's giving clutter π§Ή
π₯ THREAD SAFETY π₯
It is safe to call this function from any thread. literally any of them, go off π
β AVAILABILITY β
This function is available since SDL 3.2.0. so if you're on something older... bestie. upgrade π
π SEE ALSO π
and that's the whole page, you ate that fr fr π this was Simple Directmedia Layer, version SDL 3.4.18 β mwah, tysm for reading, see you in the next manpage πΈπ¦β¨
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms