Open vooku opened 2 years ago
This addon was originally written with a simple "open some ports and run for awhile" approach without any deeper event handling. You are running into the need for this now. :)
ofxMidi doesn't do this automatically for you, but it should be possible. You would basically need to detect when a device is disconnected, then manually close/reopen all ports, possibly using the previous device name to find it's new index. I would suggest looking into the latest version of RtMidi which may have added some functionality to help, then we can look into strategies to add support within ofxMidi, at the very least some extra even handling:
https://www.music.mcgill.ca/~gary/rtmidi/
Note: The iOS implementation using PGMidi provides an ofxMidiConnectionListener
base class for receiving connection add/remove events, but this is leveraging the CoreMidi event system which works differently on other platforms.
https://github.com/danomatika/ofxMidi/blob/master/src/ofxMidi.h#L18
Thanks for the tips, I'll look into it when I get the opportunity
Hi, I've been using ofxMidi happily in my app vooku/skinny but come across this problem when implementing GUI for MIDI devices. I specifically encountered this on Windows.
When I connect multiple devices, they get a number appended to their name.
However if I disconnect one, the numbers get redistributed.
This poses a problem when I try to access the same device again (to disconnect), but have no persistent handle. Have I missed something? Is this because of one of the underlying libraries?
The MIDI input still works however, so there must be something below the layers that I have looked into.