aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFilippos Karapetis2010-01-02 13:57:36 +0000
committerFilippos Karapetis2010-01-02 13:57:36 +0000
commit2bc0ffdeb7734b4165a0426b3e533e477a5b0d0d (patch)
tree191ba8b360a1de368149393489b8ce79d1434fea /engines
parent5b4b8e053fd6bbad8a5f96dfdfa26568dc3fd026 (diff)
downloadscummvm-rg350-2bc0ffdeb7734b4165a0426b3e533e477a5b0d0d.tar.gz
scummvm-rg350-2bc0ffdeb7734b4165a0426b3e533e477a5b0d0d.tar.bz2
scummvm-rg350-2bc0ffdeb7734b4165a0426b3e533e477a5b0d0d.zip
SCI/new music code: hopefully fixed a race condition
svn-id: r46882
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/sfx/soundcmd.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/engines/sci/sfx/soundcmd.cpp b/engines/sci/sfx/soundcmd.cpp
index e7aa84d915..1707eae08c 100644
--- a/engines/sci/sfx/soundcmd.cpp
+++ b/engines/sci/sfx/soundcmd.cpp
@@ -514,7 +514,6 @@ void SoundCommandParser::cmdPauseSound(reg_t obj, int16 value) {
changeSoundStatus(obj, value ? SOUND_STATUS_SUSPENDED : SOUND_STATUS_PLAYING);
#else
- Common::StackLock lock(_music->_mutex);
MusicEntry *musicSlot = NULL;
MusicList::iterator slotLoop = NULL;
@@ -533,6 +532,8 @@ void SoundCommandParser::cmdPauseSound(reg_t obj, int16 value) {
}
}
+ Common::StackLock lock(_music->_mutex);
+
do {
if (_soundVersion <= SCI_VERSION_0_LATE) {
PUT_SEL32V(_segMan, musicSlot->soundObj, state, kSoundPaused);
@@ -551,6 +552,7 @@ void SoundCommandParser::cmdPauseSound(reg_t obj, int16 value) {
musicSlot = *(slotLoop++);
}
} while (slotLoop);
+
#endif
}
@@ -759,14 +761,11 @@ void SoundCommandParser::cmdUpdateCues(reg_t obj, int16 value) {
PUT_SEL32V(_segMan, obj, frame, frame);
}
#else
- _music->_mutex.lock();
MusicEntry *musicSlot = _music->getSlot(obj);
if (!musicSlot) {
warning("cmdUpdateCues: Slot not found (%04x:%04x)", PRINT_REG(obj));
- _music->_mutex.unlock();
return;
}
- _music->_mutex.unlock(); // unlock to perform mixer-related calls
// In SCI0, make absolutely sure that the sound object hasn't
// been deleted (can happen e.g. at the ending of QFG1)
@@ -799,8 +798,6 @@ void SoundCommandParser::cmdUpdateCues(reg_t obj, int16 value) {
}
}
- _music->_mutex.lock(); // and lock again
-
switch (musicSlot->signal) {
case 0:
if (musicSlot->dataInc != GET_SEL32V(_segMan, obj, dataInc)) {
@@ -834,7 +831,6 @@ void SoundCommandParser::cmdUpdateCues(reg_t obj, int16 value) {
PUT_SEL32V(_segMan, obj, frame, musicSlot->ticker);
}
- _music->_mutex.unlock();
#endif
}