A Note On message with pitch and velocity.
KeyOn events have 2 fields numbered from 0 to 1 :
0
- Pitch, a note number from 0 to 127. (Field size : 1 byte)
1
- Vel, a note velocity from 0 to 127. (Field size : 1 byte)
Creates a KeyOn event, and returns a pointer to the event or NIL if there is no more memory space. Fields are modified using MidiSetField instead of direct structure access.
MidiEvPtr KeyOn( long date, short pitch, short vel, short chan, short port) { MidiEvPtr e; if ( e = MidiNewEv( typeKeyOn ) ) /* 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; MidiSetField(e,0,pitch);/* These fields are particular to KeyOn */ MidiSetField(e,1,vel); } return e; }
Creates a KeyOn event and returns a pointer to the event or NIL if there is no more memory space. Fields are modified using direct structure access instead of MidiSetField.
MidiEvPtr KeyOn( long date, short pitch, short vel, short chan, short port) { MidiEvPtr e; if ( e = MidiNewEv( typeKeyOn ) ) /* 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; Pitch(e) = pitch; /* These fields are particular to KeyOn */ Vel(e) = vel; } return e; }