UWP shows wrong MIDI device names

Max Meier 0 Reputation points
2023-01-17T10:38:31.89+00:00

Hey there!

UWP shows wrong names for most MIDI devices! Many ports are just called "MIDI" - which makes this library almost completely usable in any App.

For example, loading output device information is done like this:

DeviceInformationCollection midiOutputDevices = await DeviceInformation.FindAllAsync(MidiOutPort.GetDeviceSelector());

The name of more than half of my IO ports is "MIDI" - however, any other application shows the right and meaningful name!

I searched for the problem and it seems to have been around for years.

Is there any way to fix this or do you hopefully plan to fix this eventually? This would be so great, because this seems just like some easy-fixable little problem - with the effect of being a real showstopper...

Thanks & best,

Max

Universal Windows Platform (UWP)
{count} votes

1 answer

Sort by: Most helpful
  1. Trienco 0 Reputation points
    2024-05-22T15:58:23.27+00:00

    A bit late, but I ran into the same problem and had to spend most of my afternoon trying to figure out how to get from the port to the device. In the end it's fairly trivial, and I wonder how this is neither properly mentioned in the documentation nor a response to be found online:

    The name isn't wrong. If you look at your device manager, you will find that the midi device contains several ports. You enumerate the ports and get the names of the ports. To get the device, you have to move up in the hierarchy. While this snippet is C++, it should still show the concept, which is:

    -enumerate port (or set up watcher)

    -query container id

    -create device information for container id

    -use that name (in combination with the port name, if the device has multiple ports, otherwise it will get very confusing when you list the same name multiple times)

    // port is assumed to be the DeviceInformation object for the enumerated port
    const auto container_id = port.Properties().Lookup(L"System.Devices.ContainerId").as<winrt::guid>();
    const auto device = DeviceInformation::CreateFromIdAsync(to_hstring(container_id), {}, DeviceInformationKind::DeviceContainer).get();
    const auto device_name = to_string(device.Name());
    

    Based on that I'm surprised this was considered a bug/issue other than "why is the documentation not clearly pointing that out?"

    0 comments No comments