MIX_GetTrackLoops(3)

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

✨ 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