Browse Source Download (without any required ccan dependencies)
wwviaudio
realtime playback and mixing of 16 bit signed PCM audio data.
wwviaudio provides a set of functions for realtime playback and mixing of audio samples, e.g. music, sound effects, etc. as in a video game.
something along these lines:
if (wwviaudio_initialize_portaudio() != 0)
bail_out_and_die();
You would probably use #defines or enums rather than bare ints...
wwviaudio_read_ogg_clip(1, "mysound1.ogg");
wwviaudio_read_ogg_clip(2, "mysound2.ogg");
wwviaudio_read_ogg_clip(3, "mysound3.ogg");
wwviaudio_read_ogg_clip(4, "mymusic.ogg");
...
wwviaudio_play_music(4); <-- begins playing music in background, returns immediately
while (program isn't done) {
do_stuff();
if (something happened)
wwviaudio_add_sound(1);
if (something else happened)
wwviaudio_add_sound(2);
time_passes();
}
wwviaudio_cancel_all_sounds();
wwviaduio_stop_portaudio();
GPL (v2 or any later version)