Skip to main content

Playing Sounds in SDL

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