Tao.Sdl SDK Documentation

SdlMixer.Mix_FadeInMusic Method 

Play music, with looping, and fade in

[Visual Basic]
Public Shared Function Mix_FadeInMusic( _
   ByVal music As IntPtr, _
   ByVal loops As Integer, _
   ByVal ms As Integer _
) As Integer
[C#]
public static int Mix_FadeInMusic(
   IntPtr music,
   int loops,
   int ms
);

Parameters

music
Pointer to Mix_Music to play.
loops
number of times to play through the music.

ms
Milliseconds for the fade-in effect to complete.

Return Value

0 on success, or -1 on errors.

Remarks

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. Any previous music will be halted, or if it is fading out i t will wait (blocking) for the fade to complete. This function is the same as Mix_FadeInMusicPos(music, loops, ms, 0).

Binds to C-function in SDL_mixer.h

int Mix_FadeInMusic(Mix_Music *music, int loops, int ms)
            

Example

            // play music forever, fading in over 2 seconds
                    // Mix_Music *music; // I assume this has been loaded already
                    if(Mix_FadeInMusic(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

SdlMixer Class | Tao.Sdl Namespace | Mix_PlayMusic | Mix_FadeInMusicPos