DProcess events are automatically created by MidiDTask. They are used to realize time delayed function calls. Once the scheduling date is due, the routine is not automatically executed, but stored in a special list. It is the applications responsability to individually execute those pending tasks using MidiExec1DTask.
DProcess 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 DProcess event in the same way than MidiDTask.
MidiEvPtr MakeDTask ( TaskPtr proc, long date, short refNum, long arg1, long arg2, long arg3) { MidiEvPtr e; if ( e = MidiNewEv( typeDProcess ) )/* 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 differed task*/ } return e; }