Tao.Sdl SDK Documentation

SdlMixer.Mix_FadeInMusicPos Method 

Play music from a start point, with looping, and fade in

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

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.
position
Position to play from, see Mix_SetMusicPosition for meaning.

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. The first time the music is played, it posistion will be set to position, 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.

Binds to C-function in SDL_mixer.h

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

Example

            // 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

SdlMixer Class | Tao.Sdl Namespace | Mix_PlayMusic | Mix_FadeInMusic | Mix_SetMusicPosition