From 0f3061febaaa259e38484b15f75e5f312cf23aa9 Mon Sep 17 00:00:00 2001 From: Popochounet Date: Wed, 27 Nov 2024 17:49:24 +0100 Subject: [PATCH] update AudioManager: added volume to event --- .../GEngine/libdev/systems/driver/output/AudioManager.hpp | 1 + .../GEngine/libdev/systems/events/driver/output/Sound.hpp | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/GEngine/libdev/systems/driver/output/AudioManager.hpp b/include/GEngine/libdev/systems/driver/output/AudioManager.hpp index 98e62592..4da01ba2 100644 --- a/include/GEngine/libdev/systems/driver/output/AudioManager.hpp +++ b/include/GEngine/libdev/systems/driver/output/AudioManager.hpp @@ -62,6 +62,7 @@ class AudioManager geg::component::network::NetSend()); else { getMusicComponent().musicId = getMusicIdByPath(e.path); + getMusicComponent().volume = e.volume; for (auto [e, _unused, netSend] : gengine::Zip(musics, netSends)) { netSend.update(); break; diff --git a/include/GEngine/libdev/systems/events/driver/output/Sound.hpp b/include/GEngine/libdev/systems/events/driver/output/Sound.hpp index cbe96050..87282dad 100644 --- a/include/GEngine/libdev/systems/events/driver/output/Sound.hpp +++ b/include/GEngine/libdev/systems/events/driver/output/Sound.hpp @@ -40,10 +40,12 @@ struct SoundPlayed : public Event { }; struct Music : public Event { - Music(const std::string &path) - : path(path) { + Music(const std::string &path, float volume = 1.f) + : path(path) + , volume(volume) { } const std::string path; + const float volume; }; } // namespace gengine::system::event::driver::output