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.
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);