mixTrackMsToFrames function mixer

int mixTrackMsToFrames(
  1. Pointer<MixTrack> track,
  2. int ms
)

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

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.

\param track the track to query. \param ms the milliseconds to convert to track-specific sample frames. \returns Converted number of sample frames, 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_TrackFramesToMS

extern SDL_DECLSPEC Sint64 SDLCALL MIX_TrackMSToFrames(MIX_Track *track, Sint64 ms)

Implementation

int mixTrackMsToFrames(Pointer<MixTrack> track, int ms) {
  final mixTrackMsToFramesLookupFunction = _libMixer
      .lookupFunction<
        Int64 Function(Pointer<MixTrack> track, Int64 ms),
        int Function(Pointer<MixTrack> track, int ms)
      >('MIX_TrackMSToFrames');
  return mixTrackMsToFramesLookupFunction(track, ms);
}