Connect / Disconnect juce::MidiOutput

I am controling the LED Pads of a Launchpad Mini in my VST using a juce::MidiOutput. This works fine until the cable gets unplugged and plugged again. I am having trouble with reconnecting the MidiOutput.

With the juce::MidiInput, I had the same problem, but I fixxed it with a timercallback, which frequently checks for disconnections and adds/removes the MidiInputDeviceCallback… (I found the solution here)

So I expected, to also recall MidiOutput::openDevice, whenever the MidiInputDeviceCallback is newly added… but it does not seem to work…

m_midiOutDevice = juce::MidiOutput::openDevice(input.identifier);

But it does not work… Any suggestions?

okay, it works now!


Insted of trying to open the MidiOutput Device by the input.identifier, I open it by the output.identifier!

(first i thought, they were same… but maybe they are not somehow…)