From de348d6fa8bf41ad30f2b85357cd4d20ad64f3e9 Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Fri, 5 Jun 2009 00:57:58 +0000 Subject: Update sound code in HE80+ games, for sound rate differences. svn-id: r41185 --- engines/scumm/he/sound_he.cpp | 10 ++++++++-- engines/scumm/he/sound_he.h | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'engines/scumm/he') diff --git a/engines/scumm/he/sound_he.cpp b/engines/scumm/he/sound_he.cpp index c5a8988edb..67248f4c22 100644 --- a/engines/scumm/he/sound_he.cpp +++ b/engines/scumm/he/sound_he.cpp @@ -158,6 +158,7 @@ void SoundHE::stopSound(int sound) { if (_heChannel[i].sound == sound) { _heChannel[i].sound = 0; _heChannel[i].priority = 0; + _heChannel[i].rate = 0; _heChannel[i].timer = 0; _heChannel[i].sbngBlock = 0; _heChannel[i].codeOffs = 0; @@ -196,6 +197,7 @@ void SoundHE::stopSoundChannel(int chan) { _heChannel[chan].sound = 0; _heChannel[chan].priority = 0; + _heChannel[chan].rate = 0; _heChannel[chan].timer = 0; _heChannel[chan].sbngBlock = 0; _heChannel[chan].codeOffs = 0; @@ -254,7 +256,7 @@ int SoundHE::getSoundPos(int sound) { } if (_mixer->isSoundHandleActive(_heSoundChannels[chan]) && chan != -1) { - int time = _vm->getHETimer(chan + 4) * 11025 / 1000; + int time = _vm->getHETimer(chan + 4) * _heChannel[chan].rate / 1000; return time; } else { return 0; @@ -360,7 +362,7 @@ void SoundHE::processSoundCode() { continue; } - tmr = _vm->getHETimer(chan + 4) * 11025 / 1000; + tmr = _vm->getHETimer(chan + 4) * _heChannel[chan].rate / 1000; tmr += _vm->VAR(_vm->VAR_SOUNDCODE_TMR); if (tmr < 0) tmr = 0; @@ -407,6 +409,7 @@ void SoundHE::processSoundCode() { _heChannel[chan].sound = 0; _heChannel[chan].priority = 0; + _heChannel[chan].rate = 0; _heChannel[chan].timer = 0; _heChannel[chan].sbngBlock = 0; _heChannel[chan].codeOffs = 0; @@ -625,6 +628,7 @@ void SoundHE::playHESound(int soundID, int heOffset, int heChannel, int heFlags) _vm->setHETimer(heChannel + 4); _heChannel[heChannel].sound = soundID; _heChannel[heChannel].priority = priority; + _heChannel[heChannel].rate = rate; _heChannel[heChannel].sbngBlock = (codeOffs != -1) ? 1 : 0; _heChannel[heChannel].codeOffs = codeOffs; memset(_heChannel[heChannel].soundVars, 0, sizeof(_heChannel[heChannel].soundVars)); @@ -646,6 +650,7 @@ void SoundHE::playHESound(int soundID, int heOffset, int heChannel, int heFlags) size *= 2; // 16bits. delete voxStream; + _heChannel[heChannel].rate = rate; if (_heChannel[heChannel].timer) _heChannel[heChannel].timer = size * 1000 / rate; @@ -696,6 +701,7 @@ void SoundHE::playHESound(int soundID, int heOffset, int heChannel, int heFlags) _vm->setHETimer(heChannel + 4); _heChannel[heChannel].sound = soundID; _heChannel[heChannel].priority = priority; + _heChannel[heChannel].rate = rate; _heChannel[heChannel].sbngBlock = (codeOffs != -1) ? 1 : 0; _heChannel[heChannel].codeOffs = codeOffs; memset(_heChannel[heChannel].soundVars, 0, sizeof(_heChannel[heChannel].soundVars)); diff --git a/engines/scumm/he/sound_he.h b/engines/scumm/he/sound_he.h index 47ff145e6b..f3a881972e 100644 --- a/engines/scumm/he/sound_he.h +++ b/engines/scumm/he/sound_he.h @@ -53,6 +53,7 @@ public: // Used by createSound() int sound; int codeOffs; int priority; + int rate; int timer; int sbngBlock; int soundVars[27]; -- cgit v1.2.3