MIX_SetTrackLoops(3)
β¨ MIX_SetTrackLoops β¨
okay bestie, we're in the SDL_mixer3 functions era, and today's main character is MIX_SetTrackLoops(3) β the glow-up-your-loop-count function π
πΈ NAME πΈ
MIX_SetTrackLoops β change the number of times a currently-playing track will loop. that's it, that's the whole job π
π¦ SYNOPSIS π¦
#include <SDL3_mixer/SDL_mixer.h>
bool MIX_SetTrackLoops(MIX_Track *track, int num_loops);
π DESCRIPTION π
so basically, this replaces any previously-set remaining loops. like, out with the old, in with the new, no negotiating π«Ά
- a value of
1will loop to the start of playback one time 0will not loop at all, periodt-1requests infinite loops β infinite. forever. iconic π
β οΈ real talk though: if the input is not seekable and num_loops isn't zero, this function will report success but the track will stop at the point it should loop. it's giving "yes ma'am" but not actually doing it π
the new loop count replaces any previous state, even if the track has already looped. no takebacks, no history, just vibes forward β¨
also this has no effect on a track that is stopped. or rather β starting a stopped track later will set a new loop count, replacing this value. stopped tracks can specify a loop count while starting via MIX_PROP_PLAY_LOOPS_NUMBER. so this function here? it's the mid-playback plot twist β it's intended to alter that count while the track is already out here living its life π§
π FUNCTION PARAMETERS π
trackβ the track to configure. the one you're obsessed with πnum_loopsβ new number of times to loop. Zero to disable looping,-1to loop infinitely. simple as π©·
β RETURN VALUE β
Returns true on success, false on error; call SDL_GetError() for details. slay if it works, go check the error if it doesn't π
π§ THREAD SAFETY π§
It is safe to call this function from any thread. multitask, bestie, it's what you do π«
π AVAILABILITY π
This function is available since SDL_mixer 3.0.0. a certified classic, no cap π₯
π SEE ALSO π
MIX_GetTrackLoops(3)β the lil sibling that reads back what you set, iykyk
and that's the whole page, bestie!! πβ¨ this one's from the SDL_mixer source, version SDL_mixer 3.2.4, and yes it lives right there in the same manual page family as MIX_SetTrackLoops(3) β go forth and loop responsibly π¦ππΈ
π¦ 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