MidiFreeEv


Frees a MidiShare event allocated with MidiNewEv. MidiFreeEv takes into account the event structure by checking the events type. For this reason, MidiFreeEv must not be used on cell allocated with MidiNewCell.

pascal void    MidiFreeEv (MidiEvPtr e);

e
a MidiEvPtr, it is a pointer to a MidiShare event.


A receive alarm that delete all the received events.


short    myRefNum;
.....

void DeleteAll( short refNum )
{
    MidiEvPtr    e;
    long n;

    for ( n = MidiCountEvs(refNum); n > 0; Ñn ) 
    {                                
        e = MidiGetEv( refNum );    /* Get an event from the FIFO */
        MidiFreeEv( e );            /* Then free it */
    }
}
......

MidiSetRcvAlarm( myRefNum, DeleteAll );    /* Activate the receive alarm */

For this example it would be simpler and faster to use MidiFlushEvs to achieve the same result.

MidiShare was originally developed for Pascal on the Macintosh. Therefore, in C, all function passed as arguments of a MidiShare function must be declared as Pascal. In the previous example, DeleteAll must be declared as :

pascal void DeleteAll( short refNum );