SDL_AUDIO_BYTESIZE(3)
π SDL_AUDIO_BYTESIZE π
okay bestie, welcome to the SDL3 functions corner of the manual, where we learn how to turn an audio format into a number of bytes. it's giving "small macro, big brain" energy and honestly? we're obsessed. π
β¨ NAME β¨
SDL_AUDIO_BYTESIZE β retrieve the size, in bytes, from an SDL_AudioFormat. π¦
β¨ SYNOPSIS β¨
#include <SDL3/SDL_audio.h>
#define SDL_AUDIO_BYTESIZE(x) (SDL_AUDIO_BITSIZE(x) / 8)
like, that's the whole thing. one line. she's tiny but she ate. π
β¨ DESCRIPTION β¨
so here's the vibe: you hand her an audio format, she hands you back how many bytes that format takes up. no cap.
for example, SDL_AUDIO_BYTESIZE(SDL_AUDIO_S16) returns 2. β¨
lowkey iconic that it's just doing bits divided by eight, but hey, that's the whole point β you don't have to remember the math, you just call the macro. periodt.
β¨ MACRO PARAMETERS β¨
xβ anSDL_AudioFormatvalue. that's it, that's the parameter, she's low maintenance. πΈ
β¨ RETURN VALUE β¨
returns the data size in bytes. π«Ά
β¨ THREAD SAFETY β¨
it is safe to call this macro from any thread. literally any of them. go wild, queen. π
β¨ AVAILABILITY β¨
this macro has been available since SDL 3.2.0. π
heads up bestie: this page is part of the Simple Directmedia Layer docs, and the version we're looking at is SDL 3.4.18. if your SDL is older than 3.2.0, this macro is not gonna show up for you β not her fault, she was literally born in 3.2.0. π
okay that's the whole page, mwah, go count some bytes πππ¦β¨πΈπ«Άππβπ
π¦ 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