Make it possible to disable MIDI Program Change messages (#159)

MIDIRXProgramChange parameter
3af6cb5331
Thanks @fp64lib
pull/171/head
probonopd 3 years ago committed by GitHub
parent addbd45282
commit e3df1dcdbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      src/config.cpp
  2. 3
      src/config.h
  3. 14
      src/mididevice.cpp
  4. 1
      src/minidexed.ini

@ -67,6 +67,9 @@ void CConfig::Load (void)
}
}
}
m_bMIDIRXProgramChange = m_Properties.GetNumber ("MIDIRXProgramChange", 1) != 0;
m_bLCDEnabled = m_Properties.GetNumber ("LCDEnabled", 0) != 0;
m_nLCDPinEnable = m_Properties.GetNumber ("LCDPinEnable", 17);
@ -126,6 +129,11 @@ const char *CConfig::GetMIDIThruOut (void) const
return m_MIDIThruOut.c_str ();
}
bool CConfig::GetMIDIRXProgramChange (void) const
{
return m_bMIDIRXProgramChange;
}
bool CConfig::GetLCDEnabled (void) const
{
return m_bLCDEnabled;

@ -73,6 +73,8 @@ public:
unsigned GetMIDIBaudRate (void) const;
const char *GetMIDIThruIn (void) const; // "" if not specified
const char *GetMIDIThruOut (void) const; // "" if not specified
bool GetMIDIRXProgramChange (void) const; // true if not specified
// HD44780 LCD
// GPIO pin numbers are chip numbers, not header positions
@ -108,6 +110,7 @@ private:
unsigned m_nMIDIBaudRate;
std::string m_MIDIThruIn;
std::string m_MIDIThruOut;
bool m_bMIDIRXProgramChange;
bool m_bLCDEnabled;
unsigned m_nLCDPinEnable;

@ -208,15 +208,7 @@ void CMIDIDevice::MIDIMessageHandler (const u8 *pMessage, size_t nLength, unsign
break;
case MIDI_CC_DETUNE_LEVEL:
if (pMessage[2] == 0)
{
// "0 to 127, with 0 being no celeste (detune) effect applied at all."
m_pSynthesizer->SetMasterTune (0, nTG);
}
else
{
m_pSynthesizer->SetMasterTune (maplong (pMessage[2], 1, 127, -99, 99), nTG);
}
m_pSynthesizer->SetMasterTune (maplong (pMessage[2], 0, 127, -99, 99), nTG);
break;
case MIDI_CC_ALL_SOUND_OFF:
@ -230,7 +222,9 @@ void CMIDIDevice::MIDIMessageHandler (const u8 *pMessage, size_t nLength, unsign
break;
case MIDI_PROGRAM_CHANGE:
m_pSynthesizer->ProgramChange (pMessage[1], nTG);
// do program change only if enabled in config
if( m_pConfig->GetMIDIRXProgramChange() )
m_pSynthesizer->ProgramChange (pMessage[1], nTG);
break;
case MIDI_PITCH_BEND: {

@ -14,6 +14,7 @@ ChannelsSwapped=0
# MIDI
MIDIBaudRate=31250
#MIDIThru=umidi1,ttyS1
MIDIRXProgramChange=1
# HD44780 LCD
LCDEnabled=1

Loading…
Cancel
Save