From 8d25c558910c1a2e14c32ace568121ab8c643b70 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sun, 21 Apr 2013 12:54:19 +0200 Subject: KYRA: Fix MIDI fade-out behaviour There are two ways that the music volume may be set: The setSourceVolume() specifies the current music volume, as ScummVM sees it. This is stored in _sources[].volume. The MIDI data itself can trigger volume events. These are handled by send(), which stores the volume - usually (always?) 100 - in _sources[_curSource].controllers[]. The volume is then adjusted by _sources[].volume. When music is faded out, setSourceVolume() is called repeatedly with progressively smaller values for the volume. What it should do, then, is to make sure that the volume is set to what was previously set to in send(), adjusted to the fading volume. At least, that's how I understand it. --- engines/kyra/sound_midi.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/kyra') diff --git a/engines/kyra/sound_midi.cpp b/engines/kyra/sound_midi.cpp index b93b42fa9c..fc6e92abd9 100644 --- a/engines/kyra/sound_midi.cpp +++ b/engines/kyra/sound_midi.cpp @@ -323,7 +323,7 @@ void MidiOutput::setSourceVolume(int source, int volume, bool apply) { for (int i = 0; i < 16; ++i) { // Controller 0 in the state table should always be '7' aka // volume control - byte realVol = (_channels[i].controllers[0].value * volume) >> 8; + byte realVol = (_sources[source].controllers[i][0].value * volume) >> 8; sendIntern(0xB0, i, 0x07, realVol); } } -- cgit v1.2.3