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

Fix names of UWP output devices when there's two or more of the same kind attached #321

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sagamusix
Copy link
Contributor

The UWP API does not always appear to deliver the correct names of output devices, which is already partially worked around by the RtMidi implementation. However, when there are two MIDI devices of the same kind attached (in my case two ESI M8U XLs), the output device name is not just "MIDI" but e.g. "2 - MIDI". This patch adds support for fixing up these names as well.

Maybe @trueroad could have a look at this since they introduced the original code and might have more insight into this issue than I do.

@sagamusix sagamusix force-pushed the fix-more-uwp-output-device-names branch from a987a64 to e730349 Compare September 11, 2023 13:06
@trueroad
Copy link
Contributor

I don't have two MIDI devices of the same kind.
However, in my experiment, on Windows 10 22H2 with two loopMIDI output ports, its port names are both "MIDI".
There seems to be some pattern in the naming of the wrong MIDI output device.
Maybe it depends on the version of Windows, language settings, MIDI driver type, etc.

https://forum.juce.com/t/winrt-midi-output-wrong-device-names/43301
shows "MIDI" and "MIDI-2" as wrong MIDI output device names.

@garyscavone
Copy link
Contributor

So, should I approve this or not?

@sagamusix
Copy link
Contributor Author

I would expect that loopMIDI, being a virtual device, behaves differently with individual ports. I was also in contact with the manufacturer of my MIDI interface and they said that Windows in general has issues with two identical USB devices being connected, which is where some of this confusion is coming from. loopMIDI not being a USB device would explain why it behaves differently.

@trueroad
Copy link
Contributor

I would expect that loopMIDI, being a virtual device, behaves differently with individual ports. I was also in contact with the manufacturer of my MIDI interface and they said that Windows in general has issues with two identical USB devices being connected, which is where some of this confusion is coming from. loopMIDI not being a USB device would explain why it behaves differently.

I cannot confirm that, but feel it is reasonable.

@insolace
Copy link
Contributor

If someone can provide some test code that compiles in visual studio then I can connect a dozen of our controllers and provide port names from debug output.

@trueroad
Copy link
Contributor

If someone can provide some test code that compiles in visual studio then I can connect a dozen of our controllers and provide port names from debug output.

If you use python winrt, this script outputs WinRT MIDI device names.
https://gist.github.com/trueroad/4185ae60bcd8cb038321f849e9053159

Here is results of my Windows 10 22H2 Japanese environment.

>python winrt_midi_devices.py
WinRT MIDI Devices with python winrt

https://gist.github.com/trueroad/4185ae60bcd8cb038321f849e9053159

Copyright (C) 2023 Masamichi Hosoda.
All rights reserved.


MIDI IN ports

***** IN 0 *****
*** Name ***
M4U eX 7 [1]
b'M4U eX 7 [1]'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_0F7998BC.P_0004#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}
b'\\\\?\\SWD#MMDEVAPI#MIDII_0F7998BC.P_0004#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}'
**********

***** IN 1 *****
*** Name ***
M4U eX 4 [1]
b'M4U eX 4 [1]'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_0F7998B9.P_0004#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}
b'\\\\?\\SWD#MMDEVAPI#MIDII_0F7998B9.P_0004#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}'
**********

***** IN 2 *****
*** Name ***
M4U eX 6 [1]
b'M4U eX 6 [1]'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_0F7998BB.P_0004#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}
b'\\\\?\\SWD#MMDEVAPI#MIDII_0F7998BB.P_0004#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}'
**********

***** IN 3 *****
*** Name ***
loopMIDI Port 1 [1]
b'loopMIDI Port 1 [1]'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_0AB1A389.P_0004#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}
b'\\\\?\\SWD#MMDEVAPI#MIDII_0AB1A389.P_0004#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}'
**********

***** IN 4 *****
*** Name ***
M4U eX 3 [1]
b'M4U eX 3 [1]'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_0F7998B8.P_0004#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}
b'\\\\?\\SWD#MMDEVAPI#MIDII_0F7998B8.P_0004#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}'
**********

***** IN 5 *****
*** Name ***
M4U eX 5 [1]
b'M4U eX 5 [1]'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_0F7998BA.P_0004#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}
b'\\\\?\\SWD#MMDEVAPI#MIDII_0F7998BA.P_0004#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}'
**********

***** IN 6 *****
*** Name ***
loopMIDI Port [1]
b'loopMIDI Port [1]'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_0AB1A388.P_0004#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}
b'\\\\?\\SWD#MMDEVAPI#MIDII_0AB1A388.P_0004#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}'
**********

