aboutsummaryrefslogtreecommitdiff
path: root/sound/mixer.cpp
diff options
context:
space:
mode:
authorJames Brown2002-04-22 08:16:16 +0000
committerJames Brown2002-04-22 08:16:16 +0000
commitd447f057094084f55b19a9806ce70a3ed44b96c6 (patch)
treeff83e720762c0353cca39182427f86f1e27f3996 /sound/mixer.cpp
parentd0d33166345bbe1d98d4e3b766af2b74713f0fc7 (diff)
downloadscummvm-rg350-d447f057094084f55b19a9806ce70a3ed44b96c6.tar.gz
scummvm-rg350-d447f057094084f55b19a9806ce70a3ed44b96c6.tar.bz2
scummvm-rg350-d447f057094084f55b19a9806ce70a3ed44b96c6.zip
Add voice channel tracking to stop script race in BumpusVille VR.
svn-id: r4048
Diffstat (limited to 'sound/mixer.cpp')
-rw-r--r--sound/mixer.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/sound/mixer.cpp b/sound/mixer.cpp
index ec8c0caae3..f27910d17d 100644
--- a/sound/mixer.cpp
+++ b/sound/mixer.cpp
@@ -38,24 +38,26 @@ void SoundMixer::uninsert(Channel *chan) {
error("SoundMixer::channel_deleted chan not found");
}
-void SoundMixer::insert(PlayingSoundHandle *handle, Channel *chan) {
+int SoundMixer::insert(PlayingSoundHandle *handle, Channel *chan) {
for(int i=0; i!=NUM_CHANNELS; i++) {
if (_channels[i] == NULL) {
_channels[i] = chan;
_handles[i] = handle;
if (handle)
*handle = i + 1;
- return;
+ return i;
}
}
warning("SoundMixer::insert out of mixer slots");
chan->destroy();
+
+ return -1;
}
-void SoundMixer::play_raw(PlayingSoundHandle *handle, void *sound, uint32 size, uint rate, byte flags) {
- insert(handle, new Channel_RAW(this, sound, size, rate, flags));
+int SoundMixer::play_raw(PlayingSoundHandle *handle, void *sound, uint32 size, uint rate, byte flags) {
+ return insert(handle, new Channel_RAW(this, sound, size, rate, flags));
}
#ifdef COMPRESSED_SOUND_FILE
@@ -202,8 +204,9 @@ void SoundMixer::Channel_RAW::mix(int16 *data, uint len) {
free(s_org);
}
- if (!_size)
+ if (_size < 1)
destroy();
+
}
void SoundMixer::Channel_RAW::destroy() {