diff options
author | Jamieson Christian | 2003-10-01 15:19:12 +0000 |
---|---|---|
committer | Jamieson Christian | 2003-10-01 15:19:12 +0000 |
commit | b75a9256409f6067798ff1657df3dc42682770ca (patch) | |
tree | 1633f1aa22445aefb1523e294fe69a1bf12a0630 /scumm | |
parent | 745497dea4cc3d0698d48338c4c7f06eac6769c3 (diff) | |
download | scummvm-rg350-b75a9256409f6067798ff1657df3dc42682770ca.tar.gz scummvm-rg350-b75a9256409f6067798ff1657df3dc42682770ca.tar.bz2 scummvm-rg350-b75a9256409f6067798ff1657df3dc42682770ca.zip |
Fix for Bug [812737] ALL: pitchbend range with MT32
Manual scaling of pitchbends to account for the fact that the
MT32 doesn't respond to RPN-based pitchbend range adjustments.
Also tweaked the MT32 partial reserve settings per Bug [812740].
svn-id: r10521
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/imuse.cpp | 37 | ||||
-rw-r--r-- | scumm/imuse_internal.h | 2 |
2 files changed, 20 insertions, 19 deletions
diff --git a/scumm/imuse.cpp b/scumm/imuse.cpp index 2d6b1fd942..facc28ffb7 100644 --- a/scumm/imuse.cpp +++ b/scumm/imuse.cpp @@ -1204,7 +1204,7 @@ void IMuseInternal::initMT32(MidiDriver *midi) { g_system->delay_msecs (500); // Set partial reserve equally for all channels - memcpy(&buffer[4], "\x10\x00\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x48", 13); + memcpy(&buffer[4], "\x10\x00\x04\x04\x04\x04\x04\x04\x04\x04\x04\x00\x4C", 13); midi->sysEx(buffer, 17); } @@ -1429,20 +1429,14 @@ void IMuseInternal::fix_players_after_load(Scumm *scumm) { void Part::set_detune(int8 detune) { _detune_eff = clamp((_detune = detune) + _player->getDetune(), -128, 127); - if (_mc) { - _mc->pitchBend(clamp(_pitchbend + - (_detune_eff * 64 / 12) + - (_transpose_eff * 8192 / 12), -8192, 8191)); - } + if (_mc) + sendPitchBend(); } void Part::pitchBend(int16 value) { _pitchbend = value; - if (_mc) { - _mc->pitchBend(clamp(_pitchbend + - (_detune_eff * 64 / 12) + - (_transpose_eff * 8192 / 12), -8192, 8191)); - } + if (_mc) + sendPitchBend(); } void Part::volume (byte value) { @@ -1465,11 +1459,8 @@ void Part::set_pan(int8 pan) { void Part::set_transpose(int8 transpose) { _transpose_eff = transpose_clamp((_transpose = transpose) + _player->getTranspose(), -24, 24); - if (_mc) { - _mc->pitchBend(clamp(_pitchbend + - (_detune_eff * /*64*/82 / _pitchbend_factor) + - (_transpose_eff * 8192 / _pitchbend_factor), -8192, 8191)); - } + if (_mc) + sendPitchBend(); } void Part::sustain(bool value) { @@ -1636,9 +1627,7 @@ bool Part::clearToTransmit() { void Part::sendAll() { if (!clearToTransmit()) return; _mc->pitchBendFactor(_pitchbend_factor); - _mc->pitchBend(clamp(_pitchbend + - (_detune_eff * 64 / 12) + - (_transpose_eff * 8192 / 12), -8192, 8191)); + sendPitchBend(); _mc->volume(_vol_eff); _mc->sustain(_pedal); _mc->modulationWheel(_modwheel); @@ -1650,6 +1639,16 @@ void Part::sendAll() { _mc->priority(_pri_eff); } +void Part::sendPitchBend() { + int16 bend = _pitchbend; + // RPN-based pitchbend range doesn't work for the MT32, + // so we'll do the scaling ourselves. + if (_player->_se->isNativeMT32()) + bend = bend * _pitchbend_factor / 12; + _mc->pitchBend(clamp(bend + (_detune_eff * 64 / 12) + + (_transpose_eff * 8192 / 12), -8192, 8191)); +} + void Part::programChange(byte value) { _bank = 0; _instrument.program(value, _player->isMT32()); diff --git a/scumm/imuse_internal.h b/scumm/imuse_internal.h index 1194e779eb..4af03f669e 100644 --- a/scumm/imuse_internal.h +++ b/scumm/imuse_internal.h @@ -332,6 +332,7 @@ struct Part { void fix_after_load(); void sendAll(); + void sendPitchBend(); bool clearToTransmit(); Part() { @@ -442,6 +443,7 @@ public: void reallocateMidiChannels(MidiDriver *midi); void setGlobalAdlibInstrument(byte slot, byte *data); void copyGlobalAdlibInstrument(byte slot, Instrument *dest); + bool isNativeMT32() { return _native_mt32; } // IMuse interface |