Some MIDI devices have several ports. For example, under Linux,
$ amidi -l
Dir Device Name
IO hw:1,0,0 Launchpad X MIDI 1
IO hw:1,0,1 Launchpad X MIDI 2
shows that Launchpad X makes two MIDI ports available: 1 and 2. The user guide names these ports in the same way, telling that each has its specific function.
But when I use MidiSystem.getMidiDeviceInfo()
on the same system, all I get is X [hw:1,0,0]
and X [hw:1,0,1]
. No trace of explicit MIDI 1
and MIDI 2
or something similar. The latter is also true for MidiDevice.getDeviceInfo().getName()
and MidiDevice.getDeviceInfo().getDescription()
. I might parse the [hw:1,0,X]
part of each name and assume that the port number is X + 1
but I have doubts about the portability of such a solution.
How to know a MIDI device's port number (in the device's own numbering) in Java?