diff --git a/src/sound.cxx b/src/sound.cxx index 7040dee..b0f46a2 100644 --- a/src/sound.cxx +++ b/src/sound.cxx @@ -84,6 +84,13 @@ CSound::~CSound () Mix_FreeChunk (m_lpSDL[i]); m_lpSDL[i] = nullptr; } + + if (m_pMusic) + { + Mix_HaltMusic (); + Mix_FreeMusic (m_pMusic); + m_pMusic = nullptr; + } } // Initialisation de DirectSound. @@ -328,6 +335,12 @@ CSound::PlayMusic (const std::string & lpszMIDIFilename) path += lpszMIDIFilename; + if (m_pMusic) + { + Mix_HaltMusic (); + Mix_FreeMusic (m_pMusic); + } + m_pMusic = Mix_LoadMUS (path.c_str ()); if (!m_pMusic) {