diff options
Diffstat (limited to 'drivers/alsamidi')
-rw-r--r-- | drivers/alsamidi/midi_driver_alsamidi.cpp | 30 | ||||
-rw-r--r-- | drivers/alsamidi/midi_driver_alsamidi.h | 4 |
2 files changed, 28 insertions, 6 deletions
diff --git a/drivers/alsamidi/midi_driver_alsamidi.cpp b/drivers/alsamidi/midi_driver_alsamidi.cpp index aae0ae0216..6121a44b36 100644 --- a/drivers/alsamidi/midi_driver_alsamidi.cpp +++ b/drivers/alsamidi/midi_driver_alsamidi.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -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; @@ -73,7 +91,7 @@ void MIDIDriverALSAMidi::thread_func(void *p_udata) { ret = snd_rawmidi_read(midi_in, &byte, 1); if (ret < 0) { if (ret != -EAGAIN) { - ERR_PRINTS("snd_rawmidi_read error: " + String(snd_strerror(ret))); + ERR_PRINT("snd_rawmidi_read error: " + String(snd_strerror(ret))); } } else { if (byte & 0x80) { @@ -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) { @@ -128,6 +149,7 @@ Error MIDIDriverALSAMidi::open() { snd_device_name_free_hint(hints); mutex = Mutex::create(); + exit_thread = false; thread = Thread::create(MIDIDriverALSAMidi::thread_func, this); return OK; diff --git a/drivers/alsamidi/midi_driver_alsamidi.h b/drivers/alsamidi/midi_driver_alsamidi.h index b6956cc32f..354fcce147 100644 --- a/drivers/alsamidi/midi_driver_alsamidi.h +++ b/drivers/alsamidi/midi_driver_alsamidi.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ |