In 2009 I had OS X and wanted to make a program to map HID inputs to MIDI signals, sent to the MIDI network layer of OS X.
Hidymidy was to be the solution to this. The project never reached completion, however I have preserved the source code for posterity.
The status of it was that I had created a working test app, featuring an On/Off button that played a single note.

The app was written in Objective-C using Apple's Mac OS X SDK.

Download the app or Browse the source code