diff options
-rw-r--r-- | scumm/imuse_digi/dimuse.h | 2 | ||||
-rw-r--r-- | scumm/imuse_digi/dimuse_track.cpp | 11 |
2 files changed, 9 insertions, 4 deletions
diff --git a/scumm/imuse_digi/dimuse.h b/scumm/imuse_digi/dimuse.h index 66d4583f65..660e6be285 100644 --- a/scumm/imuse_digi/dimuse.h +++ b/scumm/imuse_digi/dimuse.h @@ -97,7 +97,7 @@ private: static void timer_handler(void *refConf); void callback(); void switchToNextRegion(int track); - void allocSlot(int priority); + bool allocSlot(int priority); void startSound(int soundId, const char *soundName, int soundType, int volGroupId, AudioStream *input, int hookId, int volume, int priority); void selectVolumeGroup(int soundId, int volGroupId); diff --git a/scumm/imuse_digi/dimuse_track.cpp b/scumm/imuse_digi/dimuse_track.cpp index ab8aba99e4..e88b24a732 100644 --- a/scumm/imuse_digi/dimuse_track.cpp +++ b/scumm/imuse_digi/dimuse_track.cpp @@ -32,7 +32,7 @@ namespace Scumm { -void IMuseDigital::allocSlot(int priority) { +bool IMuseDigital::allocSlot(int priority) { int l; int lower_priority = 127; bool found_free = false; @@ -68,9 +68,11 @@ void IMuseDigital::allocSlot(int priority) { warning("IMuseDigital::startSound(): Removed sound %d from track %d", _track[track_id]->soundId, track_id); } else { warning("IMuseDigital::startSound(): Priority sound too low"); - return; + return false; } } + + return true; } void IMuseDigital::startSound(int soundId, const char *soundName, int soundType, int volGroupId, AudioStream *input, int hookId, int volume, int priority) { @@ -78,7 +80,10 @@ void IMuseDigital::startSound(int soundId, const char *soundName, int soundType, debug(5, "IMuseDigital::startSound(%d)", soundId); int l; - allocSlot(priority); + if (!allocSlot(priority)) { + warning("IMuseDigital::startSound() Can't start sound - no free slots"); + return; + } for (l = 0; l < MAX_DIGITAL_TRACKS; l++) { if (!_track[l]->used && !_track[l]->handle.isActive()) { |