MIDI device onDisconnect?

@peterjungx - I’m no help here but thanks for the example code in your plugin on digging through the midi device list and setting that. That’s something I’ve been meaning to add to my stuff, not just for midi but for audio devices as well. Right now I have the user manually setting midi and two audio devices. That’s quite annoying and not the UX one would want. I’d be excited to solve that but I was curious on a couple points. (aside: somewhat related thread where @pachde had some useful comments that I’m yet to act on: Save/restore of module with multiple audio interfaces on MacOS )

  • Platform dependency: the strings that get returned can be/are platform dependent (per related thread). MIDI seems more stable than Audio interfaces, so maybe you’re not impacted so much.
  • Do you maintain a way for the user to manually set the device if the auto-connection fails or should be overridden?
  • If a second device is connected, is that supported? Or if a second PitchGrid module is instantiated, how is that handled?

I don’t have good solutions for much of any of this. Things work now, seems like it could be a lot smoother though. And the disconnect issue, your original point, is a thing. When I disconnect the USB Audio devices on Linux the CPU goes through the roof. While it’s annoying it’s not a huge issue as that’s usually right before I exit VCV Rack.