MIX_AudioFramesToMS(3)

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

✨ 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 πŸ’œ


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