From 0191738cce21fb874288d2d141b998731f5f5b96 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Mon, 15 May 2006 12:39:53 +0000 Subject: When receiving a "Reset All Controllers" message, the neutral position of the volume controller should probably be 127, not 100. Actually, there's some confusion as to whether this message should touch the volume controller at all. Added some comments to hopefully clarify that a bit. svn-id: r22478 --- engines/simon/midi.cpp | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'engines') diff --git a/engines/simon/midi.cpp b/engines/simon/midi.cpp index 108936d255..2a051d4c87 100644 --- a/engines/simon/midi.cpp +++ b/engines/simon/midi.cpp @@ -111,11 +111,17 @@ void MidiPlayer::send(uint32 b) { if (!_current->channel[b & 0x0F]) return; } else if ((b & 0xFFF0) == 0x79B0) { - // A minimum implementation of "All controllers off" should set - // the volume to 100. We have to make sure that volume is - // re-adjusted by the master volume afterwards. This happens in - // Simon 1, on eating the mushroom to turn back to normal size. - _current->volume[channel] = 100; + // "Reset All Controllers". There seems to be some confusion + // about what this message should do to the volume controller. + // See http://www.midi.org/about-midi/rp15.shtml for more + // information. + // + // If I understand it correctly, the current standard indicates + // that the volume should be reset, but the next revision will + // exclude it. On my system, both ALSA and FluidSynth seem to + // reset it, while Adlib does not. Let's follow the majority. + + _current->volume[channel] = 127; } if (!_current->channel[channel]) @@ -124,8 +130,15 @@ void MidiPlayer::send(uint32 b) { if (channel == 9) _current->channel[9]->volume(_current->volume[9] * _masterVolume / 255); _current->channel[channel]->send(b); - if ((b & 0xFFF0) == 0x79B0) + if ((b & 0xFFF0) == 0x79B0) { + // We have received a "Reset All Controllers" message + // and passed it on to the MIDI driver. This may or may + // not have affected the volume controller. To ensure + // consistent behaviour, explicitly set the volume to + // what we think it should be. + _current->channel[channel]->volume(_current->volume[channel] * _masterVolume / 255); + } } } -- cgit v1.2.3