cho.sh
Playing Sounds in SDL

Playing Sounds in SDL

Warning

This post is more than a year old. Information may be outdated.

Non-looping Sounds

#include <SDL2/SDL.h>
Mix_PlayChannel(-1, game→GetSound("assets/Sounds/SoundName.wav"), 0);

Looping Sounds

Mix_PlayChannel(-1, GetSound("assets/Sounds/Music.ogg"), -1);

Halt Music

Mix_HaltChannel(channel);