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 be NULL, 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