MidiGetField


Gives the index field value of an event. Field index start from 0. Depending of the event type and field nature, the field format can be 8, 16 or 32-bit. MidiGetField deals with all the format conversion and the result is always a 32-bit integer.

pascal long    MidiGetField (MidiEvPtr e, long f);

e
a MidiEvPtr, it is a pointer to the event to be accessed.
f
a 32-bit integer, it is the field number to be read (numbered from 0).

The result is a 32-bit integer, the value of the field. Fields are considered as unsigned.


An universal method for printing of a MidiShare event.


void PrintEv(MidiEvPtr e)
{
    long i, n;

    n = MidiCountFields(e);
    printf( "Event %x content :\n", e );
    printf( " link : %x\n", Link(e) );
    printf( " date : %i\n", Date(e) );
    printf( " type : %i\n", EvType(e) );
    printf( "  ref : %i\n", RefNum(e) );
    printf( " port : %i\n", Port(e) );
    printf( " chan : %i\n", Chan(e) );
    printf( " %i fields ( ", n );
    for(i=0; i<n; ++i) printf("%i ",MidiGetField(e,i) );
    printf( ")\n" );
}

pitch (8-bit), velocity (8-bit) and duration (16-bit)). Some others, like system exclusives have a variable number of fields.