Mix_FadeInChannelTimed -- Fade in a sound on a channel, over ms milliseconds.


#include "SDL_mixer.h"

int Mix_FadeInChannelTimed(int which, Mix_Chunk *chunk, int loops, int ms, int ticks);


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.


Return Value

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

Mix_PlayChannelTimed, Mix_FadeInChannel, Mix_FadingChannel, Mix_HaltChannel, Mix_ExpireChannel, Mix_ReserveChannel

Mix_FadeInChannelTimed (last edited 2008-04-17 08:18:10 by localhost)