SDL_HINT_AUD...SAMPLE_FRAMES(3)

πŸ’– NAME πŸ’–

SDL_HINT_AUDIO_DEVICE_SAMPLE_FRAMES β€” bestie, it's a variable that controls the device buffer size ✨


πŸŽ€ SYNOPSIS πŸŽ€

#include <SDL3/SDL_hints.h>

#define SDL_HINT_AUDIO_DEVICE_SAMPLE_FRAMES "SDL_AUDIO_DEVICE_SAMPLE_FRAMES"

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so listen πŸ‘‘ this hint is an integer that's > 0, and what it actually represents is the size of the device's buffer measured in sample frames. and if you're sitting there like "girl what does that mean in bytes," lemme put you on: stereo audio data in 16-bit format is 4 bytes per sample frame, for example. iykyk πŸ’…

so here's the tea β˜• β€” SDL3 generally picks this value all on its own, on behalf of the app, like the main character it is. but if for some reason the app needs to dictate this (maybe she wants lower latency, or maybe she wants higher throughput, AND IS WILLING TO DEAL WITH what that might require of the app πŸ™ˆ), then she can absolutely specify it. no cap.

but bestie, be so fr right now: SDL will try to accommodate this value, but there is no promise you'll get the buffer size you requested 😭. many platforms won't honor this request at all, or might adjust it. it's giving "i'll see what i can do" and honestly? that's just how it is.

and the one thing you cannot forget, the vibe check that matters most: this hint should be set BEFORE an audio device is opened ⭐. before. not during, not after, before. periodt.


🌸 AVAILABILITY 🌸

this hint has been available since SDL 3.2.0 🫢 she's been here, she's iconic, she's not new.


and that's the whole page, bestie!! πŸŽ€ this lil' slice of the Simple Directmedia Layer docs is from SDL 3.4.18 β€” shoutout to the SDL3 functions girlies, mwah πŸ’‹ slay, go set your hint before opening that device πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from