From 9ac3f92be1abeed35ca7e76bc072a8517d88b399 Mon Sep 17 00:00:00 2001 From: James Brown Date: Wed, 26 Jun 2002 10:20:56 +0000 Subject: Hacks to make SMUSH mixer a bit more tollerable. svn-id: r4429 --- insane.cpp | 23 ++++++++++------------- sound/mixer.cpp | 18 +++++++++++------- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/insane.cpp b/insane.cpp index 067b5a566b..475f299583 100644 --- a/insane.cpp +++ b/insane.cpp @@ -28,6 +28,7 @@ #include "scumm.h" #define SWAP2(a) ((((a)>>24)&0xFF) | (((a)>>8)&0xFF00) | (((a)<<8)&0xFF0000) | (((a)<<24)&0xFF000000)) +#define MAX_STREAMER 10 void invalidblock(uint32 tag) { @@ -144,15 +145,13 @@ void SmushPlayer::parseIACT() { trk = READ_LE_UINT32(_cur + pos); /* FIXME: is this correct ? */ pos += 4; - /* FIXME: number 8 should be replaced with a sensible literal */ - - for (idx = 0; idx < 8; idx++) { + for (idx = 0; idx < MAX_STREAMER; idx++) { if (_imusTrk[idx] == trk) break; } - if (idx == 8) { - for (idx = 0; idx < 8; idx++) { + if (idx == MAX_STREAMER) { + for (idx = 0; idx < MAX_STREAMER; idx++) { if (_imusTrk[idx] == 0 && g_scumm->_mixer->_channels[idx] == NULL) { _imusTrk[idx] = trk; @@ -163,8 +162,8 @@ void SmushPlayer::parseIACT() { } } - if (idx == 8) { - warning("iMUS table full "); + if (idx == MAX_STREAMER) { + warning("iMUS table full"); return; } @@ -797,15 +796,13 @@ void SmushPlayer::parsePSAD() // FIXME: Needs to append to trk = READ_LE_UINT16(_cur + pos); /* FIXME: is this correct ? */ pos += 2; - /* FIXME: number 8 should be replaced with a sensible literal */ - - for (idx = 0; idx < 8; idx++) { + for (idx = 0; idx < MAX_STREAMER; idx++) { if (_psadTrk[idx] == trk) break; } - if (idx == 8) { - for (idx = 0; idx < 8; idx++) { + if (idx == MAX_STREAMER) { + for (idx = 0; idx < MAX_STREAMER; idx++) { if (_psadTrk[idx] == 0 && g_scumm->_mixer->_channels[idx] == NULL) { _psadTrk[idx] = trk; @@ -816,7 +813,7 @@ void SmushPlayer::parsePSAD() // FIXME: Needs to append to } } - if (idx == 8) { + if (idx == MAX_STREAMER) { warning("PSAD table full\n"); return; } diff --git a/sound/mixer.cpp b/sound/mixer.cpp index 0fbaf627e6..115ca37fb8 100644 --- a/sound/mixer.cpp +++ b/sound/mixer.cpp @@ -459,13 +459,17 @@ void SoundMixer::Channel_STREAM::mix(int16 *data, uint len) { mixer_helper_table[_flags & 0x07](data, &len, &_pos, &fp_pos, fp_speed, vol_tab, _ptr + _buffer_size); if (len != 0) { _pos = _ptr; - mixer_helper_table[_flags & 0x07](data, &len, &_pos, &fp_pos, fp_speed, vol_tab, end_of_data); - } - } - if (len != 0) { - warning("Streaming underflow "); - real_destroy(); - return; + mixer_helper_table[_flags & 0x07](data, &len, &_pos, &fp_pos, fp_speed, vol_tab, end_of_data); + } else + _to_be_destroyed = true; + } + if (len != 0) { + // FIXME: BBrox, what does this mean? :) + // Commented by Ender to remove non-existant + // streamer bug in Dig smush movies. + //warning("Streaming underflow of %d bytes", len); + //real_destroy(); + //return; } _fp_pos = fp_pos; } -- cgit v1.2.3