MIX_AudioMSToFrames(3)

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

πŸ’– MIX_AudioMSToFrames(3) πŸ’–

okay bestie, welcome to the SDL_mixer3 FUNCTIONS section of the manual, and today's main character is MIX_AudioMSToFrames. yes she's a libc-style function, yes she has a <SDL3_mixer/SDL_mixer.h> include, and yes she ate. let's get into it 🫢


✨ NAME ✨

MIX_AudioMSToFrames β€” literally converts milliseconds into sample frames for a MIX_Audio's format. that's the whole job. she does one thing and she does it flawlessly πŸ’…


🌸 SYNOPSIS 🌸

#include <SDL3_mixer/SDL_mixer.h>

Sint64 MIX_AudioMSToFrames(MIX_Audio *audio, Sint64 ms);

πŸ¦‹ DESCRIPTION πŸ¦‹

so the way this works is: it calculates the time based on the audio's initial format, even if the format would change mid-stream. like, she's not out here second-guessing herself β€” she locked in on the original format and she's standing on business ✨

and ngl, there's a lil catch: if ms is < 0, this returns -1. periodt. that's the boundary, no negotiating πŸ™ˆ


πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • audio β€” the audio to query. the vibe check source, if you will.
  • ms β€” the milliseconds to convert to audio-specific sample frames. aka the raw number you're handing over to get translated πŸ’–

⭐ RETURN VALUE ⭐

returns the converted number of sample frames, or -1 for errors/no input. and if you get that -1? call SDL_GetError() for details, bestie, she'll tell you what went wrong πŸ”₯


πŸ’œ THREAD SAFETY πŸ’œ

it is safe to call this function from any thread. iconic. no drama, no locking stress, just vibes 🌈


🌟 AVAILABILITY 🌟

this function is available since SDL_mixer 3.0.0. she's been here, she's established, she's a queen πŸ‘‘


πŸ‘€ SEE ALSO πŸ‘€


and that's the whole page, no cap. mwah πŸ’‹

sending you off with the receipts: this is from SDL_mixer, version 3.2.4, and the page is MIX_AudioMSToFrames(3) β€” go convert some milliseconds, you got this πŸŽ€βœ¨πŸ’–

πŸ“¦ where this page comes from