SDL_GetAudioStreamFormat(3)
β¨ NAME β¨
SDL_GetAudioStreamFormat β bestie, this is the lil function that lets you peek at the current format of an audio stream. Like, "hey stream, what ARE you right now?" π
(also hi, this is a page from the SDL3 FUNCTIONS manual, iykyk π)
π SYNOPSIS π
okay so first you gotta bring in the header:
#include <SDL3/SDL_audio.h>
and then the function itself, no cap:
bool SDL_GetAudioStreamFormat(SDL_AudioStream *stream, SDL_AudioSpec *src_spec, SDL_AudioSpec *dst_spec);
π¦ FUNCTION PARAMETERS π¦
streamβ theSDL_AudioStreamyou wanna interrogate. the main character of this whole operation πsrc_specβ where you want the input audio format stored. if it'sNULL, it's just ignored β no drama, no error, it simply does not care πdst_specβ where you want the output audio format stored. same deal:NULLmeans ignored, bye bye π
β RETURN VALUE β
- returns
truewhen it slays (success) β - returns
falsewhen it does NOT slay (failure) π
and if it fails? call SDL_GetError() for more info, that's your group chat receipts fr fr π
π§ THREAD SAFETY π§
good news bestie: it is safe to call this function from any thread. the way it does that is by holding a stream-specific mutex while it runs, so nobody's stepping on anybody's toes. iconic behavior honestly π«Ά
πΈ AVAILABILITY πΈ
this function has been available since SDL 3.2.0. so if you're on something olderβ¦ babe. update. π
π SEE ALSO π
SDL_SetAudioStreamFormat(3)β the one that actually changes the format, if peeking isn't enough for you π
ok that's the whole page, you ate that, periodt β¨ go format some audio bestie π§π
kisses from the Simple Directmedia Layer girlies β this was the SDL 3.4.18 era, and yes this page is literally titled SDL_GetAudioStreamFormat(3) again at the bottom like a lil signature π byeeeee π
π¦ 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