[Scummvm-git-logs] scummvm branch-2-5 -> 53193618509659b769e78df3d21e489a2b74b594
NMIError
60350957+NMIError at users.noreply.github.com
Sat Oct 30 19:35:17 UTC 2021
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
5319361850 SCUMM: Fix Sam & Max OPL3 pitch bend
Commit: 53193618509659b769e78df3d21e489a2b74b594
https://github.com/scummvm/scummvm/commit/53193618509659b769e78df3d21e489a2b74b594
Author: Coen Rampen (crampen at gmail.com)
Date: 2021-10-30T21:35:12+02:00
Commit Message:
SCUMM: Fix Sam & Max OPL3 pitch bend
The pitch bend in Sam & Max was exaggerated when using the OPL3 driver. The
OPL3 functionality was apparently implemented by examining just the original
driver code and not the MIDI processing code in the interpreter. The pitch bend
values sent to the driver are not standard MIDI pitch bend values, but have
been processed by the interpreter, so the driver logic cannot be directly
applied to the pitch bend values from the MIDI data.
This commit fixes the pitch bend calculations to produce the same results as
the original interpreter. It also restores the pitch bend range functionality.
This was disabled for OPL3, probably because it is implemented in the
interpreter instead of the driver. It is used in several Sam & Max MIDI tracks.
Changed paths:
audio/adlib.cpp
diff --git a/audio/adlib.cpp b/audio/adlib.cpp
index 0d6bdec5c5..217d1cc60f 100644
--- a/audio/adlib.cpp
+++ b/audio/adlib.cpp
@@ -1095,7 +1095,7 @@ void AdLibPart::pitchBend(int16 bend) {
(_pitchBend * _pitchBendFactor >> 6) + _detuneEff);
#ifdef ENABLE_OPL3
} else {
- _owner->adlibNoteOn(voice->_channel, voice->_note, _pitchBend >> 1);
+ _owner->adlibNoteOn(voice->_channel, voice->_note, (_pitchBend * _pitchBendFactor) >> 5);
}
#endif
}
@@ -1196,19 +1196,20 @@ void AdLibPart::panPosition(byte value) {
}
void AdLibPart::pitchBendFactor(byte value) {
-#ifdef ENABLE_OPL3
- // Not supported in OPL3 mode.
- if (_owner->_opl3Mode) {
- return;
- }
-#endif
-
AdLibVoice *voice;
_pitchBendFactor = value;
for (voice = _voice; voice; voice = voice->_next) {
- _owner->adlibNoteOn(voice->_channel, voice->_note/* + _transposeEff*/,
+#ifdef ENABLE_OPL3
+ if (!_owner->_opl3Mode) {
+#endif
+ _owner->adlibNoteOn(voice->_channel, voice->_note /* + _transposeEff*/,
(_pitchBend * _pitchBendFactor >> 6) + _detuneEff);
+#ifdef ENABLE_OPL3
+ } else {
+ _owner->adlibNoteOn(voice->_channel, voice->_note, (_pitchBend * _pitchBendFactor) >> 5);
+ }
+#endif
}
}
@@ -1558,20 +1559,21 @@ uint32 MidiDriver_ADLIB::property(int prop, uint32 param) {
}
void MidiDriver_ADLIB::setPitchBendRange(byte channel, uint range) {
-#ifdef ENABLE_OPL3
- // Not supported in OPL3 mode.
- if (_opl3Mode) {
- return;
- }
-#endif
-
AdLibVoice *voice;
AdLibPart *part = &_parts[channel];
part->_pitchBendFactor = range;
for (voice = part->_voice; voice; voice = voice->_next) {
- adlibNoteOn(voice->_channel, voice->_note/* + part->_transposeEff*/,
- (part->_pitchBend * part->_pitchBendFactor >> 6) + part->_detuneEff);
+#ifdef ENABLE_OPL3
+ if (!_opl3Mode) {
+#endif
+ adlibNoteOn(voice->_channel, voice->_note/* + part->_transposeEff*/,
+ (part->_pitchBend * part->_pitchBendFactor >> 6) + part->_detuneEff);
+#ifdef ENABLE_OPL3
+ } else {
+ adlibNoteOn(voice->_channel, voice->_note, (part->_pitchBend * part->_pitchBendFactor) >> 5);
+ }
+#endif
}
}
@@ -2091,7 +2093,7 @@ void MidiDriver_ADLIB::mcKeyOn(AdLibVoice *voice, const AdLibInstrument *instr,
#ifdef ENABLE_OPL3
} else {
adlibSetupChannelSecondary(voice->_channel, second, secVol1, secVol2, pan);
- adlibNoteOnEx(voice->_channel, note, part->_pitchBend >> 1);
+ adlibNoteOnEx(voice->_channel, note, (part->_pitchBend * part->_pitchBendFactor) >> 5);
}
#endif
}
More information about the Scummvm-git-logs
mailing list