aboutsummaryrefslogtreecommitdiff
path: root/src/dummy_audio.cpp
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-09-28 17:07:56 +0200
committerLoek Le Blansch <loek@pipeframe.xyz>2024-09-28 17:07:56 +0200
commit3cb7227c3c9678141ff74915331b706265c380cb (patch)
treed47d662b4d26908b3d3d83f4a4df32a0cc489b72 /src/dummy_audio.cpp
parent506090032a07f2f3a74a44d8c8774cbdd252c947 (diff)
more WIP audio facade
Diffstat (limited to 'src/dummy_audio.cpp')
-rw-r--r--src/dummy_audio.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/dummy_audio.cpp b/src/dummy_audio.cpp
new file mode 100644
index 0000000..5e0000e
--- /dev/null
+++ b/src/dummy_audio.cpp
@@ -0,0 +1,37 @@
+#include "crepe/SoundSystem.h"
+
+#include <chrono>
+#include <thread>
+
+using namespace crepe;
+using namespace std;
+using namespace std::chrono_literals;
+
+int main() {
+ auto bgm = SoundSystem::sound("../mwe/audio/bgm.ogg");
+ auto sfx1 = SoundSystem::sound("../mwe/audio/sfx1.wav");
+ auto sfx2 = SoundSystem::sound("../mwe/audio/sfx2.wav");
+ auto sfx3 = SoundSystem::sound("../mwe/audio/sfx3.wav");
+
+ bgm->play();
+
+ // play each sample sequentially
+ this_thread::sleep_for(500ms);
+ sfx1->play();
+ this_thread::sleep_for(500ms);
+ sfx2->play();
+ bgm->pause();
+ this_thread::sleep_for(500ms);
+ sfx3->play();
+ bgm->play();
+ this_thread::sleep_for(500ms);
+
+ // play all samples simultaniously
+ sfx1->play();
+ sfx2->play();
+ sfx3->play();
+ this_thread::sleep_for(1000ms);
+
+ return 0;
+}
+