typeKeyPress (code 3)


A Polyphonic Key Pressure message with pitch and pressure.

KeyPress events have 2 fields numbered from 0 to 1 :

0
Pitch, a note number from 0 to 127. (Field size : 1 byte)
1
Press, a key pressure from 0 to 127. (Field size : 1 byte)


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

    if ( e = MidiNewEv( typeKeyPress ) )/* 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 KeyPress */
        MidiSetField(e,1,press);
    }
    return e;
}


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

    if ( e = MidiNewEv( typeKeyPress ) )/* 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 KeyPress*/
        Vel(e)     = press;    /* Same byte than velocity */
    }
    return e;
}