aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--insane.cpp61
-rw-r--r--smush.h24
2 files changed, 54 insertions, 31 deletions
diff --git a/insane.cpp b/insane.cpp
index 8aba0b47b5..5b35f509c9 100644
--- a/insane.cpp
+++ b/insane.cpp
@@ -31,8 +31,6 @@
#include "scumm.h"
#include "smush.h"
-#define MAX_STREAMER 10
-
static SmushPlayer * h_sp;
SmushPlayer::SmushPlayer(Scumm * parent) {
@@ -597,14 +595,10 @@ void SmushPlayer::parseIACT() {
debug(3, "trk %d: iMUSE play part, len 0x%x rate %d remain 0x%x",
trk, bpos, _imusRate[idx], _imusSubSize[idx]);
- if (new_mixer) {
- g_mixer->play_stream(NULL, idx, buf, bpos, _imusRate[idx], flags);
- } else {
- g_mixer->append(idx, buf, bpos, _imusRate[idx], flags);
- }
-
- /* FIXME: append with re-used idx may cause problems
- with signed/unsigned issues */
+ _imusBuf[idx] = buf;
+ _imusFinalSize[idx] = bpos;
+ _imusFlags[idx] = flags;
+ _imusNewMixer[idx] = new_mixer;
break;
default:
@@ -1254,13 +1248,9 @@ void SmushPlayer::parsePSAD() { // FIXME: Needs to append to a sound buffer
debug(3, "trk %d: SDAT part len 0x%x rate %d", trk, sublen, _strkRate[idx]);
- if (new_mixer) {
- g_mixer->play_stream(NULL, idx, buf, sublen, _strkRate[idx],
- SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE);
- } else {
- g_mixer->append(idx, buf, sublen,
- _strkRate[idx], SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE);
- }
+ _strkBuf[idx] = buf;
+ _strkFinalSize[idx] = sublen;
+ _strkNewMixer[idx] = new_mixer;
break;
case 'SMRK':
_psadTrk[idx] = 0;
@@ -1377,7 +1367,7 @@ void SmushPlayer::init() {
loadTres();
loadFonts();
}
- _scumm->_timer->installProcedure(&smush_handler, 83);
+ _scumm->_timer->installProcedure(&smush_handler, 75);
}
void SmushPlayer::deinit() {
@@ -1423,6 +1413,7 @@ void SmushPlayer::update() {
void SmushPlayer::startVideo(short int arg, byte *videoFile) {
int32 frameIndex = 0;
+ int32 idx;
_in = NULL;
_paletteChanged = false;
@@ -1467,6 +1458,35 @@ void SmushPlayer::startVideo(short int arg, byte *videoFile) {
parseTag();
frameIndex++;
+ do {
+ _scumm->waitForTimer(1);
+ } while (_lock);
+ _lock = true;
+
+ if (_scumm->_gameId == GID_DIG) {
+ for (idx = 0; idx < MAX_STREAMER; idx++) {
+ if (_imusTrk[idx] != 0) {
+ if (_imusNewMixer[idx]) {
+ g_mixer->play_stream(NULL, idx, _imusBuf[idx], _imusFinalSize[idx], _imusRate[idx], _imusFlags[idx]);
+ } else {
+ g_mixer->append(idx, _imusBuf[idx], _imusFinalSize[idx], _imusRate[idx], _imusFlags[idx]);
+ }
+ }
+ }
+ }
+
+ if (_scumm->_gameId == GID_FT) {
+ for (idx = 0; idx < MAX_STREAMER; idx++) {
+ if (_psadTrk[idx] != 0) {
+ if (_strkNewMixer) {
+ g_mixer->play_stream(NULL, idx, _strkBuf[idx], _strkFinalSize[idx], _strkRate[idx], SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE);
+ } else {
+ g_mixer->append(idx, _strkBuf[idx], _strkFinalSize[idx], _strkRate[idx], SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE);
+ }
+ }
+ }
+ }
+
if (_paletteChanged) {
_paletteChanged = false;
setPalette();
@@ -1478,11 +1498,6 @@ void SmushPlayer::startVideo(short int arg, byte *videoFile) {
_scumm->_system->update_screen();
}
- do {
- _scumm->waitForTimer(10);
- } while (_lock);
- _lock = true;
-
_scumm->processKbd();
} while (!_scumm->videoFinished);
diff --git a/smush.h b/smush.h
index cb6b99d35d..1389a51b14 100644
--- a/smush.h
+++ b/smush.h
@@ -21,6 +21,7 @@
*/
#define SP_MAX_FONTS 5
+#define MAX_STREAMER 10
class SmushPlayer {
@@ -72,16 +73,23 @@ struct CodecData {
int32 _mixerNum;
// PSAD: Full Throttle audio
- uint32 _saudSize[8], _saudSubSize[8];
- uint32 _psadTrk[8], _strkRate[8];
- uint32 _saudSubTag[8];
+ uint32 _saudSize[MAX_STREAMER], _saudSubSize[MAX_STREAMER];
+ uint32 _psadTrk[MAX_STREAMER], _strkRate[MAX_STREAMER];
+ uint32 _saudSubTag[MAX_STREAMER];
+ uint32 _strkFinalSize[MAX_STREAMER];
+ bool _strkNewMixer[MAX_STREAMER];
+ byte * _strkBuf[MAX_STREAMER];
// IACT: The Dig audio
- uint32 _imusSize[8], _imusSubSize[8];
- uint32 _imusTrk[8], _imusRate[8], _imusChan[8];
- uint32 _imusSubTag[8];
- byte _imusData[8][3];
- uint32 _imusPos[8], _imusCodec[8];
+ uint32 _imusSize[MAX_STREAMER], _imusSubSize[MAX_STREAMER];
+ uint32 _imusTrk[MAX_STREAMER], _imusRate[MAX_STREAMER], _imusChan[MAX_STREAMER];
+ uint32 _imusSubTag[MAX_STREAMER];
+ byte _imusData[MAX_STREAMER][3];
+ uint32 _imusPos[MAX_STREAMER], _imusCodec[MAX_STREAMER];
+ uint32 _imusFinalSize[MAX_STREAMER];
+ byte _imusFlags[MAX_STREAMER];
+ byte * _imusBuf[MAX_STREAMER];
+ bool _imusNewMixer[MAX_STREAMER];
// Codec37
PersistentCodecData37 pcd37;