rtmidi (crossplatform realtime MIDI library)

RtMidi is a set of C++ classes (RtMidiIn, RtMidiOut, and API specific
classes) that provide a common API for realtime MIDI input/output
across Linux (ALSA, JACK), Macintosh OS X (CoreMIDI, JACK), and
Windows (Multimedia Library) operating systems. RtMidi significantly
simplifies the process of interacting with computer MIDI hardware and
software.

Optional dependency: jack (autodetected). If jack is installed when
rtmidi is built, rtmidi will be built with jack support. If you have
jack installed and don't want to build rtmidi jack support, export
JACK=no in the environment.
