mixFadeInMusicPos function

int mixFadeInMusicPos(
  1. Pointer<MixMusic> music,
  2. int loops,
  3. int ms,
  4. double position,
)

Play a new music object, fading in the audio, from a starting position.

This will start the new music playing, much like Mix_PlayMusic() will, but will start the music playing at silence and fade in to its normal volume over the specified number of milliseconds.

If there is already music playing, that music will be halted and the new music object will take its place.

If loops is greater than zero, loop the music that many times. If loops is -1, loop "infinitely" (~65000 times).

Fading music will change it's volume progressively, as if Mix_VolumeMusic() was called on it (which is to say: you probably shouldn't call Mix_VolumeMusic() on fading music).

This function allows the caller to start the music playback past the beginning of its audio data. You may specify a start position, in seconds, and the playback and fade-in will start there instead of with the first samples of the music.

An app can specify a position of 0.0 to start at the beginning of the music (or just call Mix_FadeInMusic() instead).

To convert from milliseconds, divide by 1000.0.

\param music the new music object to play. \param loops the number of times the chunk should loop, -1 to loop (not actually) infinitely. \param ms the number of milliseconds to spend fading in. \param position the start position within the music, in seconds, where playback should start. \returns zero on success, -1 on error.

\since This function is available since SDL_mixer 2.0.0.

extern DECLSPEC int SDLCALL Mix_FadeInMusicPos(Mix_Music *music, int loops, int ms, double position)

Implementation

int mixFadeInMusicPos(
    Pointer<MixMusic> music, int loops, int ms, double position) {
  final mixFadeInMusicPosLookupFunction = libSdl2Mixer.lookupFunction<
      Int32 Function(
          Pointer<MixMusic> music, Int32 loops, Int32 ms, Double position),
      int Function(Pointer<MixMusic> music, int loops, int ms,
          double position)>('Mix_FadeInMusicPos');
  return mixFadeInMusicPosLookupFunction(music, loops, ms, position);
}