MIX_MSToFrames(3)
β¨ MIX_MSToFrames β¨
okay bestie, so we're deep in the SDL_mixer3 functions section of the SDL_mixer manual, and today's main character is a little function called MIX_MSToFrames π It's got one job: take some milliseconds and tell you how many sample frames that is at a sample rate you pick. That's it. That's the whole vibe. Slay. π
πΈ NAME πΈ
MIX_MSToFrames β convert milliseconds to sample frames at a specific sample rate β¨
π¦ SYNOPSIS π¦
#include <SDL3_mixer/SDL_mixer.h>
Sint64 MIX_MSToFrames(int sample_rate, Sint64 ms);
π DESCRIPTION π
So like, here's the tea, and it's honestly a short one β
- If
sample_rateis<= 0, this returns-1. - If
msis< 0, this returns-1.
That's literally it. No secret third thing. Not me giving you a function that's this straightforward and still eating π
π«Ά FUNCTION PARAMETERS π«Ά
sample_rateβ the sample rate we're using for the conversion, bestie. This is the rate the math gets done in.msβ the milliseconds you wanna convert into rate-specific sample frames. Yes, the word "rate-specific" is doing real work there. iykyk.
π RETURN VALUE π
Returns the converted number of sample frames β iconic! π Or it returns -1 if something went wrong, in which case you gotta call SDL_GetError() for the details, fr fr. Go read your error, don't just sit there staring at the -1 π
π THREAD SAFETY π
Good news, queen: it is safe to call this function from any thread. Go wild. Handle it. π
β AVAILABILITY β
This function has been available since SDL_mixer 3.0.0. So if you're on anything older... bestie, no you're not. β¨
π SEE ALSO π
MIX_FramesToMS(3)β the reverse direction, because of course there's a matching one π
quick vibe check: negativesample_rateand negativemsare both hard-1s, not mysterious weird numbers. Don't skip the error check and then act surprised later π
and that's the whole page, periodt π
this was SDL_mixer manual, SDL_mixer 3.2.4 era, MIX_MSToFrames(3) β stay hydrated, check your return values, and I'll see you in the next manpage π¦πΈπ
π¦ where this page comes from
- fedora 44: SDL3_mixer-doc 3.2.4-3.fc44 Β· Zlib AND (GPL-2.0-or-later OR LGPL-2.0-or-later)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms