flurry of activity, don't look at this horrible code, augh. Implementing the data structures and functions for Lua to pass MIDI events to the sequencer