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

4.3.5 Mix_FadeInChannel

int Mix_FadeInChannel(int channel, Mix_Chunk *chunk, int loops, int ms)

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.
Passing one here plays the sample twice (1 loop).
ms
Milliseconds of time that the fade-in effect should take to go from silence to full volume.

Play chunk on channel, or if channel is -1, pick the first free unreserved channel.
The channel volume starts at 0 and fades up to full volume over ms milliseconds of time. The sample may end before the fade-in is complete if it is too short or doesn't have enough loops. The sample will play for loops+1 number of times, unless stopped by halt, or fade out, or setting a new expiration time of less time than it would have originally taken to play the loops, or closing the mixer.
Note: this just calls Mix_FadeInChannelTimed() with ticks set to -1.

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

 
// play sample on first free unreserved channel
// play it exactly 3 times through
// fade in over one second
// Mix_Chunk *sample; //previously loaded
if(Mix_FadeInChannel(-1, sample, 2, 1000)==-1) {
    printf("Mix_FadeInChannel: %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:
4.3.3 Mix_PlayChannel, 4.3.6 Mix_FadeInChannelTimed, 4.3.15 Mix_FadingChannel, 4.3.11 Mix_FadeOutChannel, 4.4.1 Mix_ReserveChannels



This document was generated on November, 13 2009 using texi2html