aboutsummaryrefslogtreecommitdiff
path: root/src/test/AudioTest.cpp
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-11-30 15:08:57 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-11-30 15:08:57 +0100
commit30e2b2b0cbb503d83a087d8d326940c3c4bc8fff (patch)
treee7332b214587a336a130b01e83ad368388fca516 /src/test/AudioTest.cpp
parente4be73051a68b552c44280bbe9836dd4f02972d8 (diff)
fix audio system implementation
Diffstat (limited to 'src/test/AudioTest.cpp')
-rw-r--r--src/test/AudioTest.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/test/AudioTest.cpp b/src/test/AudioTest.cpp
index c6f0097..2a2d0e1 100644
--- a/src/test/AudioTest.cpp
+++ b/src/test/AudioTest.cpp
@@ -1,3 +1,4 @@
+#include "util/Log.h"
#include <gtest/gtest.h>
#include <future>
@@ -27,24 +28,29 @@ public:
AudioSource & sfx2 = entity.add_component<AudioSource>("mwe/audio/sfx2.wav");
AudioSource & sfx3 = entity.add_component<AudioSource>("mwe/audio/sfx3.wav");
+ void SetUp() override {
+ bgm.play_on_awake = true;
+ }
};
TEST_F(AudioTest, Default) {
bool example_done = false;
future example = async([&](){
- // Start the background track
- bgm.play();
+ // Start the background track. This happens automatically due to the play_on_awake property
+ // being true. The following call is optional and doesn't start two simultanious voices if
+ // left in:
+ // bgm.play();
// Play each sample sequentially while pausing and resuming the background track
this_thread::sleep_for(500ms);
sfx1.play();
this_thread::sleep_for(500ms);
sfx2.play();
- bgm.stop();
+ bgm.active = false;
this_thread::sleep_for(500ms);
sfx3.play();
- bgm.play();
+ bgm.active = true;
this_thread::sleep_for(500ms);
// Play all samples simultaniously