[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.5.7 Mix_FadeInMusicPos

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

music
Pointer to Mix_Music to play.
loops
number of times to play through the music.
0 plays the music zero times...
-1 plays the music forever (or as close as it can get to that)
ms
Milliseconds for the fade-in effect to complete.
position
Posistion to play from, see Mix_SetMusicPosition for meaning.

Fade in over ms milliseconds of time, the loaded music, playing it loop times through from start to finish.
The fade in effect only applies to the first loop.
The first time the music is played, it posistion will be set to posistion, which means different things for different types of music files, see Mix_SetMusicPosition for more info on that.
Any previous music will be halted, or if it is fading out it will wait (blocking) for the fade to complete.

Returns: 0 on success, or -1 on errors.

 
// play music forever, fading in over 2 seconds
// Mix_Music *music; // I assume this has been loaded already
if(Mix_FadeInMusicPos(music, -1, 2000)==-1) {
    printf("Mix_FadeInMusic: %s\n", Mix_GetError());
    // well, there's no music, but most games don't break without music...
}

See Also:
4.5.5 Mix_PlayMusic, 4.5.6 Mix_FadeInMusic, 4.5.13 Mix_SetMusicPosition



This document was generated on November, 13 2009 using texi2html