-
Notifications
You must be signed in to change notification settings - Fork 89
Description
I'm working on an editor for a hardware synthesizer connected via USB MIDI. Ideally, the device is connected all the time so the application finds it right from the start. In reality, a more mature approach is required, meaning that the synth can be connected or disconnected at any time the editor is running.
My question is here, what is the best way to achieve this? Of course, something has to run periodically in the background and scan the ports, since change notification is not supported yet. Should this be done in a separate thread or just called from the main thread at an interval?
As soon as the port becomes available, a connect must be performed. It seems, that the connect() method takes the ownership, so the scanner object loses it. Either some cloning is required or the scanner object needs to be instanciated newly on each iteration. What is the preferred way here?