Skip to content

Commit

Permalink
Tune the processing of bank recognizing algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
Wohlstand committed Jan 7, 2021
1 parent e9e0f4f commit 9142867
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/adlmidi_midiplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ enum { MasterVolumeDefault = 127 };

inline bool isXgPercChannel(uint8_t msb, uint8_t lsb)
{
return (msb == 0x7E || msb == 0x7F) && (lsb == 0);
ADL_UNUSED(lsb);
return (msb == 0x7E || msb == 0x7F);
}

void MIDIplay::AdlChannel::addAge(int64_t us)
Expand Down Expand Up @@ -329,7 +330,7 @@ bool MIDIplay::realTime_NoteOn(uint8_t channel, uint8_t note, uint8_t velocity)
// Let XG Percussion bank will use (0...127 LSB range in WOPN file)

// Choose: SFX or Drum Kits
bank = midiins + ((bank == 0x7E00) ? 128 : 0);
bank = midiins + ((midiChan.bank_msb == 0x7E) ? 128 : 0);
}
else
{
Expand Down Expand Up @@ -357,8 +358,8 @@ bool MIDIplay::realTime_NoteOn(uint8_t channel, uint8_t note, uint8_t velocity)
caughtMissingBank = true;
}

//Or fall back to bank ignoring LSB (GS)
if((ains->flags & OplInstMeta::Flag_NoSound) && ((m_synthMode & Mode_GS) != 0))
//Or fall back to bank ignoring LSB (GS/XG)
if(ains->flags & OplInstMeta::Flag_NoSound)
{
size_t fallback = bank & ~(size_t)0x7F;
if(fallback != bank)
Expand Down

0 comments on commit 9142867

Please sign in to comment.