diff --git a/include/GEngine/libdev/components/driver/output/Sound.hpp b/include/GEngine/libdev/components/driver/output/Sound.hpp index 3540dad3..78bc0018 100644 --- a/include/GEngine/libdev/components/driver/output/Sound.hpp +++ b/include/GEngine/libdev/components/driver/output/Sound.hpp @@ -25,9 +25,11 @@ struct Sound : public gengine::Component { struct Music : public gengine::Component { bool pause = false; std::uint64_t musicId; + float volume; - Music(std::uint64_t musicId) - : musicId(musicId) { + Music(std::uint64_t musicId, float volume = 1) + : musicId(musicId) + , volume(volume) { } bool operator==(const Music &) const = default; diff --git a/source/GEngine/libdev/systems/driver/output/AudioManager.cpp b/source/GEngine/libdev/systems/driver/output/AudioManager.cpp index 9536c977..c26e4049 100644 --- a/source/GEngine/libdev/systems/driver/output/AudioManager.cpp +++ b/source/GEngine/libdev/systems/driver/output/AudioManager.cpp @@ -68,6 +68,7 @@ void AudioManager::onMainLoop(geg::event::RenderLoop &e) { StopMusicStream(getMusicById(m_currentMusicId)); m_currentMusicId = music.musicId; PlayMusicStream(getMusicById(m_currentMusicId)); + SetMusicVolume(getMusicById(m_currentMusicId), music.volume); } }