Implement option to allow MIDI Program Change messages to select aross four consecutive banks as discussed in Issue #391.

Note: It does not check if consecutive banks are loaded.  That is down to the user.  The default is "enabled".
pull/464/head
diyelectromusic 2 years ago
parent e03e7011db
commit 35fa23cbf1
  1. 6
      src/config.cpp
  2. 2
      src/config.h
  3. 23
      src/minidexed.cpp
  4. 1
      src/minidexed.ini

@ -72,6 +72,7 @@ void CConfig::Load (void)
m_bIgnoreAllNotesOff = m_Properties.GetNumber ("IgnoreAllNotesOff", 0) != 0;
m_bMIDIAutoVoiceDumpOnPC = m_Properties.GetNumber ("MIDIAutoVoiceDumpOnPC", 1) != 0;
m_bHeaderlessSysExVoices = m_Properties.GetNumber ("HeaderlessSysExVoices", 0) != 0;
m_bExpandPCAcrossBanks = m_Properties.GetNumber ("ExpandPCAcrossBanks", 1) != 0;
m_bLCDEnabled = m_Properties.GetNumber ("LCDEnabled", 0) != 0;
m_nLCDPinEnable = m_Properties.GetNumber ("LCDPinEnable", 4);
@ -185,6 +186,11 @@ bool CConfig::GetHeaderlessSysExVoices (void) const
return m_bHeaderlessSysExVoices;
}
bool CConfig::GetExpandPCAcrossBanks (void) const
{
return m_bExpandPCAcrossBanks;
}
bool CConfig::GetLCDEnabled (void) const
{
return m_bLCDEnabled;

@ -78,6 +78,7 @@ public:
bool GetIgnoreAllNotesOff (void) const;
bool GetMIDIAutoVoiceDumpOnPC (void) const; // true if not specified
bool GetHeaderlessSysExVoices (void) const; // false if not specified
bool GetExpandPCAcrossBanks (void) const; // true if not specified
// HD44780 LCD
// GPIO pin numbers are chip numbers, not header positions
@ -159,6 +160,7 @@ private:
bool m_bIgnoreAllNotesOff;
bool m_bMIDIAutoVoiceDumpOnPC;
bool m_bHeaderlessSysExVoices;
bool m_bExpandPCAcrossBanks;
bool m_bLCDEnabled;
unsigned m_nLCDPinEnable;

@ -413,13 +413,34 @@ void CMiniDexed::ProgramChange (unsigned nProgram, unsigned nTG)
{
assert (m_pConfig);
unsigned nBankOffset;
bool bPCAcrossBanks = m_pConfig->GetExpandPCAcrossBanks();
if (bPCAcrossBanks)
{
// Note: This doesn't actually change the bank in use
// but will allow PC messages of 0..127
// to select across four consecutive banks of voices.
//
// So if the current bank = 5 then:
// PC 0-31 = Bank 5, Program 0-31
// PC 32-63 = Bank 6, Program 0-31
// PC 64-95 = Bank 7, Program 0-31
// PC 96-127 = Bank 8, Program 0-31
nProgram=constrain((int)nProgram,0,127);
nBankOffset = nProgram >> 5;
nProgram = nProgram % 32;
}
else
{
nBankOffset = 0;
nProgram=constrain((int)nProgram,0,31);
}
assert (nTG < CConfig::ToneGenerators);
m_nProgram[nTG] = nProgram;
uint8_t Buffer[156];
m_SysExFileLoader.GetVoice (m_nVoiceBankID[nTG], nProgram, Buffer);
m_SysExFileLoader.GetVoice (m_nVoiceBankID[nTG]+nBankOffset, nProgram, Buffer);
assert (m_pTG[nTG]);
m_pTG[nTG]->loadVoiceParameters (Buffer);

@ -18,6 +18,7 @@ MIDIRXProgramChange=1
IgnoreAllNotesOff=0
MIDIAutoVoiceDumpOnPC=1
HeaderlessSysExVoices=0
ExpandPCAcrossBanks=1
# HD44780 LCD
LCDEnabled=1

Loading…
Cancel
Save