From e3df1dcdbd524af2be934c7b2a57f8c35fb0a0ca Mon Sep 17 00:00:00 2001 From: probonopd Date: Sun, 24 Apr 2022 11:59:18 +0200 Subject: [PATCH 1/2] Make it possible to disable MIDI Program Change messages (#159) MIDIRXProgramChange parameter https://github.com/fp64lib/MiniDexed/commit/3af6cb533167927bfd98ff2d2f745254cf1ed4c6 Thanks @fp64lib --- src/config.cpp | 8 ++++++++ src/config.h | 3 +++ src/mididevice.cpp | 14 ++++---------- src/minidexed.ini | 1 + 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/config.cpp b/src/config.cpp index 8194ace..31a148c 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -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; diff --git a/src/config.h b/src/config.h index e5597cc..5c4ada6 100644 --- a/src/config.h +++ b/src/config.h @@ -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; diff --git a/src/mididevice.cpp b/src/mididevice.cpp index 06ca51b..837d8e9 100644 --- a/src/mididevice.cpp +++ b/src/mididevice.cpp @@ -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: { diff --git a/src/minidexed.ini b/src/minidexed.ini index 46b69cc..327b649 100644 --- a/src/minidexed.ini +++ b/src/minidexed.ini @@ -14,6 +14,7 @@ ChannelsSwapped=0 # MIDI MIDIBaudRate=31250 #MIDIThru=umidi1,ttyS1 +MIDIRXProgramChange=1 # HD44780 LCD LCDEnabled=1 From 5ba274cfed33d8291c024d2d247a814c98f8d3e0 Mon Sep 17 00:00:00 2001 From: probonopd Date: Mon, 25 Apr 2022 07:49:02 +0200 Subject: [PATCH 2/2] FAT16 [ci skip] --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4df2cf1..c85b061 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ Video about this project by [Floyd Steinberg](https://www.youtube.com/watch?v=Z3 * In the case of Raspberry Pi 4, Update the firmware and bootloader to the latest version (not doing this may cause USB reliability issues) * Download from [GitHub Releases](../../releases) * Unzip -* Put the files into the root directory of a FAT32 formatted partition on SD/microSD card +* Put the files into the root directory of a FAT32 formatted partition on SD/microSD card (Note for small SD cards which are no longer sold: If less than 65525 clusters, you may need to format as FAT16.) * Put SD/microSD card into Raspberry Pi 1, 2, 3 or 4, or 400 (Zero and Zero 2 can be used but need HDMI or a supported i2c DAC for audio out) * Attach headphones to the headphone jack using `SoundDevice=pwm` in `minidexed.ini` (default) (poor audio quality) * Alternatively, attach a PCM5102A or PCM5122 based DAC and select i2c sound output using `SoundDevice=i2s` in `minidexed.ini` (best audio quality)