Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide MIDI device property in InputEventMIDI class #7733

Closed
mcptron opened this issue Sep 18, 2023 · 1 comment · Fixed by godotengine/godot#86620
Closed

Provide MIDI device property in InputEventMIDI class #7733

mcptron opened this issue Sep 18, 2023 · 1 comment · Fixed by godotengine/godot#86620

Comments

@mcptron
Copy link

mcptron commented Sep 18, 2023

Describe the project you are working on

I am working on a digital art project where I am using Godot as visualization engine which is influenced by audio analysis and incoming MIDI events.

Describe the problem or limitation you are having in your project

Some external MIDI Hardware devices cannot change their MIDI channel and cannot be distinguished from each other without device information for each incoming MIDI event.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

A string attribute "input" or "device" containing the device name as listed by OS.get_connected_midi_inputs() or an int attribute pointing to the corresponding array element of OS.get_connected_midi_inputs() would solve the problem.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

if input_event is InputEventMIDI and input_event.device == "my_awesome_midi_controller":
do_something_useful()

If this enhancement will not be used often, can it be worked around with a few lines of script?

I haven't found any workaroung except integrating an external MIDI library like portmidi or rtmidi as GDExtension

Is there a reason why this should be core and not an add-on in the asset library?

All necessary information should already be available and exposing the device name should be quiet simple (i would guess).

@ramdor
Copy link

ramdor commented Sep 20, 2023

yes, this would be a welcome addition. Currently OS.GetConnectedMidiInputs() returns a string array of devices, however there is no property in the InputEventMidi event such as MidiInputIndex which could be used to obtain the string out of that device array.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment