From f90a2a30c256afe88d390a3b9bdd973f4b5e7a4b Mon Sep 17 00:00:00 2001 From: Paweł Kołodziejski Date: Mon, 26 Apr 2004 19:22:27 +0000 Subject: locking resource sounds while using them to prevent expire svn-id: r13640 --- scumm/imuse_digi/dimuse_sndmgr.cpp | 4 ++++ scumm/scumm.h | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/scumm/imuse_digi/dimuse_sndmgr.cpp b/scumm/imuse_digi/dimuse_sndmgr.cpp index ee6f6bcb52..10096973e9 100644 --- a/scumm/imuse_digi/dimuse_sndmgr.cpp +++ b/scumm/imuse_digi/dimuse_sndmgr.cpp @@ -91,6 +91,7 @@ void ImuseDigiSndMgr::prepareSound(byte *ptr, int slot) { _sounds[slot].region = (_region *)malloc(sizeof(_region) * 70); _sounds[slot].jump = (_jump *)malloc(sizeof(_jump)); _sounds[slot].resPtr = ptr; + _vm->lock(rtSound, _sounds[slot].soundId); _sounds[slot].bits = 8; _sounds[slot].channels = 1; @@ -363,6 +364,9 @@ 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); + delete soundHandle->bundle; for (int r = 0; r < soundHandle->numSyncs; r++) free(soundHandle->sync[r].ptr); diff --git a/scumm/scumm.h b/scumm/scumm.h index 62570d1d74..31b0674acb 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -537,11 +537,12 @@ public: void requestSave(int slot, const char *name, bool compatible = false); void requestLoad(int slot); + void lock(int type, int i); + void unlock(int type, int i); + protected: /* Heap and memory management */ uint32 _maxHeapThreshold, _minHeapThreshold; - void lock(int type, int i); - void unlock(int type, int i); /* Script VM - should be in Script class */ uint32 _localScriptList[NUM_LOCALSCRIPT]; -- cgit v1.2.3