JUCE 8.0.8, Windows 10; Korg USB Midi Driver; Yamaha USB Midi Driver
I have a MIDI generating GUI app, that provides a list of MIDI Input and Output devices for connecting to (pretty standard).
I am using MidiDeviceListConnection::make() to provide a callback that should be called when a MIDI device is added or removed.
On MacOS, this seems to work perfectly as expected.
However, on Windows 10, it only works for certain devices. For example, disconnecting a Yamaha Motif XS triggers it. But connecting/disconnecting a Korg Device does not! Furthermore, MidiInput:: and MidiOutput::getAvailableDevices() do not report the correct connected devices!
If I launch my app with the KORG Device connected, it finds it with MidiInput or MidiOutput::getAvailableDevices(), and puts it in the list. If I then disconnect it, MidiDeviceListConnection is NOT triggered, and it remains in the list returned by getAvailableDevices(). But you cannot open it; it returns an error.
But even if I call getAvailableDevices() manually after disconnecting, it still thinks the Korg devices are there!
Likewise, if I launch my app with the Korg device disconnected, it does not appear in the AvailabledDevices list, and adding it does not trigger MidiDeviceListConnection or make it available.
Debugging into this, it is still finding the Korg devices in Win32MidiDeviceQuery() - even when they are physically disconnected and no longer show up in Windows Device Manager > Sound, video and game controllers.
Here is the Windows Device Manager with a Korg Kronos and a Yamaha Motif connected.
If I print out some info about the AvailableDevices at this moment (name, identifier), I get:
======= Midi Input Device List
index 0: KRONOS 2 KEYBOARD KRONOS 2 KEYBOARD
index 1: LoopBe Internal MIDI \\?\root#*loopbemidi1#0000#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\midi
index 2: x Yamaha MOTIF XS6-1 \\?\usb#vid_0499&pid_1042#6&23958b5d&0&2#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\yum_wdm10420
index 3: Yamaha MOTIF XS6-2 \\?\usb#vid_0499&pid_1042#6&23958b5d&0&2#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\yum_wdm10421
index 4: Yamaha MOTIF XS6-3 \\?\usb#vid_0499&pid_1042#6&23958b5d&0&2#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\yum_wdm10422
index 5: Yamaha MOTIF XS6-4 \\?\usb#vid_0499&pid_1042#6&23958b5d&0&2#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\yum_wdm10423
======= Midi Output Device List
index 0: Microsoft GS Wavetable Synth Microsoft GS Wavetable Synth
index 1: KRONOS 2 SOUND KRONOS 2 SOUND
index 2: LoopBe Internal MIDI \\?\root#*loopbemidi1#0000#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\midi
index 3: x Yamaha MOTIF XS6-1 \\?\usb#vid_0499&pid_1042#6&23958b5d&0&2#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\yum_wdm10420
index 4: Yamaha MOTIF XS6-2 \\?\usb#vid_0499&pid_1042#6&23958b5d&0&2#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\yum_wdm10421
index 5: Yamaha MOTIF XS6-3 \\?\usb#vid_0499&pid_1042#6&23958b5d&0&2#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\yum_wdm10422
index 6: Yamaha MOTIF XS6-4 \\?\usb#vid_0499&pid_1042#6&23958b5d&0&2#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\yum_wdm10423
It’s interesting that the Korg device has the same identifier as the name, but the Yamaha has these long identifiers. (The Yamaha has 4 ports).
So now, I physically disconnect the Korg USB. Immediately the Windows Device Manager changes to below. But nothing happens; MidiDeviceListConnection is NOT triggered.
Windows Device Manager (with Korg disconnected):
Printing out the availableDevices in my app shows nothing has changed - same as above. It still thinks the Korg is connected. But the Korg can no longer be opened.
Now, I quit my app, and I relaunch with the KORG disconnected. It is gone from the Windows Device Manager.
Printing out the AvailableDevices shows the KORG is gone:
======= Midi Input Device List
index 0: LoopBe Internal MIDI \\?\root#*loopbemidi1#0000#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\midi
index 1: x Yamaha MOTIF XS6-1 \\?\usb#vid_0499&pid_1042#6&23958b5d&0&2#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\yum_wdm10420
index 2: Yamaha MOTIF XS6-2 \\?\usb#vid_0499&pid_1042#6&23958b5d&0&2#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\yum_wdm10421
index 3: Yamaha MOTIF XS6-3 \\?\usb#vid_0499&pid_1042#6&23958b5d&0&2#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\yum_wdm10422
index 4: Yamaha MOTIF XS6-4 \\?\usb#vid_0499&pid_1042#6&23958b5d&0&2#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\yum_wdm10423
======= Midi Output Device List
index 0: Microsoft GS Wavetable Synth Microsoft GS Wavetable Synth
index 1: LoopBe Internal MIDI \\?\root#*loopbemidi1#0000#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\midi
index 2: x Yamaha MOTIF XS6-1 \\?\usb#vid_0499&pid_1042#6&23958b5d&0&2#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\yum_wdm10420
index 3: Yamaha MOTIF XS6-2 \\?\usb#vid_0499&pid_1042#6&23958b5d&0&2#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\yum_wdm10421
index 4: Yamaha MOTIF XS6-3 \\?\usb#vid_0499&pid_1042#6&23958b5d&0&2#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\yum_wdm10422
index 5: Yamaha MOTIF XS6-4 \\?\usb#vid_0499&pid_1042#6&23958b5d&0&2#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\yum_wdm10423
However, now the opposite is true. I physically plugin the Korg device. It immediately shows up in the Windows Device Manager, but triggers no callback to MidiDeviceListConnection, and cannot be located by getAvailableDevices().


