[Contents] [Index] [Help] [Retrace] [Browse <] [Browse >]

An opendevice() must eventually be matched by a call to closedevice().

All I/O requests must be complete before CloseDevice().  If any requests
are still pending, abort them with abortio() :

  AbortIO((struct IORequest *)AudioIO);  /* Abort any pending requests */
  WaitPort(AudioMP);                     /* Wait for abort message */
  GetMsg(AudioMP);                       /* Get abort message */
  CloseDevice((struct IORequest *)AudioIO);

CloseDevice() performs an adcmd_free command on any channels selected by
the ioa_Request.io_Unit field of the ioaudio request.  this means that if
you close the device with the same IOAudio block that you used to allocate
your channels (or a copy of it), the channels will be automatically freed.

If you allocated channels with multiple allocation commands, you cannot
use this function to close all of them at once. Instead, you will have to
issue one adcmd_free command for each allocation that you made. after
issuing the ADCMD_FREE commands for each of the allocations, you can call
CloseDevice().