SDL_GETAUDIOSTREAMFREQUENCYRATIO(3)

πŸ’– SDL_GetAudioStreamFrequencyRatio πŸ’–

okay bestie, so this one's from the SDL3 FUNCTIONS manual, and it's genuinely one of the chillest little calls in the whole audio API. no cap. it's called SDL_GetAudioStreamFrequencyRatio, and yeah the name is a whole mouthful, but the vibe is: you got an audio stream, you wanna know its frequency ratio, you ask. that's it. that's the function. πŸŽ€


✨ NAME ✨

SDL_GetAudioStreamFrequencyRatio β€” get the frequency ratio of an audio stream. that's the whole job description, she's employed and thriving πŸ’…


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_audio.h>

float SDL_GetAudioStreamFrequencyRatio(SDL_AudioStream *stream);

look at her. a float. returning a float. living her best life πŸ¦‹


🫢 FUNCTION PARAMETERS 🫢

  • stream β€” the SDL_AudioStream to query. that's the one you're asking about. hand her over and she'll tell you her ratio, no drama πŸ’œ

⭐ RETURN VALUE ⭐

Returns the frequency ratio of the stream. slay. πŸŽ‰

BUT β€” and this is the part where we pay attention, bestie β€” if it fails, you get 0.0. not a cute vibe, but it happens. when that happens, call SDL_GetError() for more information, because she will absolutely tell you what went wrong. it's giving "not me getting zero'd out again 😭".

fr fr: 0.0 means failure here, so don't just assume your ratio is literally zero. go read the error. SDL_GetError() is right there, she's waiting. 🫢

πŸ”₯ THREAD SAFETY πŸ”₯

okay so this is the good part: it is safe to call this function from any thread. any of them. all of them. go wild. πŸ‘‘

the way that works is she holds a stream-specific mutex while running, so nobody's stepping on anybody's toes mid-query. very considerate of her, honestly. iconic behaviour. ✨


🌈 AVAILABILITY 🌈

this function has been available since SDL 3.2.0. so if you're on something older, sorry babe, she's not there yet πŸ™ˆ


πŸ‘‘ SEE ALSO πŸ‘‘


and that's the whole page, bestie!! no notes, she ate, periodt. πŸ“πŸ§š

this lil manual page comes to you from Simple Directmedia Layer, version SDL 3.4.18 β€” mwah, thanks for reading, ily, go query some streams πŸ’œβœ¨

πŸ“¦ where this page comes from