Mix_PlayChannel -- Play a Mix_Chunk


#include "SDL_mixer.h"

int Mix_PlayChannel (int channel, Mix_Chunk *chunk, int loops);


Mix_PlayChannel will play the specified chunk over the specified channel. SDL_mixer will choose a channel for you if you pass -1 for channel.

The chunk will be looped loops times, the total number of times played will be loops+1. Passing -1 will loop the chunk infinitely.

Return Value

Returns the channel the chunk will be played on, or -1 on error.

Note: After the chunk is done repeating, the playing of that chunk ends. In SDL_mixer it is said to be halted, and invokes any Mix_ChannelFinished callbacks.


Mix_Chunk *sound = Mix_LoadWAV("some-sound-effect.wav");
Mix_PlayChannel(-1, sound, 0);

See Also

Mix_PlayChannelTimed, Mix_Chunk, Mix_LoadWAV

Mix_PlayChannel (last edited 2009-12-18 12:58:23 by 78-86-40-5)