A MidiShare event. Most events are made of one fixed size cell. Some events like typeSysEx require additional cells.
typedef struct TMidiEv *MidiEvPtr; typedef struct TMidiEv { MidiEvPtr link; // link to next event unsigned long date; // event date (in ms) Byte evType; // event type Byte refNum; // sender reference number Byte port; // Midi port Byte chan; // Midi channel union { // info depending of event type : struct { // for notes Byte pitch; // pitch Byte vel; // velocity unsigned short dur; // duration } note; Byte data[4]; // for typeKeyOn and other small events MidiSEXPtr linkSE; // for typeSysEx and other variable length events MidiSTPtr linkST; // for typeProcess and other special events } info; } TMidiEv;
Macros for accessing the common parts of an event.
#define Link(e) ( (e)->link ) #define Date(e) ( (e)->date ) #define EvType(e) ( (e)->evType ) #define RefNum(e) ( (e)->refNum ) #define Port(e) ( (e)->port ) #define Canal(e) ( (e)->chan ) #define Chan(e) ( (e)->chan )
Macros for accessing the specific parts.
#define Pitch(e) ( (e)->info.note.pitch ) #define Vel(e) ( (e)->info.note.vel ) #define Dur(e) ( (e)->info.note.dur ) #define Data(e) ( (e)->info.data ) #define LinkSE(e) ( (e)->info.linkSE ) #define LinkST(e) ( (e)->info.linkST )
instead of these macros, you should use MidiGetField and MidiSetField which provides a uniform acces to the specific fields of an event.