aboutsummaryrefslogtreecommitdiff
path: root/engines/lure/sound.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2007-11-18 07:42:49 +0000
committerPaul Gilbert2007-11-18 07:42:49 +0000
commitab445635cb9352400f5af406fe0024324e634e61 (patch)
tree74715c733aa9306cc2e3a36b16c4373e8861a344 /engines/lure/sound.cpp
parent0867e09a8129775de703516ca37108237b5d5c77 (diff)
downloadscummvm-rg350-ab445635cb9352400f5af406fe0024324e634e61.tar.gz
scummvm-rg350-ab445635cb9352400f5af406fe0024324e634e61.tar.bz2
scummvm-rg350-ab445635cb9352400f5af406fe0024324e634e61.zip
Added some extra mutex locks to the sound code to hopefully prevent randomo crashes
svn-id: r29553
Diffstat (limited to 'engines/lure/sound.cpp')
-rw-r--r--engines/lure/sound.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/engines/lure/sound.cpp b/engines/lure/sound.cpp
index 8a7e0856f4..fa7b0439b2 100644
--- a/engines/lure/sound.cpp
+++ b/engines/lure/sound.cpp
@@ -371,6 +371,7 @@ void SoundManager::fadeOut() {
{
inProgress = false;
+ g_system->lockMutex(_soundMutex);
ManagedList<MidiMusic *>::iterator i;
for (i = _playingSounds.begin(); i != _playingSounds.end(); ++i) {
MidiMusic *music = *i;
@@ -380,6 +381,7 @@ void SoundManager::fadeOut() {
}
}
+ g_system->unlockMutex(_soundMutex);
g_system->delayMillis(10);
}
@@ -457,12 +459,14 @@ bool SoundManager::musicInterface_CheckPlaying(uint8 soundNumber) {
musicInterface_TidySounds();
uint8 soundNum = soundNumber & 0x7f;
+ g_system->lockMutex(_soundMutex);
ManagedList<MidiMusic *>::iterator i;
for (i = _playingSounds.begin(); i != _playingSounds.end(); ++i) {
MidiMusic *music = *i;
if (music->soundNumber() == soundNum)
return true;
}
+ g_system->unlockMutex(_soundMutex);
return false;
}
@@ -475,12 +479,14 @@ void SoundManager::musicInterface_SetVolume(uint8 channelNum, uint8 volume) {
channelNum, volume);
musicInterface_TidySounds();
+ g_system->lockMutex(_soundMutex);
ManagedList<MidiMusic *>::iterator i;
for (i = _playingSounds.begin(); i != _playingSounds.end(); ++i) {
MidiMusic *music = *i;
if (music->channelNumber() == channelNum)
music->setVolume(volume);
}
+ g_system->unlockMutex(_soundMutex);
}
// musicInterface_KillAll