Developing a plugin with hw midi output port


I have been happily developing a VST plugin to control external hardware synths and discover I’ve fallen into a trap that must be common for newbies!
I’ve created a MidiOutputPanel class (inheriting from Component) which is a member of PluginEditor.h
The problem here is that when you hide the editor in the DAW, the destructor is called which destroys the midiport until you unhide the editor and it gets remade. Things work in practice (to a point) but not good to have this!
So my task now is to figure out what parts of this functionality can be in the editor.
I’m thinking that the MidiOutput object itself must be defined as part of PluginProcessor.h
The panel itself has a combo that interrogates the available ports and that this can still be in the editor. The property of the chosen port should be a plugin parameter rather than an ApplicationProperties.
Any hints appreciated!



Haven’t worked a lot with MIDI yet, but did you see the MIDI tutorial? I think that can have some use for you.
Tutorial apart, in the editor you only have the GUI, nothing related to any “real” functionality. That means that in the Editor you have all that sliders, combo boxes, buttons, and other visual components, and the getters and setters to update the parameters of the processor depending on what the user does with the interface (i.e change the midi output device from the menu). And in the processor you have all the parameters and the processing stuff, which in your case I guess includes the variables that define the state/availability of the midi ports to use.