MidiSetField


Attributes a value to a field of an event. The access to the compulsory fields of the event is done directly. But the access to the variables fields is achieved through the MidiSetField and MidiGetField functions. The function deals with the conversion of this value into the concerned field format (8, 16 or 32-bit).

pascal void MidiSetField( MidiEvPtr e, long f, long v );

e
a MidiEvPtr, a pointer to the event to be modified.
f
a 32-bit integer, the index number of the field to modify ( from 0 to MidiCountFields(e)-1 ).
v
a 32-bit value to put in the field. This value will be converted to the right size (8, 16 or 32-bit).


A function for creating note events.


MidiEvPtr Note(long date, short pitch, short vel, long dur, short chan, short port)
{
    MidiEvPtr e;
    
    if ( e=MidiNewEv(typeNote) )
    {
        Date(e) = date; 
        Chan(e) = chan;
        Port(e) = port;
        MidiSetField(e, 0, pitch);
        MidiSetField(e, 1, vel);
        MidiSetField(e, 2, dur);
    }
    return e;
}