diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/scumm/imuse/imuse_internal.h | 1 | ||||
-rw-r--r-- | engines/scumm/imuse/imuse_part.cpp | 41 |
2 files changed, 38 insertions, 4 deletions
diff --git a/engines/scumm/imuse/imuse_internal.h b/engines/scumm/imuse/imuse_internal.h index 2efeda2798..53c2f3caf5 100644 --- a/engines/scumm/imuse/imuse_internal.h +++ b/engines/scumm/imuse/imuse_internal.h @@ -370,6 +370,7 @@ struct Part : public Serializable { private: void setPanPosition(uint8 value); + void setEffectLevel(uint8 value); }; diff --git a/engines/scumm/imuse/imuse_part.cpp b/engines/scumm/imuse/imuse_part.cpp index 35deddcbd6..6c0f67c91f 100644 --- a/engines/scumm/imuse/imuse_part.cpp +++ b/engines/scumm/imuse/imuse_part.cpp @@ -165,8 +165,7 @@ void Part::chorusLevel(byte value) { void Part::effectLevel(byte value) { _effect_level = value; - if (_mc) - _mc->effectLevel(value); + setEffectLevel(value); } void Part::fix_after_load() { @@ -286,7 +285,7 @@ void Part::setup(Player *player) { _detune_eff = player->getDetune(); _pitchbend_factor = 2; _pitchbend = 0; - _effect_level = 64; + _effect_level = player->_se->isNativeMT32() ? 127 : 64; _instrument.clear(); _unassigned_instrument = true; _chorus = 0; @@ -323,15 +322,21 @@ bool Part::clearToTransmit() { void Part::sendAll() { if (!clearToTransmit()) return; + _mc->pitchBendFactor(_pitchbend_factor); sendPitchBend(); _mc->volume(_vol_eff); _mc->sustain(_pedal); _mc->modulationWheel(_modwheel); setPanPosition(_pan_eff + 0x40); - _mc->effectLevel(_effect_level); + if (_instrument.isValid()) _instrument.send(_mc); + + // We need to send the effect level after setting up the instrument + // otherwise the reverb setting for MT-32 will be overwritten. + setEffectLevel(_effect_level); + _mc->chorusLevel(_chorus); _mc->priority(_pri_eff); } @@ -380,4 +385,32 @@ void Part::setPanPosition(uint8 value) { _mc->panPosition(value); } +void Part::setEffectLevel(uint8 value) { + if (!_mc) + return; + + // As described in bug report #1088045 "MI2: Minor problems in native MT-32 mode" + // for the MT-32 one has to use a sysEx event to change the effect level (rather + // the reverb setting). + if (_player->_se->isNativeMT32()) { + if (value != 127 && value != 0) { + warning("Trying to use unsupported effect level value %d in native MT-32 mode. Please report this!", value); + + if (value > 64) + value = 127; + else + value = 0; + } + + byte message[9]; + memcpy(message, "\x41\x00\x16\x12\x00\x00\x06\x00\x00", 9); + message[1] = _mc->getNumber(); + message[7] = (value == 127) ? 1 : 0; + message[8] = 128 - (6 + message[7]); + _player->getMidiDriver()->sysEx(message, 9); + } else { + _mc->effectLevel(value); + } +} + } // End of namespace Scumm |