From 12f4ea783808c21bae4ca7db96fdede151c31079 Mon Sep 17 00:00:00 2001 From: probonopd Date: Fri, 25 Nov 2022 13:01:48 -0500 Subject: [PATCH] Implement IgnoreAllNotesOff=1 (#366) * GetIgnoreAllNotesOff [ci skip] * IgnoreAllNotesOff [ci skip] * IgnoreAllNotesOff [ci skip] * IgnoreAllNotesOff --- src/config.cpp | 7 ++++++- src/config.h | 3 ++- src/mididevice.cpp | 5 ++++- src/minidexed.ini | 1 + 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/config.cpp b/src/config.cpp index ad87b80..df3ebd7 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -69,7 +69,7 @@ void CConfig::Load (void) } m_bMIDIRXProgramChange = m_Properties.GetNumber ("MIDIRXProgramChange", 1) != 0; - + m_bIgnoreAllNotesOff = m_Properties.GetNumber ("IgnoreAllNotesOff", 0) != 0; m_bLCDEnabled = m_Properties.GetNumber ("LCDEnabled", 0) != 0; m_nLCDPinEnable = m_Properties.GetNumber ("LCDPinEnable", 4); @@ -165,6 +165,11 @@ bool CConfig::GetMIDIRXProgramChange (void) const return m_bMIDIRXProgramChange; } +bool CConfig::GetIgnoreAllNotesOff (void) const +{ + return m_bIgnoreAllNotesOff; +} + bool CConfig::GetLCDEnabled (void) const { return m_bLCDEnabled; diff --git a/src/config.h b/src/config.h index b970ebb..649bdf4 100644 --- a/src/config.h +++ b/src/config.h @@ -75,7 +75,7 @@ public: const char *GetMIDIThruIn (void) const; // "" if not specified const char *GetMIDIThruOut (void) const; // "" if not specified bool GetMIDIRXProgramChange (void) const; // true if not specified - + bool GetIgnoreAllNotesOff (void) const; // HD44780 LCD // GPIO pin numbers are chip numbers, not header positions @@ -151,6 +151,7 @@ private: std::string m_MIDIThruIn; std::string m_MIDIThruOut; bool m_bMIDIRXProgramChange; + bool m_bIgnoreAllNotesOff; bool m_bLCDEnabled; unsigned m_nLCDPinEnable; diff --git a/src/mididevice.cpp b/src/mididevice.cpp index 463dc9c..012dc72 100644 --- a/src/mididevice.cpp +++ b/src/mididevice.cpp @@ -318,7 +318,10 @@ void CMIDIDevice::MIDIMessageHandler (const u8 *pMessage, size_t nLength, unsign break; case MIDI_CC_ALL_NOTES_OFF: - m_pSynthesizer->notesOff (pMessage[2], nTG); + if (!m_pConfig->GetIgnoreAllNotesOff ()) + { + m_pSynthesizer->notesOff (pMessage[2], nTG); + } break; } break; diff --git a/src/minidexed.ini b/src/minidexed.ini index 4e6f78c..7917fe7 100644 --- a/src/minidexed.ini +++ b/src/minidexed.ini @@ -15,6 +15,7 @@ ChannelsSwapped=0 MIDIBaudRate=31250 #MIDIThru=umidi1,ttyS1 MIDIRXProgramChange=1 +IgnoreAllNotesOff=0 # HD44780 LCD LCDEnabled=1