SDL_AUDIO_ISFLOAT(3)

πŸ’– SDL_AUDIO_ISFLOAT(3) β€” SDL3 FUNCTIONS πŸ’–

okay bestie, welcome to the SDL3 functions corner of the group chat, where we answer the one question that keeps you up at night: is this audio format floaty or not? 🌸


✨ NAME ✨

SDL_AUDIO_ISFLOAT β€” the macro that tells you whether an SDL_AudioFormat is giving floating point data energy. πŸ¦‹


✨ SYNOPSIS ✨

#include <SDL3/SDL_audio.h>

#define SDL_AUDIO_ISFLOAT(x)         ((x) & SDL_AUDIO_MASK_FLOAT)

literally one line of macro, no cap. she's small but she's iconic. πŸ’…


✨ DESCRIPTION ✨

So here's the vibe: you hand her an SDL_AudioFormat, she peeks at it, and she's like "yeah that's float" or "nope, not float". that's the whole job. she's not doing your taxes. πŸŽ€

for example, SDL_AUDIO_ISFLOAT(SDL_AUDIO_S16) returns 0. because SDL_AUDIO_S16? not float. she said what she said. 😭


✨ MACRO PARAMETERS ✨

  • x β€” an SDL_AudioFormat value. that's it, that's the whole input, she's low maintenance. πŸ“

✨ RETURN VALUE ✨

  • non-zero if the format is floating point πŸ’–
  • zero otherwise πŸ™ˆ

so like, truthy or falsy. classic.


✨ THREAD SAFETY ✨

it is safe to call this macro from any thread. any of them. all of them. every single thread. she does not care, she is unbothered, she is main character energy. πŸ‘‘


✨ AVAILABILITY ✨

this macro has been available since SDL 3.2.0. if you're on something older… bestie. upgrade. 🧚


ngl if you're out here checking formats on ancient SDL you're gonna have a bad time. SDL 3.2.0 or later, periodt.

and that's the whole page!! mwah πŸ’œ

Simple Directmedia Layer came through with this one, and this doc is living in SDL 3.4.18 land β€” shoutout to the SDL crew, love that for them. 🫢🌈⭐

πŸ“¦ where this page comes from