aboutsummaryrefslogtreecommitdiff
path: root/src/dummy_audio.cpp
diff options
context:
space:
mode:
authorheavydemon21 <nielsstunnebrink1@gmail.com>2024-10-01 20:16:04 +0200
committerheavydemon21 <nielsstunnebrink1@gmail.com>2024-10-01 20:16:04 +0200
commit7230b630025886939c726e07eba1a0b35511f687 (patch)
treeaacfe3e427b8041fecc4562a39e9204e3429e8e5 /src/dummy_audio.cpp
parentef44da3f5e9ca533782da5e185e69e28c295d226 (diff)
parent65eda52aa51017f6f7aad158c4f8b6e91054cf0d (diff)
Merge branch 'loek/audio' into niels/resource-manager
Diffstat (limited to 'src/dummy_audio.cpp')
-rw-r--r--src/dummy_audio.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/dummy_audio.cpp b/src/dummy_audio.cpp
new file mode 100644
index 0000000..049bb49
--- /dev/null
+++ b/src/dummy_audio.cpp
@@ -0,0 +1,40 @@
+#include "crepe/Sound.h"
+#include "crepe/util/log.h"
+
+#include <chrono>
+#include <thread>
+
+using namespace crepe;
+using namespace std;
+using namespace std::chrono_literals;
+using std::make_unique;
+
+int main() {
+ dbg_trace();
+
+ auto bgm = Sound("../mwe/audio/bgm.ogg");
+ auto sfx1 = Sound("../mwe/audio/sfx1.wav");
+ auto sfx2 = Sound("../mwe/audio/sfx2.wav");
+ auto sfx3 = 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;
+}