SDL_GetAudioStreamQueued(3)
π SDL_GetAudioStreamQueued π
okay bestie, so you know how the SDL3 functions manual is a whole thing? this is one of its pages, and it's genuinely such a useful little guy. it lives in the SDL3 functions section, and its whole job is telling you how many bytes are sitting in the queue right now. that's it. that's the vibe. π
β¨ NAME β¨
SDL_GetAudioStreamQueued β get the number of bytes currently queued. literally the whole plot. no cap. π¦
β¨ SYNOPSIS β¨
#include <SDL3/SDL_audio.h>
int SDL_GetAudioStreamQueued(SDL_AudioStream *stream);
β¨ DESCRIPTION β¨
so here's the tea, and it's important tea: this number is the bytes you put in as input, not the bytes you can pull back out as output. π and because of several details (multiple, several, we love that for us), you cannot just do math to turn one of those numbers into the other. not possible. don't try it.
if what you actually need is to know how much usable data you can retrieve right now, you want SDL_GetAudioStreamAvailable() instead, not this function. periodt. π
also, heads up: audio streams can change their input format at any time, even while there's still data queued in a different format. so the byte count you get back won't necessarily match the number of sample frames available. if you're feeding a stream, be aware of the format changes you're making and plan accordingly. π
queued data doesn't get converted until it's consumed by SDL_GetAudioStreamData, so this value should be representative of the exact data that was put into the stream. slay, consistency. β¨
and now the dramatic part: if the stream has SO much data that it would overflow an int, the return value gets clamped to a maximum value β but no queued data is lost, okay? none. if you've got 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. big queue energy. π
β¨ FUNCTION PARAMETERS β¨
streamβ the audio stream you're querying. the one. the main character. π
β¨ RETURN VALUE β¨
Returns the number of bytes queued, or -1 on failure. π« if you get that -1, call SDL_GetError() for more info β it'll tell you what went wrong.
β¨ THREAD SAFETY β¨
it is safe to call this function from any thread. go off, multithreaded icon. π§
β¨ AVAILABILITY β¨
this function has been available since SDL 3.2.0. β
β¨ SEE ALSO β¨
and that's the page!! π«Ά this was the SDL3 functions manual, brought to you by Simple Directmedia Layer, version SDL 3.4.18, and the page itself is SDL_GetAudioStreamQueued(3). go check your queue, bestie, and stay hydrated ππΈ
π¦ 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