Hello, I need to implement some music for a college work. I’ve been looking for info but couldn’t find any answers.
How do I add music?
Ty very much
Hello, I need to implement some music for a college work. I’ve been looking for info but couldn’t find any answers.
How do I add music?
It sounds like you want SDL_mixer:
https://www.libsdl.org/projects/SDL_mixer/
Btw, I just googled “SDL music” and got this as first result:
https://lazyfoo.net/tutorials/SDL/21_sound_effects_and_music/index.php
That’s one solution, but SDL_mixer is a big overhead with a number of dependencies. If it’s acceptable for the music to be in WAV format (which means a big file, typically) then SDL2’s core audio functions are all you need: SDL_OpenAudioDevice()
, SDL_LoadWAV_RW()
, SDL_QueueAudio()
, SDL_PauseAudioDevice()
.