mixTrackFramesToMs function mixer
Convert sample frames for a track's current format to milliseconds.
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).
Sample frames are more precise than milliseconds, so out of necessity, this function will approximate by rounding down to the closest full millisecond.
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 frames
is < 0,
this returns -1.
\param track the track to query. \param frames the track-specific sample frames to convert to milliseconds. \returns Converted number of milliseconds, or -1 for errors/no input; call SDL_GetError() for details.
\threadsafety It is safe to call this function from any thread.
\since This function is available since SDL_mixer 3.0.0.
\sa MIX_TrackMSToFrames
extern SDL_DECLSPEC Sint64 SDLCALL MIX_TrackFramesToMS(MIX_Track *track, Sint64 frames)
Implementation
int mixTrackFramesToMs(Pointer<MixTrack> track, int frames) {
final mixTrackFramesToMsLookupFunction = _libMixer
.lookupFunction<
Int64 Function(Pointer<MixTrack> track, Int64 frames),
int Function(Pointer<MixTrack> track, int frames)
>('MIX_TrackFramesToMS');
return mixTrackFramesToMsLookupFunction(track, frames);
}