diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/adlmidi_midiplay.cpp | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/adlmidi_midiplay.cpp b/src/adlmidi_midiplay.cpp index 4705bc4..01e973e 100644 --- a/src/adlmidi_midiplay.cpp +++ b/src/adlmidi_midiplay.cpp @@ -917,32 +917,35 @@ bool MIDIplay::realTime_NoteOn(uint8_t channel, uint8_t note, uint8_t velocity) size_t midiins = Ch[channel].patch; bool isPercussion = (channel % 16 == 9); + bool isXgPercussion = false; uint16_t bank = 0; if(Ch[channel].bank_msb || Ch[channel].bank_lsb) { bank = (uint16_t(Ch[channel].bank_msb) * 256) + uint16_t(Ch[channel].bank_lsb); - if(bank == 0x7E00) //XG SFX1/SFX2 channel (16128 signed decimal) + //0x7E00 - XG SFX1/SFX2 channel (16128 signed decimal) + //0x7F00 - XG Percussion channel (16256 signed decimal) + if(bank == 0x7E00 || bank == 0x7F00) { - //Let XG SFX1/SFX2 bank will have LSB==1 (128...255 range in WOPL file) - bank = (uint16_t)midiins + 128; // MIDI instrument defines the patch - isPercussion = true; - } - if(bank == 0x7F00) //XG Percussion channel (16256 signed decimal) - { - //Let XG Percussion bank will use (0...127 range in WOPL file) - bank = (uint16_t)midiins; // MIDI instrument defines the patch - isPercussion = true; + //Let XG SFX1/SFX2 bank will have LSB==1 (128...255 range in WOPN file) + //Let XG Percussion bank will use (0...127 range in WOPN file) + bank = (uint16_t)midiins + ((bank == 0x7E00) ? 128 : 0); // MIDI instrument defines the patch + midiins = opl.dynamic_percussion_offset + note; // Percussion instrument + isXgPercussion = true; + isPercussion = false; } } if(isPercussion) + { + bank = (uint16_t)midiins; // MIDI instrument defines the patch midiins = opl.dynamic_percussion_offset + note; // Percussion instrument + } //Set bank bank if(bank > 0) { - if(isPercussion) + if(isPercussion || isXgPercussion) { OPL3::BankMap::iterator b = opl.dynamic_percussion_banks.find(bank); if(b != opl.dynamic_percussion_banks.end()) |