From 7c831c9c4c555db5d9a39d0d9abeed075a58a5fd Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 12 Apr 2005 22:41:25 +0000 Subject: Patch #1180882 "GM/GS Percussion Remapping" svn-id: r17569 --- scumm/imuse.cpp | 10 ++++++++-- scumm/instrument.cpp | 9 +++++++++ scumm/instrument.h | 1 + 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/scumm/imuse.cpp b/scumm/imuse.cpp index f4492acd45..2f12865ff1 100644 --- a/scumm/imuse.cpp +++ b/scumm/imuse.cpp @@ -1531,8 +1531,14 @@ void Part::noteOn(byte note, byte velocity) { mc = _player->getMidiDriver()->getPercussionChannel(); if (!mc) return; - mc->volume(_vol_eff); -// mc->programChange(_bank); + static byte prev_vol_eff = 128; + if (_vol_eff != prev_vol_eff){ + mc->volume(_vol_eff); + prev_vol_eff = _vol_eff; + } + if ((note < 35) && (!_player->_se->isNativeMT32())) + note = Instrument::_gmRhythmMap[note]; + mc->noteOn(note, velocity); } } diff --git a/scumm/instrument.cpp b/scumm/instrument.cpp index 03145cb6d9..e2d78d815c 100644 --- a/scumm/instrument.cpp +++ b/scumm/instrument.cpp @@ -114,6 +114,15 @@ roland_to_gm_map [] = { // { "trickle4 ", ??? } }; +const byte Instrument::_gmRhythmMap[35] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 36, 37, 38, 39, 40, 41, 66, 47, + 65, 48, 56}; + // This emulates the percussion bank setup LEC used with the MT-32, + // where notes 24 - 34 were assigned instruments without reverb. + // It also fixes problems on GS devices that map sounds to these + // notes by default. + class Instrument_Program : public InstrumentInternal { private: byte _program; diff --git a/scumm/instrument.h b/scumm/instrument.h index 1d8c84a5d2..b51160f418 100644 --- a/scumm/instrument.h +++ b/scumm/instrument.h @@ -57,6 +57,7 @@ public: Instrument() : _type (0), _instrument (0) { } ~Instrument() { delete _instrument; } static void nativeMT32 (bool native); + static const byte _gmRhythmMap[35]; void clear(); void copy_to (Instrument *dest) { if (_instrument) _instrument->copy_to (dest); else dest->clear(); } -- cgit v1.2.3