MIX_GetTrac...ackPosition(3)

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

✨ MIX_GetTrackPlaybackPosition ✨

okay bestie, welcome to the SDL_mixer3 FUNCTIONS section of the manual πŸ’– this one's all about finding out exactly where your track is at β€” like, literally, its position in the audio data. no cap.


πŸ’– NAME πŸ’–

MIX_GetTrackPlaybackPosition β€” grabs the current input position of a track that's playing πŸŽ€


🌸 SYNOPSIS 🌸

#include <SDL3_mixer/SDL_mixer.h>

Sint64 MIX_GetTrackPlaybackPosition(MIX_Track *track);

πŸ¦‹ DESCRIPTION πŸ¦‹

okay first thing first, do NOT confuse this with MIX_GetTrack3DPosition(), bestie 😭 that one is about where the track sits in 3D space</>, and this one is about the playback position of its audio data. two completely different vibes, fr fr.

so the position is measured in _sample frames_ of decoded audio β€” not units of time β€” and that's on purpose, because that's how you get sample-perfect mixing πŸ‘‘ slay.

if you do want to work in units of time instead, no worries: just run the return value through MIX_TrackFramesToMS() and it converts it to milliseconds for you ✨

now for the behavior deets:

  • Tracks that are stopped or paused? they report the position they had when they halted. they're frozen there, main character standing still πŸ’…
  • Tracks that are playing? they report the current position, which β€” fair warning β€” will change over time. it's giving live updates, obviously πŸ™ˆ

πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • track β€” the track to change.

⭐ RETURN VALUE ⭐

it hands you back the track's current sample frame position πŸ’–

...or -1 if something went wrong 😭 and if that happens, hit up SDL_GetError() for the details, she'll tell you everything.


πŸ”₯ THREAD SAFETY πŸ”₯

it is safe to call this function from any thread 🫢 go off, queen.


🌈 AVAILABILITY 🌈

this function has been available since SDL_mixer 3.0.0 ⭐ iconic behavior.


πŸ‘‘ SEE ALSO πŸ‘‘


and that's the whole page, bestie πŸ§šπŸ’œ this lil manual page came to you straight from SDL_mixer 3.2.4 β€” that's the source and version right there, so you know exactly which era of the docs you're living in πŸ’…βœ¨ periodt.

πŸ“¦ where this page comes from