aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/kyra/scene_hof.cpp3
-rw-r--r--engines/kyra/scene_lok.cpp3
-rw-r--r--engines/kyra/sound.h6
-rw-r--r--engines/kyra/sound_midi.cpp10
4 files changed, 22 insertions, 0 deletions
diff --git a/engines/kyra/scene_hof.cpp b/engines/kyra/scene_hof.cpp
index 4785b039d7..b6c25a46c7 100644
--- a/engines/kyra/scene_hof.cpp
+++ b/engines/kyra/scene_hof.cpp
@@ -81,6 +81,9 @@ void KyraEngine_HoF::enterNewScene(uint16 newScene, int facing, int unk1, int un
moveCharacter(facing, x, y);
}
+ // TODO: Check how the original handled sfx still playing
+ _sound->stopAllSoundEffects();
+
bool newSoundFile = false;
uint32 waitTime = 0;
if (_sceneList[newScene].sound != _lastMusicCommand) {
diff --git a/engines/kyra/scene_lok.cpp b/engines/kyra/scene_lok.cpp
index 53c269a926..b3b830faed 100644
--- a/engines/kyra/scene_lok.cpp
+++ b/engines/kyra/scene_lok.cpp
@@ -48,6 +48,9 @@ void KyraEngine_LoK::enterNewScene(int sceneId, int facing, int unk1, int unk2,
_abortWalkFlag = false;
_abortWalkFlag2 = false;
+ // TODO: Check how the original handled sfx still playing
+ _sound->stopAllSoundEffects();
+
if (_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98) {
int newSfxFile = -1;
if (_currentCharacter->sceneId == 7 && sceneId == 24)
diff --git a/engines/kyra/sound.h b/engines/kyra/sound.h
index 84aebcf363..cfffcbdbe5 100644
--- a/engines/kyra/sound.h
+++ b/engines/kyra/sound.h
@@ -151,6 +151,11 @@ public:
virtual void playSoundEffect(uint8 track) = 0;
/**
+ * Stop playback of all sfx tracks.
+ */
+ virtual void stopAllSoundEffects() {}
+
+ /**
* Checks if the sound driver plays any sound.
*
* @return true if playing, false otherwise
@@ -334,6 +339,7 @@ public:
bool isPlaying();
void playSoundEffect(uint8 track);
+ void stopAllSoundEffects();
void beginFadeOut();
diff --git a/engines/kyra/sound_midi.cpp b/engines/kyra/sound_midi.cpp
index 1ba8e79d18..1cff57d93a 100644
--- a/engines/kyra/sound_midi.cpp
+++ b/engines/kyra/sound_midi.cpp
@@ -639,6 +639,16 @@ void SoundMidiPC::playSoundEffect(uint8 track) {
}
}
+void SoundMidiPC::stopAllSoundEffects() {
+ Common::StackLock lock(_mutex);
+
+ for (int i = 0; i < 3; ++i) {
+ _output->setSoundSource(i+1);
+ _sfx[i]->stopPlaying();
+ _output->deinitSource(i+1);
+ }
+}
+
void SoundMidiPC::beginFadeOut() {
Common::StackLock lock(_mutex);