# MIC_DoSamplingAsync

## C Specification

  `#include <nitro/spi.h>`

      MICResult MIC_DoSamplingAsync(
      MICSamplingType  type,
      void*            buf,
      MICCallback     callback,
      void*            arg );

## Arguments

`type` | Sampling type of the MICSamplingType enumerated type
`buf` | Pointer to the buffer where the sampling result is stored.
`callback` | Pointer to the callback function. This callback is called from within the interrupt handler.
`arg` | Argument to pass to the callback function.

## Return Values

Returns the enumerated-type `MICResult` process result. If the asynchronous process started normally, returns `MIC_RESULT_SUCCESS`. If the process fails for some reason, returns some other value.

## Description

Samples the microphone once asynchronously. This function issues a request to ARM7 to execute sampling and returns to the invoking program without waiting for a response from the ARM7 processor. To get the result from the processor, you must use the `result` argument. If the input volume exceeds the minimum or maximum value, the output data will be clamped. It is possible to adjust the input volume prior to sampling using the `PM_SetAmpGain` function. If this function fails, no operation is performed and no user callback function is called.

## Caution

This function asynchronously writes values to the buffer specified by the `buf` argument. Do not attempt to use the returned values until you have confirmed the completion of asynchronous processes by the user callback function.

## See Also

`MIC_DoSampling, PM_SetAmpGain`

## Revision History

06/27/2005 Added statement about callbacks being called from the interrupt handler.
01/11/2005 Revised return values.
08/10/2004 Added the description relating to the input volume.
06/01/2004 Initial version