diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/tinsel/music.cpp | 44 | ||||
-rw-r--r-- | engines/tinsel/tinlib.cpp | 21 |
2 files changed, 16 insertions, 49 deletions
diff --git a/engines/tinsel/music.cpp b/engines/tinsel/music.cpp index 637e043e11..b3bfbcc5dc 100644 --- a/engines/tinsel/music.cpp +++ b/engines/tinsel/music.cpp @@ -131,13 +131,11 @@ bool PlayMidiSequence(uint32 dwFileOffset, bool bLoop) { g_currentMidi = dwFileOffset; g_currentLoop = bLoop; - if (_vm->_config->_musicVolume != 0) { - bool mute = false; - if (ConfMan.hasKey("mute")) - mute = ConfMan.getBool("mute"); + bool mute = false; + if (ConfMan.hasKey("mute")) + mute = ConfMan.getBool("mute"); - SetMidiVolume(mute ? 0 : _vm->_config->_musicVolume); - } + SetMidiVolume(mute ? 0 : _vm->_config->_musicVolume); // the index and length of the last tune loaded uint32 dwSeqLen = 0; // length of the sequence @@ -270,27 +268,7 @@ int GetMidiVolume() { */ void SetMidiVolume(int vol) { assert(vol >= 0 && vol <= Audio::Mixer::kMaxChannelVolume); - - static int priorVolMusic = 0; // FIXME: Avoid non-const global vars - - if (vol == 0 && priorVolMusic == 0) { - // Nothing to do - } else if (vol == 0 && priorVolMusic != 0) { - // Stop current midi sequence - StopMidi(); - _vm->_midiMusic->setVolume(vol); - } else if (vol != 0 && priorVolMusic == 0) { - // Perhaps restart last midi sequence - if (g_currentLoop) - PlayMidiSequence(g_currentMidi, true); - - _vm->_midiMusic->setVolume(vol); - } else if (vol != 0 && priorVolMusic != 0) { - // Alter current volume - _vm->_midiMusic->setVolume(vol); - } - - priorVolMusic = vol; + _vm->_midiMusic->setVolume(vol); } /** @@ -933,14 +911,12 @@ void RestoreMidiFacts(SCNHANDLE Midi, bool Loop) { g_currentMidi = Midi; g_currentLoop = Loop; - if (_vm->_config->_musicVolume != 0 && Loop) { - bool mute = false; - if (ConfMan.hasKey("mute")) - mute = ConfMan.getBool("mute"); + bool mute = false; + if (ConfMan.hasKey("mute")) + mute = ConfMan.getBool("mute"); - PlayMidiSequence(g_currentMidi, true); - SetMidiVolume(mute ? 0 : _vm->_config->_musicVolume); - } + PlayMidiSequence(g_currentMidi, true); + SetMidiVolume(mute ? 0 : _vm->_config->_musicVolume); } #if 0 diff --git a/engines/tinsel/tinlib.cpp b/engines/tinsel/tinlib.cpp index 7c4fec6592..058f8eb6fd 100644 --- a/engines/tinsel/tinlib.cpp +++ b/engines/tinsel/tinlib.cpp @@ -1625,10 +1625,6 @@ static void Play(CORO_PARAM, SCNHANDLE hFilm, int x, int y, bool bComplete, int * Play a midi file. */ static void PlayMidi(CORO_PARAM, SCNHANDLE hMidi, int loop, bool complete) { - // FIXME: This is a workaround for the FIXME below - if (GetMidiVolume() == 0) - return; - CORO_BEGIN_CONTEXT; CORO_END_CONTEXT(_ctx); @@ -1637,18 +1633,13 @@ static void PlayMidi(CORO_PARAM, SCNHANDLE hMidi, int loop, bool complete) { PlayMidiSequence(hMidi, loop == MIDI_LOOP); - // FIXME: The following check messes up the script arguments when - // entering the secret door in the bookshelf in the library, - // leading to a crash, when the music volume is set to 0 (MidiPlaying() - // always false then). - // - // Why exactly this happens is unclear. An analysis of the involved - // script(s) might reveal more. - // - // Note: This check&sleep was added in DW v2. It was most likely added - // to ensure that the MIDI song started playing before the next opcode + // This check&sleep was added in DW v2. It was most likely added to + // ensure that the MIDI song started playing before the next opcode // is executed. - if (!MidiPlaying()) + // In DW1, it messes up the script arguments when entering the secret + // door in the bookshelf in the library, leading to a crash, when the + // music volume is set to 0. + if (!MidiPlaying() && TinselV2) CORO_SLEEP(1); if (complete) { |