- Audio clip playback (direct)
- Audio source 3D position
- Music playback (file / in-memory streaming)
- RAII types
- Exception-less implementation
- Error callback (optional)
- C++20 compiler (and standard library)
- CMake 3.14+ (Ideally 3.20+)
- WAV
- FLAC
- MP3
#include <capo/capo.hpp>
void capoTest() {
auto instance = capo::Instance::make();
auto pcm = capo::PCM::from_file("audio_clip.wav"); // load/decompress audio file into PCM
capo::Sound sound = instance->make_sound(*pcm); // make a new Sound instance using above PCM
capo::Source source = instance->make_source(); // make a new Source instance
source.play(sound); // bind Sound instance to Source and start playing
while (source.state() == capo::State::ePlaying) {
std::this_thread::yield(); // wait until playback complete
}
capo::Music music(instance.get()); // construct new music instance
music.open("music_file.mp3"); // open file in streaming mode
music.play(); // start playback
while (music.state() == capo::State::ePlaying) {
std::this_thread::yield(); // wait until playback complete
}
}
example_sound and example_music demonstrate basic sound and music usage, music_player demonstrates a more featured multi-track console music player.
- OpenAL Soft
- dr_libs (forked; original repo)