***** IN 7 *****
*** Name ***
M4U eX 2 [1]
b'M4U eX 2 [1]'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_0F7998B7.P_0004#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}
b'\\\\?\\SWD#MMDEVAPI#MIDII_0F7998B7.P_0004#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}'
**********

***** IN 8 *****
*** Name ***
M4U eX 1 [1]
b'M4U eX 1 [1]'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_0F7998B6.P_0004#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}
b'\\\\?\\SWD#MMDEVAPI#MIDII_0F7998B6.P_0004#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}'
**********

***** IN 9 *****
*** Name ***
M4U eX 8 [1]
b'M4U eX 8 [1]'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_0F7998BD.P_0004#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}
b'\\\\?\\SWD#MMDEVAPI#MIDII_0F7998BD.P_0004#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}'
**********

***** IN 10 *****
*** Name ***
MD-BT01 (Bluetooth MIDI IN)
b'MD-BT01 (Bluetooth MIDI IN)'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_8D0FFA62.BLE10#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}
b'\\\\?\\SWD#MMDEVAPI#MIDII_8D0FFA62.BLE10#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}'
**********

***** IN 11 *****
*** Name ***
U6MIDI Pro [1]
b'U6MIDI Pro [1]'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_ADB55808.P_0001#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}
b'\\\\?\\SWD#MMDEVAPI#MIDII_ADB55808.P_0001#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}'
**********

***** IN 12 *****
*** Name ***
U6MIDI Pro [3]
b'U6MIDI Pro [3]'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_ADB55808.P_0003#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}
b'\\\\?\\SWD#MMDEVAPI#MIDII_ADB55808.P_0003#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}'
**********

***** IN 13 *****
*** Name ***
U6MIDI Pro [5]
b'U6MIDI Pro [5]'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_ADB55808.P_0005#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}
b'\\\\?\\SWD#MMDEVAPI#MIDII_ADB55808.P_0005#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}'
**********

***** IN 14 *****
*** Name ***
2 - WIDI Uhost [1]
b'2 - WIDI Uhost [1]'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_9C4EBEC9.P_0001#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}
b'\\\\?\\SWD#MMDEVAPI#MIDII_9C4EBEC9.P_0001#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}'
**********

MIDI OUT ports

***** OUT 0 *****
*** Name ***
MIDI
b'MIDI'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_0F7998BA.P_0000#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}
b'\\\\?\\SWD#MMDEVAPI#MIDII_0F7998BA.P_0000#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}'
**********

***** OUT 1 *****
*** Name ***
MIDI
b'MIDI'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_0AB1A388.P_0000#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}
b'\\\\?\\SWD#MMDEVAPI#MIDII_0AB1A388.P_0000#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}'
**********

***** OUT 2 *****
*** Name ***
MIDI
b'MIDI'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_0F7998B7.P_0000#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}
b'\\\\?\\SWD#MMDEVAPI#MIDII_0F7998B7.P_0000#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}'
**********

***** OUT 3 *****
*** Name ***
Microsoft GS Wavetable Synth
b'Microsoft GS Wavetable Synth'
*** ID ***
\\?\SWD#MMDEVAPI#MicrosoftGSWavetableSynth#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}
b'\\\\?\\SWD#MMDEVAPI#MicrosoftGSWavetableSynth#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}'
**********

***** OUT 4 *****
*** Name ***
MIDI
b'MIDI'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_0F7998B6.P_0000#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}
b'\\\\?\\SWD#MMDEVAPI#MIDII_0F7998B6.P_0000#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}'
**********

***** OUT 5 *****
*** Name ***
MIDI
b'MIDI'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_0F7998BD.P_0000#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}
b'\\\\?\\SWD#MMDEVAPI#MIDII_0F7998BD.P_0000#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}'
**********

***** OUT 6 *****
*** Name ***
MIDI
b'MIDI'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_0F7998BC.P_0000#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}
b'\\\\?\\SWD#MMDEVAPI#MIDII_0F7998BC.P_0000#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}'
**********

***** OUT 7 *****
*** Name ***
MIDI
b'MIDI'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_0F7998B9.P_0000#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}
b'\\\\?\\SWD#MMDEVAPI#MIDII_0F7998B9.P_0000#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}'
**********

***** OUT 8 *****
*** Name ***
MIDI
b'MIDI'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_0F7998BB.P_0000#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}
b'\\\\?\\SWD#MMDEVAPI#MIDII_0F7998BB.P_0000#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}'
**********

