MIX_SetTrackPlaybackPosition(3)

NAME
MIX_SetTrackPlaybackPosition - Seek a playing track to a new position in its input.

SYNOPSIS
#include <SDL3_mixer/SDL_mixer.h>

bool MIX_SetTrackPlaybackPosition(MIX_Track *track, Sint64 frames);

DESCRIPTION
(Not to be confused with MIX_SetTrack3DPosition(), which is positioning of the track in 3D space, not the playback position of its audio data.)

On a playing track, the next time the mixer runs, it will start mixing from the new position.

Position is defined in _sample frames_ of decoded audio, not units of time, so that sample-perfect mixing can be achieved. To instead operate in units of time, use MIX_TrackMSToFrames() to get the approximate sample frames for a given tick.

This function requires an input that can seek (so it can not be used if the input was set with MIX_SetTrackAudioStream()), and a audio file format that allows seeking. SDL_mixer's decoders for some file formats do not offer seeking, or can only seek to times, not exact sample frames, in which case the final position may be off by some amount of sample frames. Please check your audio data and file bug reports if appropriate.

It's legal to call this function on a track that is stopped, but a future call to MIX_PlayTrack() will reset the start position anyhow. Paused tracks will resume at the new input position.

FUNCTION PARAMETERS

track
    the track to change.

frames
    the sample frame position to seek to.

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_GetTrackPlaybackPosition(3)