A System Exclusive message.
SysEx events have a variable number of fields. The leading F0 and tailing F7 codes MUST NOT be included. They are automatically supplied by MidiShare. The channel field of the event is OR'ed with the first data byte after the manufacturer ID. This works for setting the channel of many system exclusive messages.
Creates a SysEx event from an array of shorts and returns a pointer to the event or NIL if there is no more memory space.
MidiEvPtr SysEx ( long date, short len, short *p, short chan, short port) { MidiEvPtr e; short c; if ( e = MidiNewEv( typeSysEx ) ) /* Allocate a new event. Check not NIL */ { Date(e) = date; /* These information are common to all */ Chan(e) = chan; /* kind of events */ Port(e) = port; c = len+1; while (--c) MidiAddField(e,*p++); if (MidiCountFields(e) < len ) /* if event smaller than len then*/ { MidiFreeEv(e); /* we run out of memory, free it */ e = nil; /* and return nil */ } } return e; }