From 9a0404aed781f8438950dec487c5bb299c7ee923 Mon Sep 17 00:00:00 2001 From: probonopd Date: Sat, 2 Dec 2023 20:55:03 +0100 Subject: [PATCH] Distinguish between MSB and LSB on program change Depending on whether we get a MSB or LSB, we need to change the performance directory or do a program change --- src/mididevice.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/mididevice.cpp b/src/mididevice.cpp index 5f231d6..7f2cc19 100644 --- a/src/mididevice.cpp +++ b/src/mididevice.cpp @@ -355,6 +355,25 @@ void CMIDIDevice::MIDIMessageHandler (const u8 *pMessage, size_t nLength, unsign if( m_pConfig->GetMIDIRXProgramChange() && ( m_pSynthesizer->GetPerformanceSelectChannel() == Disabled) ) { //printf("Program Change to %d (%d)\n", ucChannel, m_pSynthesizer->GetPerformanceSelectChannel()); m_pSynthesizer->ProgramChange (pMessage[1], nTG); + + /* TODO: Depending on whether we get a MSB or LSB, we need to change the performance directory + or do a program change. This is not yet implemented. Pseudo code: + + switch (pMessage[1]) + { + case MIDI_CC_BANK_SELECT_MSB: + CString sDir; + sDir.Format ("performance/%d", pMessage[2]); + // Check if we find a performance directory that starts with that name; if yes, use it + m_pConfig->SetPerformanceDir (sDir.c_str ()); + break; + + case MIDI_CC_BANK_SELECT_LSB: + // Check if we find a performance file that starts with that name; if yes, use it + m_pSynthesizer->ProgramChange (pMessage[1], nTG); + break; + } + */ } break;