From 96d0f65399e93bb0d6dd252598813b0423b81d83 Mon Sep 17 00:00:00 2001 From: Xavier Mitault Date: Sun, 5 Nov 2023 21:53:53 +0000 Subject: [PATCH] BLUGA-GRAPHICS: Add unload music sound --- .../B-luga-graphics/src/RaylibImpl/Audio/Audio.cpp | 14 ++++++++++++++ .../B-luga-graphics/src/RaylibImpl/Audio/Audio.hpp | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/libs/B-luga-graphics/src/RaylibImpl/Audio/Audio.cpp b/libs/B-luga-graphics/src/RaylibImpl/Audio/Audio.cpp index b35cb47..bba30d7 100644 --- a/libs/B-luga-graphics/src/RaylibImpl/Audio/Audio.cpp +++ b/libs/B-luga-graphics/src/RaylibImpl/Audio/Audio.cpp @@ -173,4 +173,18 @@ namespace Raylib { { return _path; } + + ~SoundImpl::SoundImpl() + { + if (isReady()) { + unload(); + } + } + + ~MusicImpl::MusicImpl() + { + if (isReady()) { + unload(); + } + } } // namespace Raylib diff --git a/libs/B-luga-graphics/src/RaylibImpl/Audio/Audio.hpp b/libs/B-luga-graphics/src/RaylibImpl/Audio/Audio.hpp index dc3daac..cc906b6 100644 --- a/libs/B-luga-graphics/src/RaylibImpl/Audio/Audio.hpp +++ b/libs/B-luga-graphics/src/RaylibImpl/Audio/Audio.hpp @@ -20,6 +20,8 @@ namespace Raylib { public: SoundImpl(const std::string& fileName, float volume); + ~SoundImpl(); + bool isReady() const override; void unload() override; @@ -56,6 +58,8 @@ namespace Raylib { public: MusicImpl(const std::string& fileName, float volume); + ~MusicImpl(); + void unload() override; bool isReady() const override;