typePitchWheel (code 7)


A Pitch Bender message with a 14 bits resolution.

PitchWheel events have 2 fields numbered from 0 to 1 :

0
LS 7-Bits of 14-bits pitch swing, from 0 to 127. (Field size : 1 byte)
1
MS 7-Bits of 14-bits pitch swing, from 0 to 127. (Field size : 1 byte)


Creates a PitchWheel event with a parameter between -8192 and 8191. This returns a pointer to the event or NIL if there is no more memory space.


MidiEvPtr PitchWheel( long date, short wheel, short chan, short port)
{
    const offset = 8192;
    const min = -8192;
    const max = 8191;
    MidiEvPtr e;

    wheel = (wheel>max) ? max : (wheel<min) ? min : wheel;

    if ( e = MidiNewEv( typePitchWheel ) )    /* 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,(wheel+offset) & 0x7F);    /* LS-7bits Field */
        MidiSetField(e,1,(wheel+offset)>>7 & 0x7F);    /* MS-7bits Field */
    }
    return e;
}