SDL_GetAudioRecordingDevices(3)
π SDL_GetAudioRecordingDevices π
okay bestie, welcome to the SDL3 functions corner of the manual, this one's all about SDL_GetAudioRecordingDevices and it's literally the glow-up your mic setup has been waiting for β¨
πΈ NAME πΈ
SDL_GetAudioRecordingDevices β get a list of currently-connected audio recording devices. yes, ALL of them. the whole roster. π
π SYNOPSIS π
#include <SDL3/SDL_audio.h>
SDL_AudioDeviceID * SDL_GetAudioRecordingDevices(int *count);
π¦ DESCRIPTION π¦
so here's the tea: this function hands you a list of every available device that records audio β think microphones, headsets, that one USB thing you bought at 2am, all of them. in SDL-speak these are called "recording" devices π€
if what you actually want is the stuff that plays sound β speakers, headphones, the vibe-makers β then you want SDL_GetAudioPlaybackDevices() instead. different function, different list, don't mix them up bestie π
also important, no cap: this only returns a list of physical devices. it will not include any of the device IDs that came out of SDL_OpenAudioDevice(). those are yours, not the system's, iykyk.
and if this function returns NULL, which is how it signals an error, then *count will be set to zero. zero. nada. the vibe check failed π
β¨ FUNCTION PARAMETERS β¨
countβ a pointer that gets filled in with the number of devices returned. it may beNULL, so if you truly don't care how many there are, you can just... not ask π«Ά
π RETURN VALUE π
returns a 0 terminated array of device instance IDs, or NULL on failure. if it's NULL you should call SDL_GetError() for more info β that's where the actual explanation lives.
and listen, this is the part everyone forgets: when you're done with it, free it with SDL_free(). it is not going to clean itself up. main character energy does not extend to memory management π
π THREAD SAFETY π
it is safe to call this function from any thread. go off, multithreaded queen π
β AVAILABILITY β
this function is available since SDL 3.2.0. so if you're on something older... no it isn't, babe π
π SEE ALSO π
and that's the whole page!! brought to you by Simple Directmedia Layer, running SDL 3.4.18 β mwah, free the array, call SDL_GetError(), and stay iconic π§π
π¦ 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