diff options
-rw-r--r-- | engines/scumm/he/sound_he.cpp | 19 | ||||
-rw-r--r-- | engines/scumm/sound.cpp | 8 | ||||
-rw-r--r-- | engines/scumm/sound.h | 1 |
3 files changed, 21 insertions, 7 deletions
diff --git a/engines/scumm/he/sound_he.cpp b/engines/scumm/he/sound_he.cpp index 879e34a99e..65a67216df 100644 --- a/engines/scumm/he/sound_he.cpp +++ b/engines/scumm/he/sound_he.cpp @@ -44,6 +44,25 @@ namespace Scumm { +void Sound::stopSoundChannel(int chan) { + _vm->_mixer->stopHandle(_heSoundChannels[chan]); + + _heChannel[chan].sound = 0; + _heChannel[chan].priority = 0; + _heChannel[chan].sbngBlock = 0; + _heChannel[chan].codeOffs = 0; + memset(_heChannel[chan].soundVars, 0, sizeof(_heChannel[chan].soundVars)); + + for (int i = 0; i < ARRAYSIZE(_soundQue2); i++) { + if (_soundQue2[i].channel == chan) { + _soundQue2[i].sound = 0; + _soundQue2[i].offset = 0; + _soundQue2[i].channel = 0; + _soundQue2[i].flags = 0; + } + } +} + int Sound::findFreeSoundChannel() { int chan, min; diff --git a/engines/scumm/sound.cpp b/engines/scumm/sound.cpp index 26f0c712c8..9be09e7b38 100644 --- a/engines/scumm/sound.cpp +++ b/engines/scumm/sound.cpp @@ -821,13 +821,7 @@ void Sound::stopSound(int sound) { if (_vm->_heversion >= 70) { if ( sound >= 10000) { - int chan = sound - 10000; - _vm->_mixer->stopHandle(_heSoundChannels[chan]); - _heChannel[chan].sound = 0; - _heChannel[chan].priority = 0; - _heChannel[chan].sbngBlock = 0; - _heChannel[chan].codeOffs = 0; - memset(_heChannel[chan].soundVars, 0, sizeof(_heChannel[chan].soundVars)); + stopSoundChannel(sound - 10000); } } else if (_vm->_heversion >= 60) { if (sound == -2) { diff --git a/engines/scumm/sound.h b/engines/scumm/sound.h index 0b913fe7e3..7e365e576e 100644 --- a/engines/scumm/sound.h +++ b/engines/scumm/sound.h @@ -155,6 +155,7 @@ public: void setOverrideFreq(int freq); void setupHEMusicFile(); void startHETalkSound(uint32 offset); + void stopSoundChannel(int chan); // Used by the save/load system: void saveLoadWithSerializer(Serializer *ser); |