Hacks to make SMUSH mixer a bit more tollerable.

svn-id: r4429
This commit is contained in:
James Brown 2002-06-26 10:20:56 +00:00
parent 025925bbd4
commit 9ac3f92be1
2 changed files with 21 additions and 20 deletions

View File

@ -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;
}

View File

@ -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;
}