diff options
author | Johannes Schickel | 2008-11-30 15:15:14 +0000 |
---|---|---|
committer | Johannes Schickel | 2008-11-30 15:15:14 +0000 |
commit | c517045349f675c3f28f7860ad8dcfe53ad69677 (patch) | |
tree | e727dae67c01c7f9d0a5c8666502aacf683f85c6 /engines | |
parent | b12ebf721826767a3de11923ba606639a8bb7411 (diff) | |
download | scummvm-rg350-c517045349f675c3f28f7860ad8dcfe53ad69677.tar.gz scummvm-rg350-c517045349f675c3f28f7860ad8dcfe53ad69677.tar.bz2 scummvm-rg350-c517045349f675c3f28f7860ad8dcfe53ad69677.zip |
Fixed some looping MIDI sound effects.
svn-id: r35193
Diffstat (limited to 'engines')
-rw-r--r-- | engines/kyra/scene_hof.cpp | 3 | ||||
-rw-r--r-- | engines/kyra/scene_lok.cpp | 3 | ||||
-rw-r--r-- | engines/kyra/sound.h | 6 | ||||
-rw-r--r-- | engines/kyra/sound_midi.cpp | 10 |
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); |