typeNote (code 0)


A note with pitch, velocity and duration. When a Note event is sent to external Midi devices, actually a NoteOn message is first sent followed, after a delay specified by the duration, by a NoteOn with a velocity of 0 to end the note.

Note events have 3 fields numbered from 0 to 2 :

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)
2
Dur, a note duration from 0 to 215-1. (Field size : 2 bytes)


Creates a Note 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 Note(long date,short pitch,short vel,short duration,short chan,short port)
{
    MidiEvPtr e;

    if ( e = MidiNewEv( typeNote ) )     /* 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 Notes*/
        MidiSetField(e,1,vel);
        MidiSetField(e,2,dur);
    }
    return e;
}


Creates a Note 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 Note(long date,short pitch,short vel,short duration,short chan,short port)
{
    MidiEvPtr e;

    if ( e = MidiNewEv( typeNote ) )     /* 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 Notes */
        Vel(e)     = vel;
        Dur(e)     = dur;
    }
    return e;
}