SDL_GetNumAudioDrivers(3)

πŸ’– SDL_GetNumAudioDrivers πŸ’–

okay bestie, so this is a page from the SDL3 FUNCTIONS manual set β€” like, the SDL_GetNumAudioDrivers(3) girlies. sit down, grab a boba, we're gonna count some audio drivers together πŸŽ€


✨ NAME ✨

SDL_GetNumAudioDrivers β€” use this function to get the number of built-in audio drivers, no cap 🎧


✨ SYNOPSIS ✨

#include <SDL3/SDL_audio.h>

int SDL_GetNumAudioDrivers(void);

✨ DESCRIPTION ✨

so like, this function returns a hardcoded number. it's not out here doing detective work, it just knows. 🫢

and listen β€” it never returns a negative value. never ever. if there are literally no drivers compiled into this build of SDL, it just returns zero and we move on. πŸ’…

now here's the important part, bestie, don't skip this: the presence of a driver in this list does not mean it will function. it just means SDL is capable of interacting with that interface. it's giving "we could, theoretically" energy, not "we definitely will" energy. πŸ™ˆ

for example, a build of SDL might have esound support, but if there's no esound server available, SDL's esound driver would fail if used. see? listed β‰  working. iconic but also a little humbling ✨

by default, SDL tries all drivers, in its preferred order, until one is found to be usable. it's literally going down the list like "you? no? ok next. you? ok slay, you're hired." 🌸

✨ RETURN VALUE ✨

returns the number of built-in audio drivers. that's it, that's the tea. ⭐


✨ THREAD SAFETY ✨

it is safe to call this function from any thread. every thread gets to ask. no fighting, no drama. 🧚


✨ AVAILABILITY ✨

this function is available since SDL 3.2.0. so if you're on anything older, sorry babe, not for you. 😭


✨ SEE ALSO ✨


ok that's the whole page, you ate that, go write some audio code πŸ’œ

this has been a Simple Directmedia Layer production, brought to you by SDL 3.4.18 β€” mwah, kisses, see you in the next manpage bestie πŸŽ€πŸ’–βœ¨

πŸ“¦ where this page comes from