aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm/he/sound_he.cpp
diff options
context:
space:
mode:
authorTravis Howell2006-07-09 05:47:17 +0000
committerTravis Howell2006-07-09 05:47:17 +0000
commitb3f2d299fef43460f9297c28c37d2749fdd2712a (patch)
treea86486b24fc850cfe5d1f757aa50f2c3032fb4db /engines/scumm/he/sound_he.cpp
parent36f90314358f9af016be4d39e65094447f9936ae (diff)
downloadscummvm-rg350-b3f2d299fef43460f9297c28c37d2749fdd2712a.tar.gz
scummvm-rg350-b3f2d299fef43460f9297c28c37d2749fdd2712a.tar.bz2
scummvm-rg350-b3f2d299fef43460f9297c28c37d2749fdd2712a.zip
HE80+ games ignore subtitle speed, due to sound code been used. Fixes glitches that can occur, when slow subtitle speed is set in HE80+ games.
svn-id: r23447
Diffstat (limited to 'engines/scumm/he/sound_he.cpp')
-rw-r--r--engines/scumm/he/sound_he.cpp39
1 files changed, 33 insertions, 6 deletions
diff --git a/engines/scumm/he/sound_he.cpp b/engines/scumm/he/sound_he.cpp
index 9a039b0008..1a2dd25e86 100644
--- a/engines/scumm/he/sound_he.cpp
+++ b/engines/scumm/he/sound_he.cpp
@@ -154,6 +154,7 @@ void SoundHE::stopSound(int sound) {
if (_heChannel[i].sound == sound) {
_heChannel[i].sound = 0;
_heChannel[i].priority = 0;
+ _heChannel[i].timer = 0;
_heChannel[i].sbngBlock = 0;
_heChannel[i].codeOffs = 0;
memset(_heChannel[i].soundVars, 0, sizeof(_heChannel[i].soundVars));
@@ -191,6 +192,7 @@ void SoundHE::stopSoundChannel(int chan) {
_heChannel[chan].sound = 0;
_heChannel[chan].priority = 0;
+ _heChannel[chan].timer = 0;
_heChannel[chan].sbngBlock = 0;
_heChannel[chan].codeOffs = 0;
memset(_heChannel[chan].soundVars, 0, sizeof(_heChannel[chan].soundVars));
@@ -386,6 +388,27 @@ void SoundHE::processSoundCode() {
_heChannel[chan].codeOffs += size;
}
}
+
+ for (chan = 0; chan < ARRAYSIZE(_heChannel); chan++) {
+ if (_heChannel[chan].sound == 0)
+ continue;
+
+ if (_heChannel[chan].timer == 0)
+ continue;
+
+ if (_vm->getHETimer(chan + 4) > _heChannel[chan].timer) {
+ if (_heChannel[chan].sound == 1) {
+ _vm->stopTalk();
+ }
+
+ _heChannel[chan].sound = 0;
+ _heChannel[chan].priority = 0;
+ _heChannel[chan].timer = 0;
+ _heChannel[chan].sbngBlock = 0;
+ _heChannel[chan].codeOffs = 0;
+ _heChannel[chan].soundVars[0] = 0;
+ }
+ }
}
void SoundHE::processSoundOpcodes(int sound, byte *codePtr, int *soundVars) {
@@ -602,20 +625,24 @@ void SoundHE::playHESound(int soundID, int heOffset, int heChannel, int heFlags)
_overrideFreq = 0;
}
+ _vm->setHETimer(heChannel + 4);
+ _heChannel[heChannel].sound = soundID;
+ _heChannel[heChannel].priority = priority;
+ _heChannel[heChannel].sbngBlock = (codeOffs != -1) ? 1 : 0;
+ _heChannel[heChannel].codeOffs = codeOffs;
+ memset(_heChannel[heChannel].soundVars, 0, sizeof(_heChannel[heChannel].soundVars));
+
// TODO: Extra sound flags
if (heFlags & 1) {
flags |= Audio::Mixer::FLAG_LOOP;
+ _heChannel[heChannel].timer = 0;
+ } else {
+ _heChannel[heChannel].timer = size * 1000 / rate;
}
_vm->_mixer->stopHandle(_heSoundChannels[heChannel]);
_vm->_mixer->playRaw(&_heSoundChannels[heChannel], ptr + heOffset + 8, size, rate, flags, soundID, 255, 0, 0,0, type);
- _vm->setHETimer(heChannel + 4);
- _heChannel[heChannel].sound = soundID;
- _heChannel[heChannel].priority = priority;
- _heChannel[heChannel].sbngBlock = (codeOffs != -1) ? 1 : 0;
- _heChannel[heChannel].codeOffs = codeOffs;
- memset(_heChannel[heChannel].soundVars, 0, sizeof(_heChannel[heChannel].soundVars));
}
// Support for PCM music in 3DO versions of Humongous Entertainment games
else if (READ_BE_UINT32(ptr) == MKID_BE('MRAW')) {