MIX_GetTrac...ackPosition(3)
β¨ 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
- 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