How to deal with multiple identical MIDI USB devices

会有一股神秘感。 提交于 2019-12-05 00:02:49

问题


My c# application must use multiple identical USB MIDI interfaces which are all from the same manufacturer.

In device manager, all devices appear with the same driver name / CLSID - only the PNPDeviceID is different. When I list all MIDI inputs / outputs (using MIDI-dot-net), they appear as follows:

  • ACME-MIDI: Port 1
  • 1- ACME-MIDI: Port 1
  • 2- ACME-MIDI: Port 1

Unfortunately, those names are not always the same for the same device. The ports of device 1 appear sometimes as "ACME-MIDI: Port 1" and sometimes as "1-ACME: Port 1" (they change e.g. after a reboot).

I have used different ways trying to find what name belongs to what device (SetupDi, WMI, Win32_PnPSignedDriver, ...) but I either get the device ID OR the port names it reports, but I'm unable to find the reported MIDI port name (ACME-MIDI: Port n) using the device id or driver key.

Any suggestions?

Update

I'm still looking for a solution to list the Input / Output ports of a MIDI USB interface on a given port (e.g. using Windows API). Seems like this is quite tricky, that's why I start a bounty on this.


回答1:


Unfortunately, when using the MIDI APIs alone there is no way to differentiate the devices. You must rely on their name. Fortunately, while the devices order can change, it's my experience that this doesn't typically happen on reboot. However, as you have seen, it can.

I've handled this in the past in my own software by prompting the user to press a key or move a control knob on a device to differentiate them.



来源:https://stackoverflow.com/questions/27173703/how-to-deal-with-multiple-identical-midi-usb-devices

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!