aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaweł Kołodziejski2004-04-26 19:22:27 +0000
committerPaweł Kołodziejski2004-04-26 19:22:27 +0000
commitf90a2a30c256afe88d390a3b9bdd973f4b5e7a4b (patch)
tree32d486584556c5203c27251c474beceddefedb61
parent17332e393ef369acae3a43a25f859bd52f8022ed (diff)
downloadscummvm-rg350-f90a2a30c256afe88d390a3b9bdd973f4b5e7a4b.tar.gz
scummvm-rg350-f90a2a30c256afe88d390a3b9bdd973f4b5e7a4b.tar.bz2
scummvm-rg350-f90a2a30c256afe88d390a3b9bdd973f4b5e7a4b.zip
locking resource sounds while using them to prevent expire
svn-id: r13640
-rw-r--r--scumm/imuse_digi/dimuse_sndmgr.cpp4
-rw-r--r--scumm/scumm.h5
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];