-
Notifications
You must be signed in to change notification settings - Fork 96
Description
This is not a PR because I am not sure what would be the API change that would work on all supported platforms/libraries.
My suggestion would be to extend event type received by event hook from Vec<u8> with event data to something like
enum InputEvent {
Disconnected,
Midi(Vec<u8>)
}Watching for device connections/disconnection is a necessary feature. At the very least midir should close connection and notify user when target/source device disappears. Currently after device disconnected midir silently stops getting any new messages, and there is no way user can find what happened (except maybe watching ALSA or devices themself).
It looks like similar problem is there also on Windows.
Here is the patch I use for my project. It modifies input handler loop to return empty message when connection is closed. The program that uses this modified midir version is here.
If this approach is not worth looking into further then close this ticket. But I would argue that midir must be able to handle connection changes.