***** OUT 9 *****
*** Name ***
MIDI
b'MIDI'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_0AB1A389.P_0000#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}
b'\\\\?\\SWD#MMDEVAPI#MIDII_0AB1A389.P_0000#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}'
**********

***** OUT 10 *****
*** Name ***
MIDI
b'MIDI'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_0F7998B8.P_0000#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}
b'\\\\?\\SWD#MMDEVAPI#MIDII_0F7998B8.P_0000#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}'
**********

***** OUT 11 *****
*** Name ***
MD-BT01 (Bluetooth MIDI OUT)
b'MD-BT01 (Bluetooth MIDI OUT)'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_8D0FFA63.BLE10#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}
b'\\\\?\\SWD#MMDEVAPI#MIDII_8D0FFA63.BLE10#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}'
**********

***** OUT 12 *****
*** Name ***
U6MIDI Pro [0]
b'U6MIDI Pro [0]'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_ADB55808.P_0000#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}
b'\\\\?\\SWD#MMDEVAPI#MIDII_ADB55808.P_0000#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}'
**********

***** OUT 13 *****
*** Name ***
U6MIDI Pro [2]
b'U6MIDI Pro [2]'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_ADB55808.P_0002#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}
b'\\\\?\\SWD#MMDEVAPI#MIDII_ADB55808.P_0002#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}'
**********

***** OUT 14 *****
*** Name ***
U6MIDI Pro [4]
b'U6MIDI Pro [4]'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_ADB55808.P_0004#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}
b'\\\\?\\SWD#MMDEVAPI#MIDII_ADB55808.P_0004#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}'
**********

***** OUT 15 *****
*** Name ***
2 - WIDI Uhost [0]
b'2 - WIDI Uhost [0]'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_9C4EBEC9.P_0000#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}
b'\\\\?\\SWD#MMDEVAPI#MIDII_9C4EBEC9.P_0000#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}'
**********

>

@trueroad
Copy link
Contributor

trueroad commented Sep 20, 2023

I changed the USB port to which each device is connected.
This seems to change the presence or absence of the name prefix 2 - when using the USB MIDI class driver (U6MIDI Pro and WIDI Uhost in this environment).
M4U eX uses a dedicated driver, not the class driver.

>python winrt_midi_devices.py
WinRT MIDI Devices with python winrt

https://gist.github.com/trueroad/4185ae60bcd8cb038321f849e9053159

Copyright (C) 2023 Masamichi Hosoda.
All rights reserved.


MIDI IN ports

***** IN 0 *****
*** Name ***
M4U eX 7 [1]
b'M4U eX 7 [1]'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_0F7998BC.P_0004#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}
b'\\\\?\\SWD#MMDEVAPI#MIDII_0F7998BC.P_0004#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}'
**********

***** IN 1 *****
*** Name ***
M4U eX 4 [1]
b'M4U eX 4 [1]'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_0F7998B9.P_0004#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}
b'\\\\?\\SWD#MMDEVAPI#MIDII_0F7998B9.P_0004#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}'
**********

***** IN 2 *****
*** Name ***
M4U eX 6 [1]
b'M4U eX 6 [1]'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_0F7998BB.P_0004#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}
b'\\\\?\\SWD#MMDEVAPI#MIDII_0F7998BB.P_0004#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}'
**********

***** IN 3 *****
*** Name ***
loopMIDI Port 1 [1]
b'loopMIDI Port 1 [1]'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_0AB1A389.P_0004#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}
b'\\\\?\\SWD#MMDEVAPI#MIDII_0AB1A389.P_0004#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}'
**********

***** IN 4 *****
*** Name ***
M4U eX 3 [1]
b'M4U eX 3 [1]'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_0F7998B8.P_0004#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}
b'\\\\?\\SWD#MMDEVAPI#MIDII_0F7998B8.P_0004#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}'
**********

***** IN 5 *****
*** Name ***
M4U eX 5 [1]
b'M4U eX 5 [1]'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_0F7998BA.P_0004#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}
b'\\\\?\\SWD#MMDEVAPI#MIDII_0F7998BA.P_0004#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}'
**********

***** IN 6 *****
*** Name ***
loopMIDI Port [1]
b'loopMIDI Port [1]'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_0AB1A388.P_0004#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}
b'\\\\?\\SWD#MMDEVAPI#MIDII_0AB1A388.P_0004#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}'
**********

