typeProcess (code 128)


Process events are automatically created by MidiCall and MidiTask. They are used to realize time delayed function calls. The function call is achieved under interruption as soon as the scheduling date is due.

Process events have 4 fields numbered from 0 to 3 :

0
a TaskPtr, the address of the function to call. (Field size : 4 byte)
1
the first argument of the function. (Field size : 4 byte)
2
the second argument of the function. (Field size : 4 byte)
3
the third argument of the function. (Field size : 4 byte)


Creates a Process event in the same way than MidiTask.


MidiEvPtr MakeTask ( TaskPtr proc, long date, short refNum, long arg1,
                    long arg2, long arg3)
{
    MidiEvPtr e;

    if ( e = MidiNewEv( typeProcess ) )    /* Allocate a new event. Check not NIL */ 
    {
        MidiSetField(e, 0, (long)proc);    /* Fill the 4 fields */
        MidiSetField(e, 1, arg1);
        MidiSetField(e, 2, arg2);
        MidiSetField(e, 3, arg3);
        MidiSendAt(refNum, e, date);    /* and schedule the task */
    }
    return e;
}