MIX_FramesToMS(3)
π 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 π
MIX_MSToFrames(3)β the reversed bestie, the other half of the duo π₯
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
- 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