***** IN 7 *****
*** Name ***
M4U eX 2 [1]
b'M4U eX 2 [1]'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_0F7998B7.P_0004#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}
b'\\\\?\\SWD#MMDEVAPI#MIDII_0F7998B7.P_0004#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}'
**********

***** IN 8 *****
*** Name ***
M4U eX 1 [1]
b'M4U eX 1 [1]'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_0F7998B6.P_0004#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}
b'\\\\?\\SWD#MMDEVAPI#MIDII_0F7998B6.P_0004#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}'
**********

***** IN 9 *****
*** Name ***
M4U eX 8 [1]
b'M4U eX 8 [1]'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_0F7998BD.P_0004#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}
b'\\\\?\\SWD#MMDEVAPI#MIDII_0F7998BD.P_0004#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}'
**********

***** IN 10 *****
*** Name ***
MD-BT01 (Bluetooth MIDI IN)
b'MD-BT01 (Bluetooth MIDI IN)'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_8D0FFA62.BLE10#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}
b'\\\\?\\SWD#MMDEVAPI#MIDII_8D0FFA62.BLE10#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}'
**********

***** IN 11 *****
*** Name ***
WIDI Uhost [1]
b'WIDI Uhost [1]'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_8A941597.P_0001#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}
b'\\\\?\\SWD#MMDEVAPI#MIDII_8A941597.P_0001#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}'
**********

***** IN 12 *****
*** Name ***
2 - U6MIDI Pro [1]
b'2 - U6MIDI Pro [1]'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_58CEA970.P_0001#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}
b'\\\\?\\SWD#MMDEVAPI#MIDII_58CEA970.P_0001#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}'
**********

***** IN 13 *****
*** Name ***
2 - U6MIDI Pro [3]
b'2 - U6MIDI Pro [3]'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_58CEA970.P_0003#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}
b'\\\\?\\SWD#MMDEVAPI#MIDII_58CEA970.P_0003#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}'
**********

***** IN 14 *****
*** Name ***
2 - U6MIDI Pro [5]
b'2 - U6MIDI Pro [5]'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_58CEA970.P_0005#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}
b'\\\\?\\SWD#MMDEVAPI#MIDII_58CEA970.P_0005#{504be32c-ccf6-4d2c-b73f-6f8b3747e22b}'
**********

MIDI OUT ports

***** OUT 0 *****
*** Name ***
MIDI
b'MIDI'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_0F7998BA.P_0000#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}
b'\\\\?\\SWD#MMDEVAPI#MIDII_0F7998BA.P_0000#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}'
**********

***** OUT 1 *****
*** Name ***
MIDI
b'MIDI'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_0AB1A388.P_0000#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}
b'\\\\?\\SWD#MMDEVAPI#MIDII_0AB1A388.P_0000#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}'
**********

***** OUT 2 *****
*** Name ***
MIDI
b'MIDI'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_0F7998B7.P_0000#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}
b'\\\\?\\SWD#MMDEVAPI#MIDII_0F7998B7.P_0000#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}'
**********

***** OUT 3 *****
*** Name ***
Microsoft GS Wavetable Synth
b'Microsoft GS Wavetable Synth'
*** ID ***
\\?\SWD#MMDEVAPI#MicrosoftGSWavetableSynth#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}
b'\\\\?\\SWD#MMDEVAPI#MicrosoftGSWavetableSynth#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}'
**********

***** OUT 4 *****
*** Name ***
MIDI
b'MIDI'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_0F7998B6.P_0000#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}
b'\\\\?\\SWD#MMDEVAPI#MIDII_0F7998B6.P_0000#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}'
**********

***** OUT 5 *****
*** Name ***
MIDI
b'MIDI'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_0F7998BD.P_0000#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}
b'\\\\?\\SWD#MMDEVAPI#MIDII_0F7998BD.P_0000#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}'
**********

***** OUT 6 *****
*** Name ***
MIDI
b'MIDI'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_0F7998BC.P_0000#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}
b'\\\\?\\SWD#MMDEVAPI#MIDII_0F7998BC.P_0000#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}'
**********

***** OUT 7 *****
*** Name ***
MIDI
b'MIDI'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_0F7998B9.P_0000#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}
b'\\\\?\\SWD#MMDEVAPI#MIDII_0F7998B9.P_0000#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}'
**********

***** OUT 8 *****
*** Name ***
MIDI
b'MIDI'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_0F7998BB.P_0000#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}
b'\\\\?\\SWD#MMDEVAPI#MIDII_0F7998BB.P_0000#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}'
**********

