incorporated fixes suggested by MarkOBrien on CodeProject: http://www.codeproject.com/Articles/6228/C-MIDI-Toolkit?msg=4534338#xx4534338xx