Properly unload the backend sound buffers

This commit is contained in:
Chris Robinson 2017-05-08 16:59:31 -07:00 committed by Christoph Oelckers
parent 0a8083e280
commit 60cc91e000

View file

@ -594,15 +594,14 @@ void S_CacheSound (sfxinfo_t *sfx)
void S_UnloadSound (sfxinfo_t *sfx) void S_UnloadSound (sfxinfo_t *sfx)
{ {
if (sfx->data3d.isValid() && sfx->data != sfx->data3d)
GSnd->UnloadSound(sfx->data3d);
if (sfx->data.isValid()) if (sfx->data.isValid())
{
if(sfx->data3d.isValid() && sfx->data != sfx->data3d)
GSnd->UnloadSound(sfx->data3d);
GSnd->UnloadSound(sfx->data); GSnd->UnloadSound(sfx->data);
sfx->data.Clear(); if (sfx->data.isValid() || sfx->data3d.isValid())
sfx->data3d.Clear();
DPrintf(DMSG_NOTIFY, "Unloaded sound \"%s\" (%td)\n", sfx->name.GetChars(), sfx - &S_sfx[0]); DPrintf(DMSG_NOTIFY, "Unloaded sound \"%s\" (%td)\n", sfx->name.GetChars(), sfx - &S_sfx[0]);
} sfx->data.Clear();
sfx->data3d.Clear();
} }
//========================================================================== //==========================================================================