aboutsummaryrefslogtreecommitdiff
path: root/engines/tinsel/music.cpp
diff options
context:
space:
mode:
authorFilippos Karapetis2012-07-15 17:37:55 +0300
committerFilippos Karapetis2012-07-15 17:37:55 +0300
commit1fffbe40ceb82bec77479c56176abeff0d2bd5e5 (patch)
treea40bd14a8296e89473589f4d7c3f511ce6a1793e /engines/tinsel/music.cpp
parent4c3b4835aae1fe671253a65f6a10649c5ab2014c (diff)
downloadscummvm-rg350-1fffbe40ceb82bec77479c56176abeff0d2bd5e5.tar.gz
scummvm-rg350-1fffbe40ceb82bec77479c56176abeff0d2bd5e5.tar.bz2
scummvm-rg350-1fffbe40ceb82bec77479c56176abeff0d2bd5e5.zip
TINSEL: Change SetMidiVolume() so that it doesn't start/stop music tracks
Previously, SetMidiVolume() would stop the currently playing track when the MIDI volume was set to 0. Now, the music track always plays, even when the volume is set to 0. This fixes bug #3541533 - "DW: Silencing music volume stops music" and resolves two FIXME comments
Diffstat (limited to 'engines/tinsel/music.cpp')
-rw-r--r--engines/tinsel/music.cpp44
1 files changed, 10 insertions, 34 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