From 98194bfe1307a7dc5b75546fb17c447844d6d5f9 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 1 Jan 2010 19:23:23 +0000 Subject: SCI/new music code: The MIDI driver is now reset whenever the game's VM respawns, like what the old music code does. Fixes the MIDI music in KQ5CD, Lonbgow and perhaps others svn-id: r46843 --- engines/sci/engine/vm.cpp | 2 ++ engines/sci/sfx/music.cpp | 1 - engines/sci/sfx/soundcmd.cpp | 6 ++++++ engines/sci/sfx/soundcmd.h | 1 + 4 files changed, 9 insertions(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp index 504f70b7ed..9eb3b85981 100644 --- a/engines/sci/engine/vm.cpp +++ b/engines/sci/engine/vm.cpp @@ -1812,6 +1812,8 @@ static EngineState *_game_run(EngineState *&s, int restoring) { game_init(s); #ifdef USE_OLD_MUSIC_FUNCTIONS s->_sound.sfx_reset_player(); +#else + s->_soundCmd->resetDriver(); #endif _init_stack_base_with_selector(s, s->_kernel->_selectorCache.play); diff --git a/engines/sci/sfx/music.cpp b/engines/sci/sfx/music.cpp index 2287151a89..beba2699f8 100644 --- a/engines/sci/sfx/music.cpp +++ b/engines/sci/sfx/music.cpp @@ -163,7 +163,6 @@ void SciMusic::resetDriver() { _pMidiDrv->close(); _pMidiDrv->open(); _pMidiDrv->setTimerCallback(this, &miditimerCallback); - _dwTempo = _pMidiDrv->getBaseTempo(); } static int f_compare(const void *arg1, const void *arg2) { diff --git a/engines/sci/sfx/soundcmd.cpp b/engines/sci/sfx/soundcmd.cpp index 5ebbfb1206..b673af95aa 100644 --- a/engines/sci/sfx/soundcmd.cpp +++ b/engines/sci/sfx/soundcmd.cpp @@ -1010,4 +1010,10 @@ void SoundCommandParser::printPlayList(Console *con) { #endif } +void SoundCommandParser::resetDriver() { +#ifndef USE_OLD_MUSIC_FUNCTIONS + _music->resetDriver(); +#endif +} + } // End of namespace Sci diff --git a/engines/sci/sfx/soundcmd.h b/engines/sci/sfx/soundcmd.h index f241c2864b..04f1abc77e 100644 --- a/engines/sci/sfx/soundcmd.h +++ b/engines/sci/sfx/soundcmd.h @@ -58,6 +58,7 @@ public: void syncPlayList(Common::Serializer &s); void reconstructPlayList(int savegame_version); void printPlayList(Console *con); + void resetDriver(); #ifndef USE_OLD_MUSIC_FUNCTIONS /** -- cgit v1.2.3