never changes after application is initialised even when MIDI devices are connected or disconnected. Application needs to be reconnected to discover new connections.
The class com.purplepip.odin.midi.MidiDeviceWrapper was created to allow rediscovery, but it does not work on Mac OS. It has not been tested on any other OS.
Background
This issue has been reported elsewhere
JDK-8139153 where a bug 24030635 was raised with Apple on 01/01/2016 - note that I can't see the progress of this bug raised with Apple.
Java sound api - Scanning for midi devices where it suggests the issue might be related to JDK13Services caching. I don't believe that is the case, it's more that the native calls don't change their value as demonstrated by direct calls to the native methods, e.g. the following always returns the same value.
Juce 14851 where a similar issue is reported outside of Java. Note that that team resolved the issue and discusses the importance of calling the Mac OS native API MIDIClientCreate in the main thread otherwise the MIDINotifyProc will not send status updates.
The observation that Juce has resolved the issue could suggest that it is not a core Apple bug and perhaps the JDK is not calling MIDIClientCreate correctly. Note that MIDINotifyProc API docs do state that the "MIDINotifyProc callback function is invoked on the same thread on which you called the MIDIClientCreate function." and is called "when the MIDI state changes.". Perhaps in the JDK this callback is not fired correctly.
The osxmidi4j provides a native MIDI integration which might be different to the Core Java implementation. I wonder whether that library encounters the same issue.
Call to
never changes after application is initialised even when MIDI devices are connected or disconnected. Application needs to be reconnected to discover new connections.
The class com.purplepip.odin.midi.MidiDeviceWrapper was created to allow rediscovery, but it does not work on Mac OS. It has not been tested on any other OS.
Background
This issue has been reported elsewhere
The observation that Juce has resolved the issue could suggest that it is not a core Apple bug and perhaps the JDK is not calling MIDIClientCreate correctly. Note that MIDINotifyProc API docs do state that the "MIDINotifyProc callback function is invoked on the same thread on which you called the MIDIClientCreate function." and is called "when the MIDI state changes.". Perhaps in the JDK this callback is not fired correctly.
The osxmidi4j provides a native MIDI integration which might be different to the Core Java implementation. I wonder whether that library encounters the same issue.
Environment
macOS 10.11.6 and 10.12.4 Java 1.8.0_66-b17