Sends an event. A copy of the event is sent to all the application destinations. The date field of the event is used to specify when the destinations will actually receive the event.
![]()
pascal void MidiSend( short refNum, MidiEvPtr e );
![]()
refNum- a 16-bit integer, it is the reference number of the application.
e- a MidiEvePtr, it is a pointer to the event to send.
A receive alarm that processes all the received events by adding a one second delay to their date.
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. Consequently, in C, all functions 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);