diff options
Diffstat (limited to 'src/example/audio_internal.cpp')
-rw-r--r-- | src/example/audio_internal.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/example/audio_internal.cpp b/src/example/audio_internal.cpp index 661161a..e23d485 100644 --- a/src/example/audio_internal.cpp +++ b/src/example/audio_internal.cpp @@ -4,7 +4,9 @@ */ #include <crepe/api/Config.h> +#include <crepe/facade/SoundContext.h> #include <crepe/facade/Sound.h> +#include <crepe/Asset.h> #include <crepe/util/Log.h> #include <thread> @@ -24,12 +26,18 @@ int _ = []() { }(); int main() { + SoundContext ctx{}; + Sound sound{ctx}; // Load a background track (Ogg Vorbis) - auto bgm = Sound("../mwe/audio/bgm.ogg"); + auto _bgm = sound.clone(Asset{"mwe/audio/bgm.ogg"}); + Sound & bgm = *dynamic_cast<Sound *>(_bgm.get()); // Load three short samples (WAV) - auto sfx1 = Sound("../mwe/audio/sfx1.wav"); - auto sfx2 = Sound("../mwe/audio/sfx2.wav"); - auto sfx3 = Sound("../mwe/audio/sfx3.wav"); + auto _sfx1 = sound.clone(Asset{"mwe/audio/sfx1.wav"}); + Sound & sfx1 = *dynamic_cast<Sound *>(_sfx1.get()); + auto _sfx2 = sound.clone(Asset{"mwe/audio/sfx2.wav"}); + Sound & sfx2 = *dynamic_cast<Sound *>(_sfx2.get()); + auto _sfx3 = sound.clone(Asset{"mwe/audio/sfx3.wav"}); + Sound & sfx3 = *dynamic_cast<Sound *>(_sfx3.get()); // Start the background track bgm.play(); |