This is a repository of basic examples on how to use SDL's audio functionality. These SDL audio examples are for future reference or as a starting point for anyone interested in working with SDL and audio. I have also over commented the code for extra explanation where needed.
Download SDL2 if needed. This code uses functionality introduced in version
2.0.4 so make sure to get the latest version. I use homebrew
but any package manager/direct install should work. The SDL Mixer is only
needed if you want to build the mixer example in wav_mix.c
.
brew install sdl2 sdl2_mixer
The build script uses clang to compile.
git clone https://github.com/dan-sf/sdl-audio-examples.git
cd sdl-audio-examples
./build.sh
# Run executables (.out files)
./wav_callback.out
./wav_mix.out
# etc.