MIX_GetTrackLoops(3)
β¨ MIX_GetTrackLoops(3) β¨
okay bestie so this is a page from the SDL_mixer3 FUNCTIONS manual and it's literally just one adorable little function that tells you how many loops a track has left π
πΈ NAME πΈ
MIX_GetTrackLoops β asking the universe (well, asking SDL_mixer) how many loops are still pending for a given track π
π¦ SYNOPSIS π¦
#include <SDL3_mixer/SDL_mixer.h>
int MIX_GetTrackLoops(MIX_Track *track);
π DESCRIPTION π
So like. This returns the number of loops still pending, no cap. If a track is gonna eventually finish and then loop back around to play one more time, this hands you back 1. And if a track was looping but it's currently on its final iteration of the loop β meaning it's gonna stop the moment this iteration completes β then this returns zero. bye girl π
A track that's looping infinitely will return -1. And no, that is not an error, so don't come for it β the value just doesn't report an error in that case.
A track that's stopped (so: not playing and not paused) will have zero loops remaining. she's done, she's at peace π§
And on various errors β like MIX_Init() was never called, or the track is NULL β this also returns zero, BUT (and this is the annoying part) there is no mechanism to distinguish errors from non-looping tracks. so a zero is a zero is a zero, iykyk π
π FUNCTION PARAMETERS π
trackβ the track you're querying. that's the one. the girl in question π
β RETURN VALUE β
Returns the number of pending loops, zero if it's not looping, and -1 if it's looping infinitely. iconic honestly π
π₯ THREAD SAFETY π₯
It is safe to call this function from any thread. periodt. call it from wherever, she's not gonna be weird about it π«Ά
π AVAILABILITY π
This function has been available since SDL_mixer 3.0.0. so it's been here, holding it down π
ok bestie here's the thing: a 0 can mean three completely different situations and the function refuses to tell you which one π
and that's the whole page! π this manual page came to you from SDL_mixer 3.2.4 β love her, go query those loops, mwah πβ¨π
π¦ 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