From 726ac17b6ebcad268f6c8c7a88090a9081cb82ee Mon Sep 17 00:00:00 2001 From: Paweł Kołodziejski Date: Sat, 19 Jun 2004 14:41:04 +0000 Subject: experimental fix for expired sounds svn-id: r13963 --- scumm/imuse_digi/dimuse_sndmgr.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scumm/imuse_digi/dimuse_sndmgr.cpp b/scumm/imuse_digi/dimuse_sndmgr.cpp index 1c5431e86c..b2298517a4 100644 --- a/scumm/imuse_digi/dimuse_sndmgr.cpp +++ b/scumm/imuse_digi/dimuse_sndmgr.cpp @@ -371,8 +371,15 @@ ImuseDigiSndMgr::soundStruct *ImuseDigiSndMgr::openSound(int32 soundId, const ch void ImuseDigiSndMgr::closeSound(soundStruct *soundHandle) { assert(soundHandle && checkForProperHandle(soundHandle)); - if (soundHandle->resPtr) - _vm->unlock(rtSound, soundHandle->soundId); + if (soundHandle->resPtr) { + bool found = false; + for (int l = 0; l < MAX_IMUSE_SOUNDS; l++) { + if ((_sounds[l].soundId == soundHandle->soundId) && (&_sounds[l] != soundHandle)) + found = true; + } + if (!found) + _vm->unlock(rtSound, soundHandle->soundId); + } delete soundHandle->bundle; for (int r = 0; r < soundHandle->numSyncs; r++) -- cgit v1.2.3