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

4.3.6 Mix_FadeInChannelTimed

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

Channel to play on, or -1 for the first free unreserved channel.
Sample to play.
Number of loops, -1 is infinite loops.
Passing one here plays the sample twice (1 loop).
Milliseconds of time that the fade-in effect should take to go from silence to full volume.
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.

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 4.3.5 Mix_FadeInChannel.

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

// 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:
4.3.4 Mix_PlayChannelTimed, 4.3.5 Mix_FadeInChannel, 4.3.15 Mix_FadingChannel, 4.3.9 Mix_HaltChannel, 4.3.10 Mix_ExpireChannel, 4.4.1 Mix_ReserveChannels

This document was generated on November, 13 2009 using texi2html