SDL_HINT_AUDIO_FORMAT(3)

πŸ’– SDL_HINT_AUDIO_FORMAT πŸ’–

okay bestie, so this is one of the SDL3 hints β€” from the <SDL3/SDL_hints.h> era β€” and it's literally the one that controls the default audio format. A variable controlling the default audio format, if we're being official about it. 🎧✨


✨ SYNOPSIS ✨

#include <SDL3/SDL_hints.h>

#define SDL_HINT_AUDIO_FORMAT "SDL_AUDIO_FORMAT"

like, that's the whole vibe. one #include, one #define, and the string it maps to is "SDL_AUDIO_FORMAT". 🫢


🌸 DESCRIPTION 🌸

so here's the tea β˜•: if your application doesn't specify an audio format when it opens the device, this hint steps in and says "don't worry babe, i got you" and gives you a default format to use. it's giving backup bestie energy. πŸ’…

you can set the variable to any of these iconic little values:

  • "U8" β€” unsigned 8-bit audio
  • "S8" β€” signed 8-bit audio
  • "S16LE" β€” signed 16-bit little-endian audio
  • "S16BE" β€” signed 16-bit big-endian audio
  • "S16" β€” signed 16-bit native-endian audio (this is the default, no cap πŸ‘‘)
  • "S32LE" β€” signed 32-bit little-endian audio
  • "S32BE" β€” signed 32-bit big-endian audio
  • "S32" β€” signed 32-bit native-endian audio
  • "F32LE" β€” floating point little-endian audio
  • "F32BE" β€” floating point big-endian audio
  • "F32" β€” floating point native-endian audio
🚨 IMPORTANT BESTIE 🚨 β€” this hint should be set before an audio device is opened. before. like, first. set it early or it literally cannot help you. πŸ™ˆ

πŸ¦‹ AVAILABILITY πŸ¦‹

this hint is available since SDL 3.2.0. she's new-ish, she's cute, she's ready. ✨


mwah πŸ’œ thanks for reading, go set your hint before you open that device, i'm obsessed with you, bye!!

β€” with love from the Simple Directmedia Layer girlies, SDL 3.4.18, SDL_HINT_AUDIO_FORMAT(3) πŸŽ€πŸŒˆβ­

πŸ“¦ where this page comes from