LibKMid is a library that implements features to play MIDI events on MIDI devices. It also includes easy-to-use functions if all you want is play MIDI files in your application (for example, background music in a game), and a console MIDI player. The API is well documented, and the design is very simple for the most common uses.