Gives the number of events on wait into the reception FIFO of the application.
![]()
pascal long MidiCountEvs (short refnum);
![]()
refNum- a 16-bit integer, the reference number of the application.
![]()
The result is a 32-bit integer, the number of waiting events in the reception FIFO.
A receive alarm that processes all the received events by adding to their date a one second delay.
void OneSecDelay (short refNum)
{
MidiEvPtr e;
long n;
for ( n = MidiCountEvs(refNum); n > 0; Ñn )
{
e = MidiGetEv(refNum); /* Get an event from the FIFO */
Date(e) += 1000; /* Add 1000 ms to its date */
MidiSend(refNum,e); /* Then send the event */
}
}
/* ....... */
MidiSetRcvAlarm(myRefNum,OneSecDelay);/* Activate the receive alarm */
such a function can be called repeatedly in the main event loop of the application, but for really accurate time control, it must be installed as a receive alarm with MidiSetRcvAlarm.
MidiShare was originally developed for Pascal on the Macintosh. Therefore, in C, all procedures passed as arguments of a MidiShare function must be declared as Pascal. In the previous example, OneSecDelay must be declared as :
pascal void OneSecDelay (short refNum);