Tao.Sdl SDK Documentation

SdlMixer.Mix_FadeInChannelTimed Method 

Play loop with fade in and limit by time

[Visual Basic]
Public Shared Function Mix_FadeInChannelTimed( _
   ByVal channel As Integer, _
   ByVal chunk As IntPtr, _
   ByVal loops As Integer, _
   ByVal ms As Integer, _
   ByVal ticks As Integer _
) As Integer
[C#]
public static int Mix_FadeInChannelTimed(
   int channel,
   IntPtr chunk,
   int loops,
   int ms,
   int ticks
);

Parameters

channel
Channel to play on, or -1 for the first free unreserved channel.
chunk
Sample to play.
loops
Number of loops, -1 is infinite loops.
ms
Milliseconds of time that the fade-in effect should take to go from silence to full volume.
ticks
Millisecond limit to play sample, at most. If not enough loops or the sample chunk is not long enough, then the sample may stop before this timeout occurs. -1 means play forever.

Return Value

the channel the sample is played on. On any errors, -1 is returned.

Remarks

If the sample is long enough and has enough loops then the sample will stop after ticks milliseconds. Otherwise this function is the same as Mix_FadeInChannel.

Binds to C-function in SDL_mixer.h

int Mix_FadeInChannelTimed(int channel, Mix_Chunk *chunk, int loops, int ms, int ticks)
            

Example

            // play sample on first free unreserved channel
                    // play it for half a second
                    // Mix_Chunk *sample; //previously loaded
                    if(Mix_PlayChannelTimed(-1, sample, -1 , 500)==-1)
                {
                    printf("Mix_PlayChannel: %s\n",Mix_GetError());
                    // may be critical error, or maybe just no channels were free.
                    // you could allocated another channel in that case...
                }
            

See Also

SdlMixer Class | Tao.Sdl Namespace | Mix_PlayChannelTimed | Mix_FadeInChannel | Mix_HaltChannel | Mix_FadingChannel | Mix_ReserveChannels | Mix_ExpireChannel