diff options
author | Fernando Cosentino <fbcosentino@yahoo.com.br> | 2023-12-29 23:29:10 +0000 |
---|---|---|
committer | Fernando Cosentino <fbcosentino@yahoo.com.br> | 2024-02-19 10:23:19 +0000 |
commit | b9fd25ea18f3e87530e1558cc377f36645fcd980 (patch) | |
tree | 89aa792acecc7b2881db589dec331a0ab2d658f6 /core/os/midi_driver.cpp | |
parent | 13a0d6e9b253654f5cc2a44f3d0b3cae10440443 (diff) | |
download | redot-engine-b9fd25ea18f3e87530e1558cc377f36645fcd980.tar.gz |
Add MIDI controller device index to InputEventMIDI.device property.
It is possible to query the OS for the connected MIDI controllers,
but the event messages' device field was not being used. This implements
controller index being sent in InputEventMIDI messages in the device
property, matching the index from OS.get_connected_midi_inputs().
Based on the work done by @ramdor.
Closes godotengine/godot-proposals#7733
Co-authored-by: Richie <richie_github@grange-lane.co.uk>
Diffstat (limited to 'core/os/midi_driver.cpp')
-rw-r--r-- | core/os/midi_driver.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/core/os/midi_driver.cpp b/core/os/midi_driver.cpp index 037851661b..6870c84b49 100644 --- a/core/os/midi_driver.cpp +++ b/core/os/midi_driver.cpp @@ -42,9 +42,10 @@ void MIDIDriver::set_singleton() { singleton = this; } -void MIDIDriver::receive_input_packet(uint64_t timestamp, uint8_t *data, uint32_t length) { +void MIDIDriver::receive_input_packet(int device_index, uint64_t timestamp, uint8_t *data, uint32_t length) { Ref<InputEventMIDI> event; event.instantiate(); + event->set_device(device_index); uint32_t param_position = 1; if (length >= 1) { |