msToFrames method

int msToFrames(
  1. int ms
)

Convert milliseconds to sample frames for a MIX_Audio's format.

This calculates time based on the audio's initial format, even if the format would change mid-stream.

If ms is < 0, this returns -1.

\param audio the audio to query. \param ms the milliseconds to convert to audio-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_AudioFramesToMS

extern SDL_DECLSPEC Sint64 SDLCALL MIX_AudioMSToFrames(MIX_Audio *audio, Sint64 ms)

{@category mixer}

Implementation

int msToFrames(int ms) => mixAudioMsToFrames(this, ms);