Fix for Serial Midi In double triggering notes (#216)

Thanks @dcoredump
pull/223/head
Holger 3 years ago committed by GitHub
parent 6d14da8604
commit 52b8900293
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      src/mididevice.cpp
  2. 1
      src/minidexed.cpp
  3. 5
      src/serialmididevice.cpp

@ -49,7 +49,8 @@ LOGMODULE ("mididevice");
#define MIDI_PROGRAM_CHANGE 0b1100
#define MIDI_PITCH_BEND 0b1110
#define MIDI_SYSTEM_EXCLUSIVE 0xF0
#define MIDI_SYSTEM_EXCLUSIVE_BEGIN 0xF0
#define MIDI_SYSTEM_EXCLUSIVE_END 0xF7
#define MIDI_TIMING_CLOCK 0xF8
#define MIDI_ACTIVE_SENSING 0xFE
@ -112,7 +113,7 @@ void CMIDIDevice::MIDIMessageHandler (const u8 *pMessage, size_t nLength, unsign
default:
switch(pMessage[0])
{
case MIDI_SYSTEM_EXCLUSIVE:
case MIDI_SYSTEM_EXCLUSIVE_BEGIN:
printf("SysEx data length: [%d]\n",uint16_t(nLength));
printf("SysEx data:\n");
for (uint16_t i = 0; i < nLength; i++)
@ -145,6 +146,7 @@ void CMIDIDevice::MIDIMessageHandler (const u8 *pMessage, size_t nLength, unsign
if (nLength < 2)
{
LOGERR("MIDI message is shorter than 2 bytes!");
return;
}
@ -153,7 +155,7 @@ void CMIDIDevice::MIDIMessageHandler (const u8 *pMessage, size_t nLength, unsign
u8 ucType = ucStatus >> 4;
// GLOBAL MIDI SYSEX
if (pMessage[0] == MIDI_SYSTEM_EXCLUSIVE && pMessage[3] == 0x04 && pMessage[4] == 0x01 && pMessage[nLength-1] == 0xF7) // MASTER VOLUME
if (pMessage[0] == MIDI_SYSTEM_EXCLUSIVE_BEGIN && pMessage[3] == 0x04 && pMessage[4] == 0x01 && pMessage[nLength-1] == MIDI_SYSTEM_EXCLUSIVE_END) // MASTER VOLUME
{
float32_t nMasterVolume=(pMessage[5] & (pMessage[6]<<7))/(1<<14);
LOGNOTE("Master volume: %f",nMasterVolume);
@ -164,7 +166,7 @@ void CMIDIDevice::MIDIMessageHandler (const u8 *pMessage, size_t nLength, unsign
for (unsigned nTG = 0; nTG < CConfig::ToneGenerators; nTG++)
{
// MIDI SYSEX per MIDI channel
if (ucStatus == MIDI_SYSTEM_EXCLUSIVE && m_ChannelMap[nTG] == pMessage[2] & 0x07)
if (ucStatus == MIDI_SYSTEM_EXCLUSIVE_BEGIN && m_ChannelMap[nTG] == pMessage[2] & 0x07)
HandleSystemExclusive(pMessage, nLength, nTG);
else
{

@ -256,7 +256,6 @@ void CMiniDexed::Process (bool bPlugAndPlayUpdated)
if (m_bUseSerial)
{
m_SerialMIDI.Process ();
m_SerialMIDI.Process ();
}
m_UI.Process ();

@ -144,6 +144,11 @@ void CSerialMIDIDevice::Process (void)
m_nSerialState = 1;
goto DATABytes;
}
else
{
m_nSerialState = 0;
goto MIDIRestart;
}
break;
default:
assert (0);

Loading…
Cancel
Save