aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm/imuse_digi
diff options
context:
space:
mode:
Diffstat (limited to 'engines/scumm/imuse_digi')
-rw-r--r--engines/scumm/imuse_digi/dimuse_script.cpp20
-rw-r--r--engines/scumm/imuse_digi/dimuse_track.cpp6
2 files changed, 15 insertions, 11 deletions
diff --git a/engines/scumm/imuse_digi/dimuse_script.cpp b/engines/scumm/imuse_digi/dimuse_script.cpp
index 1a257c905f..ad976e3300 100644
--- a/engines/scumm/imuse_digi/dimuse_script.cpp
+++ b/engines/scumm/imuse_digi/dimuse_script.cpp
@@ -189,16 +189,20 @@ void IMuseDigital::flushTracks() {
}
void IMuseDigital::refreshScripts() {
- Common::StackLock lock(_mutex, "IMuseDigital::refreshScripts()");
- debug(5, "refreshScripts()");
- bool found = false;
- for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
- Track *track = _track[l];
- if (track->used && !track->toBeRemoved && (track->volGroupId == IMUSE_VOLGRP_MUSIC)) {
- found = true;
+ {
+ Common::StackLock lock(_mutex, "IMuseDigital::refreshScripts()");
+ debug(5, "refreshScripts()");
+ bool found = false;
+ for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
+ Track *track = _track[l];
+ if (track->used && !track->toBeRemoved && (track->volGroupId == IMUSE_VOLGRP_MUSIC)) {
+ found = true;
+ }
}
}
-
+
+ // Make sure parseScriptCmds is *not* called while the mutex is locked
+ // (else race conditions can occur).
if (!found && (_curMusicSeq != 0)) {
debug(5, "refreshScripts() Start Sequence");
parseScriptCmds(0x1001, 0, 0, 0, 0, 0, 0, 0);
diff --git a/engines/scumm/imuse_digi/dimuse_track.cpp b/engines/scumm/imuse_digi/dimuse_track.cpp
index b58d73c8d5..968f01c9e8 100644
--- a/engines/scumm/imuse_digi/dimuse_track.cpp
+++ b/engines/scumm/imuse_digi/dimuse_track.cpp
@@ -45,7 +45,7 @@ int IMuseDigital::allocSlot(int priority) {
}
if (trackId == -1) {
- debug(5, "IMuseDigital::startSound(): All slots are full");
+ debug(5, "IMuseDigital::allocSlot(): All slots are full");
for (l = 0; l < MAX_DIGITAL_TRACKS; l++) {
Track *track = _track[l];
if (track->used && !track->toBeRemoved &&
@@ -57,9 +57,9 @@ int IMuseDigital::allocSlot(int priority) {
if (lowest_priority <= priority) {
assert(trackId != -1);
_track[trackId]->toBeRemoved = true;
- debug(5, "IMuseDigital::startSound(): Removed sound %d from track %d", _track[trackId]->soundId, trackId);
+ debug(5, "IMuseDigital::allocSlot(): Removed sound %d from track %d", _track[trackId]->soundId, trackId);
} else {
- debug(5, "IMuseDigital::startSound(): Priority sound too low");
+ debug(5, "IMuseDigital::allocSlot(): Priority sound too low");
return -1;
}
}