Small fixes for recognizing MIDI channel in SYSEX.

Disabled printing of MIDI data in incoming serial data.
Added some mor debug output.
pull/247/head
Holger Wirtz 3 years ago
parent 0be1d998bc
commit 8a143af078
  1. 14
      src/mididevice.cpp
  2. 8
      src/serialmididevice.cpp

@ -114,8 +114,7 @@ void CMIDIDevice::MIDIMessageHandler (const u8 *pMessage, size_t nLength, unsign
switch(pMessage[0]) switch(pMessage[0])
{ {
case MIDI_SYSTEM_EXCLUSIVE_BEGIN: case MIDI_SYSTEM_EXCLUSIVE_BEGIN:
printf("SysEx data length: [%d]\n",uint16_t(nLength)); printf("MIDI%u: SysEx data length: [%d]:",nCable, uint16_t(nLength));
printf("SysEx data:");
for (uint16_t i = 0; i < nLength; i++) for (uint16_t i = 0; i < nLength; i++)
{ {
if((i % 8) == 0) if((i % 8) == 0)
@ -125,7 +124,7 @@ void CMIDIDevice::MIDIMessageHandler (const u8 *pMessage, size_t nLength, unsign
printf("\n"); printf("\n");
break; break;
default: default:
printf("Unhandled MIDI event type %0x02x\n",pMessage[0]); printf("MIDI%u: Unhandled MIDI event type %0x02x\n",nCable,pMessage[0]);
} }
break; break;
} }
@ -165,8 +164,15 @@ void CMIDIDevice::MIDIMessageHandler (const u8 *pMessage, size_t nLength, unsign
for (unsigned nTG = 0; nTG < CConfig::ToneGenerators; nTG++) for (unsigned nTG = 0; nTG < CConfig::ToneGenerators; nTG++)
{ {
// MIDI SYSEX per MIDI channel // MIDI SYSEX per MIDI channel
if (ucStatus == MIDI_SYSTEM_EXCLUSIVE_BEGIN && (m_ChannelMap[nTG] == ((pMessage[2] & 0x07) + 1) || (m_ChannelMap[nTG] > 16 ))) uint8_t ucSysExChannel = (pMessage[2] & 0x07) + 1;
if (ucStatus == MIDI_SYSTEM_EXCLUSIVE_BEGIN &&
(ucSysExChannel == m_ChannelMap[nTG] ||
ucSysExChannel == OmniMode)
)
{
LOGNOTE("MIDI-SYSEX: channel: %u, len: %u, TG: %u",m_ChannelMap[nTG],nTG);
HandleSystemExclusive(pMessage, nLength, nTG); HandleSystemExclusive(pMessage, nLength, nTG);
}
else else
{ {
if ( m_ChannelMap[nTG] == ucChannel if ( m_ChannelMap[nTG] == ucChannel

@ -20,10 +20,14 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
#include <circle/logger.h>
#include <cstring> #include <cstring>
#include "serialmididevice.h" #include "serialmididevice.h"
#include <assert.h> #include <assert.h>
LOGMODULE("serialmididevice");
CSerialMIDIDevice::CSerialMIDIDevice (CMiniDexed *pSynthesizer, CInterruptSystem *pInterrupt, CSerialMIDIDevice::CSerialMIDIDevice (CMiniDexed *pSynthesizer, CInterruptSystem *pInterrupt,
CConfig *pConfig) CConfig *pConfig)
: CMIDIDevice (pSynthesizer, pConfig), : CMIDIDevice (pSynthesizer, pConfig),
@ -58,10 +62,11 @@ void CSerialMIDIDevice::Process (void)
if (nResult <= 0) if (nResult <= 0)
{ {
if(nResult!=0) if(nResult!=0)
printf("Serial-Read: %d\n",nResult); LOGERR("Serial.Read() error: %d\n",nResult);
return; return;
} }
/*
if (m_pConfig->GetMIDIDumpEnabled ()) if (m_pConfig->GetMIDIDumpEnabled ())
{ {
printf("Incoming MIDI data:"); printf("Incoming MIDI data:");
@ -73,6 +78,7 @@ void CSerialMIDIDevice::Process (void)
} }
printf("\n"); printf("\n");
} }
*/
// Process MIDI messages // Process MIDI messages
// See: https://www.midi.org/specifications/item/table-1-summary-of-midi-message // See: https://www.midi.org/specifications/item/table-1-summary-of-midi-message

Loading…
Cancel
Save