Probable misunderstanding of MIDI UID

Hello

On Mac, I am trying to address a specific MIDI in and out. Let’s say:

MIDIClient.init;
~inUID = MIDIClient.sources[0].uid;
~outUID = MIDIClient.destinations[0].uid;

Then I can
MIDIIn.connect(device: ~inUID);
and add functions with addFuncTo

but I can’t
~feedMIDI = MIDIOut.new(uid:~outUID);

The latter freaks out. If I do
~feedMIDI = MIDIOut.new(0);
with the same 0 as in my MIDIClient.destinations[0].uid above, it works.

Am I misunderstanding something, or is MIDIOut not accepting uid instead (as a more specific) port?

Any pointer welcome

I’m not on Mac so I can’t test, but: the help for MIDIOut.new says that uid is optional and it does not say that the port index is optional. So I conclude from this, and your error, that the port index is always required. But it would be better to get confirmation from someone on Mac.

“uid is optional; if specified, it should be the uid of that port ie. MIDIClient.destinations[port].uid” – now that’s funny; basically, the uid adds no useful functionality but it is an opportunity to make a mistake. So I would just avoid using this parameter.

hjh

1 Like

I was just pointing at an inconsistency - MIDIIn car deal with the UID and no port (since one is a subset of the other) but not MIDIOut - as an interface consistency freak, I just wanted to know if my assumptions were wrong.

In all cases, I’ll do for now what you say: ignore UID and use port but by name because the OS might add/remove/reorder the list as it does for audio devices…

p