aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaweł Kołodziejski2004-04-26 19:30:12 +0000
committerPaweł Kołodziejski2004-04-26 19:30:12 +0000
commite256a54205df431b688f1ec7fc74a7a78b68ea8d (patch)
treea70da38e840a8f98f923e3a37f0df4815ef1b6ec
parentf90a2a30c256afe88d390a3b9bdd973f4b5e7a4b (diff)
downloadscummvm-rg350-e256a54205df431b688f1ec7fc74a7a78b68ea8d.tar.gz
scummvm-rg350-e256a54205df431b688f1ec7fc74a7a78b68ea8d.tar.bz2
scummvm-rg350-e256a54205df431b688f1ec7fc74a7a78b68ea8d.zip
fixed logic code bug. it should not try start sound if not free slot
svn-id: r13641
-rw-r--r--scumm/imuse_digi/dimuse.h2
-rw-r--r--scumm/imuse_digi/dimuse_track.cpp11
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()) {