also Unload Sound

This commit is contained in:
HMH 2017-07-21 16:37:23 +02:00
parent 7b3aba8fdc
commit 7486ee867e

View file

@ -348,6 +348,12 @@ int CSound::Update()
int CSound::Shutdown() int CSound::Shutdown()
{ {
for(unsigned SampleID = 0; SampleID < NUM_SAMPLES; SampleID++)
{
UnloadSample(SampleID);
}
SDL_CloseAudio(); SDL_CloseAudio();
SDL_QuitSubSystem(SDL_INIT_AUDIO); SDL_QuitSubSystem(SDL_INIT_AUDIO);
lock_destroy(m_SoundLock); lock_destroy(m_SoundLock);
@ -684,7 +690,8 @@ void CSound::UnloadSample(int SampleID)
return; return;
Stop(SampleID); Stop(SampleID);
mem_free(m_aSamples[SampleID].m_pData); if (m_aSamples[SampleID].m_pData != 0x0)
mem_free(m_aSamples[SampleID].m_pData);
m_aSamples[SampleID].m_pData = 0x0; m_aSamples[SampleID].m_pData = 0x0;
} }