RWMidi is a class containing static methods to get a list of the available MIDI devices. You can ask RWMidi about available input and output devices. You can then use the methods on the returned objects to open an input or output midi port. RWMidi doesn't provide access to the available MIDI devices through an index number, but rather requires you to use the returned MidiDevice object. This is because the number of available devices can change between a call to the function listing the device and the call opening the device, which could potentially lead to an index mismatch.