MIDI USB identifiers on Windows

Hello everyone :slight_smile:

We are facing issues about MIDI connections on Windows.
Our software identifies the MIDI Input/Output selected, using the parameters identifier of the struct MidiDeviceInfo (we’re using the latest JUCE tip).
On Mac and iPad it works well, but on Windows this parameter changes according to the USB port in which the MIDI device has been insert.

These is an example of what happen:

<MIDIOUTPUT name="Nord Electro 5 MIDI" id="\\?\usb#vid_0ffc&amp;pid_0027&amp;mi_01#9&amp;1f43fb64&amp;0&amp;0001#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\global"/>
<MIDIOUTPUT name="Nord Electro 5 MIDI" id="\\?\usb#vid_0ffc&amp;pid_0027&amp;mi_01#9&amp;25a3b80d&amp;0&amp;0001#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\global"/>
<MIDIOUTPUT name="Nord Electro 5 MIDI" id="\\?\usb#vid_0ffc&amp;pid_0027&amp;mi_01#9&amp;1c901f15&amp;0&amp;0001#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\global"/>

the same keyboard has been inserted in three different USB port of the same PC. The parameter id is very similar, but differs for some characters that don’t allow us to recognize automatically the previous selected device.
Anyway, I’m quite confident that it’s possible to recognize each device parsing the id, using the “attributes” vid and pid - that are equal for each USB port (both MIDI Input/Output) - and the last “attribute” \global - that identifies the MIDI port of a Multiple MIDI device (for example, Montage instead of \global has \midi0 and \midi1).

Have anyone already experienced this issue?

Please share your experience here.

When investigating this I was pretty sure that there’s no way to get a consistent, unique ID for a MIDI device on Windows that doesn’t change with the USB port (using the Win32 API at least, it’s possible with WinRT) hence why it just provides the hardware identifier directly from Windows.

If you’re able to do this then I’ll happily take a look and get it merged in.