Merge pull request #35414 from Ovnuniarchos/AlsaMidiBadPitchBend

ALSA MIDI: Pitch bend and System Common messages
This commit is contained in:
Rémi Verschelde 2020-01-22 22:12:57 +01:00 committed by GitHub
commit a8460bffd2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 2 deletions

View file

@ -52,7 +52,12 @@ void MIDIDriver::receive_input_packet(uint64_t timestamp, uint8_t *data, uint32_
uint32_t param_position = 1;
if (length >= 1) {
if ((data[0] & 0x80) == 0x00) {
if (data[0] >= 0xF0) {
// channel does not apply to system common messages
event->set_channel(0);
event->set_message(data[0]);
last_received_message = data[0];
} else if ((data[0] & 0x80) == 0x00) {
// running status
event->set_channel(last_received_message & 0xF);
event->set_message(last_received_message >> 4);

View file

@ -43,12 +43,30 @@ static int get_message_size(uint8_t message) {
case 0x90: // note on
case 0xA0: // aftertouch
case 0xB0: // continuous controller
case 0xE0: // pitch bend
case 0xF2: // song position pointer
return 3;
case 0xC0: // patch change
case 0xD0: // channel pressure
case 0xE0: // pitch bend
case 0xF1: // time code quarter frame
case 0xF3: // song select
return 2;
case 0xF0: // SysEx start
case 0xF4: // reserved
case 0xF5: // reserved
case 0xF6: // tune request
case 0xF7: // SysEx end
case 0xF8: // timing clock
case 0xF9: // reserved
case 0xFA: // start
case 0xFB: // continue
case 0xFC: // stop
case 0xFD: // reserved
case 0xFE: // active sensing
case 0xFF: // reset
return 1;
}
return 256;
@ -83,6 +101,9 @@ void MIDIDriverALSAMidi::thread_func(void *p_udata) {
bytes = 0;
}
expected_size = get_message_size(byte);
// After a SysEx start, all bytes are data until a SysEx end, so
// we're going to end the command at the SES, and let the common
// driver ignore the following data bytes.
}
if (bytes < 256) {