MIX_AudioFramesToMS(3)
β¨ MIX_AudioFramesToMS(3) β¨
okay bestie, welcome to SDL_mixer3 FUNCTIONS π this one's a lil cutie from the SDL_mixer3 manual and it's literally about turning sample frames into milliseconds. yes queen, math but make it audio π
πΈ NAME πΈ
MIX_AudioFramesToMS β convert sample frames for a MIX_Audio's format to milliseconds. that's the whole vibe. β±οΈβ¨
π¦ SYNOPSIS π¦
#include <SDL3_mixer/SDL_mixer.h>
Sint64 MIX_AudioFramesToMS(MIX_Audio *audio, Sint64 frames);
π DESCRIPTION π
so here's the tea π β this calculates time based on the audio's initial format, even if the format would change mid-stream. like, it's committed to the original format, no cap, it does not switch up on you mid-way. π
sample frames are more precise than milliseconds, so out of necessity this function will approximate by rounding down to the closest full millisecond. it's giving "close enough bestie" energy, but only on purpose, don't come for it. π
and if frames is < 0, this returns -1. periodt. that's the boundary, respect it. π«
π FUNCTION PARAMETERS π
audioβ the audio to query. your main character audio object, go off. πframesβ the audio-specific sample frames to convert to milliseconds. hand it the frames, it handles the rest. π₯
β RETURN VALUE β
Returns the converted number of milliseconds, or -1 for errors/no input β and yeah, call SDL_GetError() for the details, it'll spill everything. π
π§ THREAD SAFETY π§
it is safe to call this function from any thread. go wild, bestie, no locking drama here. π«Ά
π AVAILABILITY π
this function is available since SDL_mixer 3.0.0. OG status. π
π SEE ALSO π
MIX_AudioMSToFrames(3)β the reverse bestie, the remix, the other direction of the same slay β¨
mwah that's the whole page, you ate it fr fr. this lil icon lives in SDL_mixer 3.2.4, so go forth and convert your frames, queen π ππ¦
π¦ 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