Here’s my problem - I’m attempting to develop an application (currently on macOS but eventually Windows too) that needs to distinguish between two identical MIDI controllers. I can’t use the MidiInput device names as these will be the same, and I’ve found that I can’t use the MidiInput device index as the order of these won’t necessarily be the order that you connect the devices (e.g. if I’ve connected a device called ‘foo’ which has an index of 0, when connecting a second device called ‘foo’ it may be set to index 1, or it may be set to index 0 and push the 1st ‘foo’ to index 1). From what I can see, there is currently no way in the JUCE library to get any kind of unique identifier for each MidiInput/MidiOutput device.
From looking at juce_mac_CoreMidi.cpp and the CoreMIDI library I’ve found that the CoreMIDI MIDIGetSource() function will return a unique number, and so far using this appears to fix my problem.
Is there any reason why using MIDIGetSource() to get a unique identifier is a bad idea?
Are there any alternative options? I tried using the kMIDIPropertyUniqueID parameter but this always appears to return any empty string.
I haven’t yet tested this on Windows yet, but assuming I’ll run into the same problems is there an alternative to MIDIGetSource() in the Windows MIDI library?