Expand Program Change messages across banks (#464)

* Fix for Issue #457 - changed m_nNumLoadedBanks to be m_nNumHighestBank and updated functionality in menus accordingly.

* Fix for Issue #460 implements MIDI Bank Select MSB/LSB based on PR #395 submitted by @abscisys

* Fix for Issue #458 to not show blank banks in the menus.  Also handles MIDI bank select messages and won't change banks if the final selected bank isn't loaded.

* Firm up bank validity handling slightly.

* Fix for Issue #459 Initial support for loading of headerless SysEx voice banks as a configuraton option

* Fix for Issue #459 Added config option for headerless SysEx voice banks.

* 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/481/head
Kevin 2 years ago committed by GitHub
parent 7e0251eee5
commit 582c740741
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  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_bIgnoreAllNotesOff = m_Properties.GetNumber ("IgnoreAllNotesOff", 0) != 0;
m_bMIDIAutoVoiceDumpOnPC = m_Properties.GetNumber ("MIDIAutoVoiceDumpOnPC", 1) != 0; m_bMIDIAutoVoiceDumpOnPC = m_Properties.GetNumber ("MIDIAutoVoiceDumpOnPC", 1) != 0;
m_bHeaderlessSysExVoices = m_Properties.GetNumber ("HeaderlessSysExVoices", 0) != 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_bLCDEnabled = m_Properties.GetNumber ("LCDEnabled", 0) != 0;
m_nLCDPinEnable = m_Properties.GetNumber ("LCDPinEnable", 4); m_nLCDPinEnable = m_Properties.GetNumber ("LCDPinEnable", 4);
@ -185,6 +186,11 @@ bool CConfig::GetHeaderlessSysExVoices (void) const
return m_bHeaderlessSysExVoices; return m_bHeaderlessSysExVoices;
} }
bool CConfig::GetExpandPCAcrossBanks (void) const
{
return m_bExpandPCAcrossBanks;
}
bool CConfig::GetLCDEnabled (void) const bool CConfig::GetLCDEnabled (void) const
{ {
return m_bLCDEnabled; return m_bLCDEnabled;

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

@ -413,13 +413,34 @@ void CMiniDexed::ProgramChange (unsigned nProgram, unsigned nTG)
{ {
assert (m_pConfig); 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); nProgram=constrain((int)nProgram,0,31);
}
assert (nTG < CConfig::ToneGenerators); assert (nTG < CConfig::ToneGenerators);
m_nProgram[nTG] = nProgram; m_nProgram[nTG] = nProgram;
uint8_t Buffer[156]; 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]); assert (m_pTG[nTG]);
m_pTG[nTG]->loadVoiceParameters (Buffer); m_pTG[nTG]->loadVoiceParameters (Buffer);

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

Loading…
Cancel
Save