SDL_GetAudioStreamAvailable(3)
β¨ SDL_GetAudioStreamAvailable β¨
okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual π
this one's called SDL_GetAudioStreamAvailable and it's literally just "how many bytes do I have ready tho"
πΈ NAME πΈ
SDL_GetAudioStreamAvailable β get the number of converted/resampled bytes available π
π SYNOPSIS π
#include <SDL3/SDL_audio.h>
int SDL_GetAudioStreamAvailable(SDL_AudioStream *stream);
π¦ DESCRIPTION π¦
okay so here's the tea: the stream might be buffering data behind the scenes until it has enough to resample correctly π so the number you get back might be lower than what you expect, or honestly it could even be zero. not a bug, it's just the vibe. if you need the data now, add more data or flush the stream, periodt β¨
and listen β if the stream has SO much data that it would overflow an int, the return value gets clamped to a maximum value. but no cap, no queued data is lost π«Ά so if there are gigabytes of data queued, your app might need to read some of it with SDL_GetAudioStreamData before this function's return value stops being clamped. it's giving "the number is lying to you but only because C is like that" π
π FUNCTION PARAMETERS π
streamβ the audio stream to query π§
β RETURN VALUE β
Returns the number of converted/resampled bytes available, or -1 on failure π call SDL_GetError() for more info bestie, she'll tell you what went wrong π
π THREAD SAFETY π
It is safe to call this function from any thread π§ no notes, iconic behaviour, slay π
π AVAILABILITY π
This function is available since SDL 3.2.0 β
π₯ SEE ALSO π₯
Simple Directmedia Layer β version SDL 3.4.18 π mwah, that's the whole page, go forth and check your stream bytes bestie, you got this ππ¦β¨
π¦ 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