SDL_GetAudioDriver(3)

πŸ’– SDL_GetAudioDriver πŸ’–

okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, this one's SDL_GetAudioDriver(3) and it's literally the lil cutie that tells you the name of a built in audio driver. like, "Use this function to get the name of a built in audio driver." that's the whole vibe. 🎧✨


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_audio.h>

const char * SDL_GetAudioDriver(int index);

πŸ¦‹ DESCRIPTION πŸ¦‹

so the list of audio drivers? it's given in the order that they're normally initialized by default. meaning the drivers that seem more reasonable to choose first β€” as far as the SDL developers believe, anyway β€” are chilling earlier in the list. it's giving priority order, no cap. πŸ‘‘

and the names of drivers are all simple, low-ASCII identifiers, like "alsa", "coreaudio" or "wasapi". these never have Unicode characters in them, and they are not meant to be proper names. so don't go calling them "Alsa" with a capital A and a lil bow, they're not that kind of girl. πŸ™ˆ


πŸ’… FUNCTION PARAMETERS πŸ’…

  • index β€” the index of the audio driver; the value ranges from 0 to SDL_GetNumAudioDrivers() - 1. yes bestie, that SDL_GetNumAudioDrivers(), the one in SEE ALSO, they're a package deal fr fr. 🫢

✨ RETURN VALUE ✨

Returns the name of the audio driver at the requested index, or NULL if an invalid index was specified. so like, if you hand it a nonsense index, it just hands you back NULL. iconic behaviour honestly, no drama. πŸ’€


🧚 THREAD SAFETY 🧚

It is safe to call this function from any thread. go wild, queen, every thread gets a turn. 🌈


⭐ AVAILABILITY ⭐

This function is available since SDL 3.2.0.


πŸŽ€ SEE ALSO πŸŽ€


lowkey important: that index value must stay in the range 0 to SDL_GetNumAudioDrivers() - 1. step outside and you get NULL, not a cute surprise. πŸ’–

okay that's the whole page!! brought to you by Simple Directmedia Layer, running SDL 3.4.18, and it's the SDL_GetAudioDriver(3) manual page β€” mwah, slay, go read your drivers' names responsibly bestie πŸ’…πŸŒΈπŸ¦‹

πŸ“¦ where this page comes from