***** OUT 9 *****
*** Name ***
MIDI
b'MIDI'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_0AB1A389.P_0000#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}
b'\\\\?\\SWD#MMDEVAPI#MIDII_0AB1A389.P_0000#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}'
**********

***** OUT 10 *****
*** Name ***
MIDI
b'MIDI'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_0F7998B8.P_0000#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}
b'\\\\?\\SWD#MMDEVAPI#MIDII_0F7998B8.P_0000#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}'
**********

***** OUT 11 *****
*** Name ***
MD-BT01 (Bluetooth MIDI OUT)
b'MD-BT01 (Bluetooth MIDI OUT)'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_8D0FFA63.BLE10#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}
b'\\\\?\\SWD#MMDEVAPI#MIDII_8D0FFA63.BLE10#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}'
**********

***** OUT 12 *****
*** Name ***
WIDI Uhost [0]
b'WIDI Uhost [0]'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_8A941597.P_0000#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}
b'\\\\?\\SWD#MMDEVAPI#MIDII_8A941597.P_0000#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}'
**********

***** OUT 13 *****
*** Name ***
2 - U6MIDI Pro [0]
b'2 - U6MIDI Pro [0]'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_58CEA970.P_0000#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}
b'\\\\?\\SWD#MMDEVAPI#MIDII_58CEA970.P_0000#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}'
**********

***** OUT 14 *****
*** Name ***
2 - U6MIDI Pro [2]
b'2 - U6MIDI Pro [2]'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_58CEA970.P_0002#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}
b'\\\\?\\SWD#MMDEVAPI#MIDII_58CEA970.P_0002#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}'
**********

***** OUT 15 *****
*** Name ***
2 - U6MIDI Pro [4]
b'2 - U6MIDI Pro [4]'
*** ID ***
\\?\SWD#MMDEVAPI#MIDII_58CEA970.P_0004#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}
b'\\\\?\\SWD#MMDEVAPI#MIDII_58CEA970.P_0004#{6dc23320-ab33-4ce4-80d4-bbb3ebbf2814}'
**********

>

@Psychlist1972
Copy link

Psychlist1972 commented Sep 22, 2023

I would expect that loopMIDI, being a virtual device, behaves differently with individual ports. I was also in contact with the manufacturer of my MIDI interface and they said that Windows in general has issues with two identical USB devices being connected, which is where some of this confusion is coming from. loopMIDI not being a USB device would explain why it behaves differently.

Windows doesn't have any more problems with two of the same device than any other OS. But this is why manufacturers should actually supply a USB serial number.
https://devblogs.microsoft.com/windows-music-dev/the-importance-of-including-a-unique-iserialnumber-in-your-usb-midi-devices/

Edit: @trueroad this is likely why you see name changes when you plug a device into a different USB port.

But naming in WinRT MIDI is...not good. The code paths to handle all the workarounds for different devices which provide names in different ways is not working the way I'd personally like to see it work.

Pete

@trueroad
Copy link
Contributor

@Psychlist1972
What are the naming rules for current WinRT MIDI when a MIDI output port name is wrong, such as MIDI instead of using the name provided by the device?
In my environment, there is just MIDI.
In @sagamusix environment, there is 2 - MIDI.
https://forum.juce.com/t/winrt-midi-output-wrong-device-names/43301 shows MIDI-2.

Do these follow the rules for the wrong naming rule?
Are there other wrong name?

Can we use regex like (\d - )?MIDI(-\d)? to detect the wrong port names?

@Psychlist1972
Copy link

@Psychlist1972 What are the naming rules for current WinRT MIDI when a MIDI output port name is wrong, such as MIDI instead of using the name provided by the device? In my environment, there is just MIDI. In @sagamusix environment, there is 2 - MIDI. https://forum.juce.com/t/winrt-midi-output-wrong-device-names/43301 shows MIDI-2.

Do these follow the rules for the wrong naming rule? Are there other wrong name?

Can we use regex like (\d - )?MIDI(-\d)? to detect the wrong port names?

I took a look at that code before responding earlier tonight. Problem is, it's across a number of different COM interfaces so I couldn't provide you a table of exactly how it works, because I don't yet fully understand that myself.

All I can say is that when WinRT MIDI's implementation and enumeration gets pointed to Windows MIDI Services in 2024, the names will all be fixed and will be the same. That code is all OSS from the driver to the API, so anyone will be able to see how it's done.

Note that there are devices which legitimately include the word "MIDI" in different positions in the name. I'm not sure how that will work with the algorithms discussed here.

Pete

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants