MIX_FramesToMS(3)

πŸ“¦
version 3.2.4 Β· 2 versions
, in fedora 44

πŸ’– MIX_FramesToMS(3) πŸ’–

okay bestie, welcome to the SDL_mixer3 function corner of the group chat, where today's main character is MIX_FramesToMS β€” she converts sample frames into milliseconds at whatever sample rate you tell her πŸŽ€βœ¨


🌸 NAME 🌸

MIX_FramesToMS β€” the glow-up that turns sample frames, at a specific sample rate, into milliseconds πŸ’…


✨ SYNOPSIS ✨

#include <SDL3_mixer/SDL_mixer.h>

Sint64 MIX_FramesToMS(int sample_rate, Sint64 frames);

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea πŸ“: sample frames are wayyy more precise than milliseconds. like, frames are out here living in HD and milliseconds are giving blurry webcam energy. so out of pure necessity, this function approximates by rounding down to the closest full millisecond. no rounding up, no "close enough bestie", just straight down ⬇️ periodt.

and the safety rails, because we love boundaries:

  • if sample_rate is <= 0, this returns -1 πŸ™ˆ
  • if frames is < 0, this returns -1 πŸ’€

πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • sample_rate β€” the sample rate you wanna use for the conversion, queen πŸ‘‘
  • frames β€” the rate-specific sample frames you're converting over to milliseconds 🌈

⭐ RETURN VALUE ⭐

returns the converted number of milliseconds, or -1 if something went wrong 😭 β€” and if it did go wrong, call SDL_GetError() for the details, she will spill the whole story iykyk.


πŸ’œ THREAD SAFETY πŸ’œ

it is safe to call this function from any thread 🫢 no gatekeeping, no drama, every thread is welcome.


🌟 AVAILABILITY 🌟

this function has been available since SDL_mixer 3.0.0 β€” she's been iconic for a minute now πŸ’…


πŸ‘‘ SEE ALSO πŸ‘‘


and that's the whole vibe fr fr πŸ’– this page came to you from SDL_mixer 3.2.4, part of the SDL_mixer fam β€” stay hydrated, go convert some frames, mwah 🧚✨

πŸ“¦ where this page comes from