From 30e2b2b0cbb503d83a087d8d326940c3c4bc8fff Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Sat, 30 Nov 2024 15:08:57 +0100 Subject: fix audio system implementation --- src/test/AudioTest.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/test/AudioTest.cpp') 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 #include @@ -27,24 +28,29 @@ public: AudioSource & sfx2 = entity.add_component("mwe/audio/sfx2.wav"); AudioSource & sfx3 = entity.add_component("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 -- cgit v1.2.3