Scroll to navigation

MIX_TrackMSToFrames(3) SDL_mixer3 FUNCTIONS MIX_TrackMSToFrames(3)

NAME

MIX_TrackMSToFrames - Convert milliseconds to sample frames for a track's current format.

SYNOPSIS

#include <SDL3_mixer/SDL_mixer.h>
Sint64 MIX_TrackMSToFrames(MIX_Track *track, Sint64 ms);

DESCRIPTION

This calculates time based on the track's current input format, which can change when its input does, and also if that input changes formats mid-stream (for example, if decoding a file that is two MP3s concatenated together).

On various errors (MIX_Init() was not called, the track is NULL), this returns -1. If the track has no input, this returns -1. If ms is < 0, this returns -1.

FUNCTION PARAMETERS

the track to query.
the milliseconds to convert to track-specific sample frames.

RETURN VALUE

Returns Converted number of sample frames, or -1 for errors/no input; 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_TrackFramesToMS(3)

SDL_mixer 3.2.0 SDL_mixer