Scroll to navigation

MIX_SetTrackLoops(3) SDL_mixer3 FUNCTIONS MIX_SetTrackLoops(3)

NAME

MIX_SetTrackLoops - Change the number of times a currently-playing track will loop.

SYNOPSIS

#include <SDL3_mixer/SDL_mixer.h>
bool MIX_SetTrackLoops(MIX_Track *track, int num_loops);

DESCRIPTION

This replaces any previously-set remaining loops. A value of 1 will loop to the start of playback one time. Zero will not loop at all. A value of -1 requests infinite loops. 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.

The new loop count replaces any previous state, even if the track has already looped.

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. This function is intended to alter that count in the middle of playback.

FUNCTION PARAMETERS

the track to configure.
new number of times to loop. Zero to disable looping, -1 to loop infinitely.

RETURN VALUE

Returns true on success, false on error; call SDL_GetError() for details.

THREAD SAFETY

It is safe to call this function from any thread.

AVAILABILITY

This function is available since SDL_mixer 3.0.0.

SEE ALSO

MIX_GetTrackLoops(3)

SDL_mixer 3.1.3 SDL_mixer