aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTravis Howell2006-02-16 05:52:39 +0000
committerTravis Howell2006-02-16 05:52:39 +0000
commite77fc9b9aa245fd0ff1ea19cd0bb510958aa93b6 (patch)
treef34113e72b1944f089bc3b8ebac56765c7548239
parent54babe81ceece041ccf1b15adb9696ace55788a7 (diff)
downloadscummvm-rg350-e77fc9b9aa245fd0ff1ea19cd0bb510958aa93b6.tar.gz
scummvm-rg350-e77fc9b9aa245fd0ff1ea19cd0bb510958aa93b6.tar.bz2
scummvm-rg350-e77fc9b9aa245fd0ff1ea19cd0bb510958aa93b6.zip
Clear sound queue when stopping sound channel in HE games
svn-id: r20718
-rw-r--r--engines/scumm/he/sound_he.cpp19
-rw-r--r--engines/scumm/sound.cpp8
-rw-r--r--engines/scumm/sound.h1
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);