# SNDEX_SetI2SFrequencyAsync

## Syntax

  `#include <twl/snd.h>`

      SNDEXResult SNDEX_SetI2SFrequencyAsync( SNDEXFrequency freq, SNDEXCallback callback, void* arg );

## Arguments

freq | I2S operating frequency as a `SNDEXFrequency` enumerated type.
callback | `SNDEXCallback`-type function that is notified when the asynchronous process has completed. The asynchronous process runs even if `NULL` is specified here, but you are no longer able to detect that it has completed.
arg | Argument to pass to the function specified in callback.

## Return Values

### Function Return Values

`SNDEX_RESULT_SUCCESS` | Asynchronous processing started successfully. The asynchronous processing results are passed as an argument to the function registered in callback.
`SNDEX_RESULT_ILLEGAL_STATE` | Returned when this function is called on the NITRO platform or when the codec is running in CODEC-DS mode.
`SNDEX_RESULT_INVALID_PARAM` | The value specified for freq is not included in the standard values.
`SNDEX_RESULT_BEFORE_INIT` | Extended sound features have not been initialized by the `SNDEX_Init` function.
`SNDEX_RESULT_EXCLUSIVE` | Processing for other extended sound features is running. Note that mutexes are used for each of the extended sound features, so they cannot be used simultaneously. As mentioned in the SNDEX Library Overview, the error also returns during processing of shutter sound playback.
`SNDEX_RESULT_PXI_SEND_ERROR` | A PXI command failed to be sent to the ARM7. This error occurs when the PXI send queue for the ARM7 has filled up or when the hardware has detected an error. As a result, the state may improve when a retry is made.

### Asynchronous Process Results

`SNDEX_RESULT_SUCCESS` | The whole series of operations completed successfully.
`SNDEX_RESULT_ILLEGAL_STATE` | The codec is running in CODEC-DS mode; forced audio output is configured for the speaker; or frequency-limited microphone auto-sampling is running.
`SNDEX_RESULT_EXCLUSIVE` | A mutex error occurred in the ARM7. This error depends upon the progress of ARM7 processing, so conditions may improve when a retry is made.
`SNDEX_RESULT_FATAL_ERROR` | This error should not ordinarily occur. This may occur when an illegal PXI command was sent directly, ignoring library state management; when the ARM7 component and the extended sound feature library have different versions; when library state management has fallen into an abnormal state due to memory corruption; or when other such conditions arise. There is no way to recover from this at run time.

## Description

Asynchronously changes the I2S operating frequency. The I2S operating frequency is set to `SNDEX_FREQUENCY_32730` by default.

If this function does not return a value of `SNDEX_RESULT_SUCCESS`, the asynchronous processing and callback do not run. Also note that a PXI receive interrupt sends notification when the asynchronous processing is complete, so callbacks do not occur if PXI receive interrupts are prohibited.

## Notes

Changing to the I2S operating frequency also entails change synchronization of the communications clock with respect to CPU-external devices. Sound output features and CODEC-related features are all affected as a result.Switch the frequency only after stopping all of the following: audio output from the CPU and DSP, touch panel input sampling, microphone input sampling, and microphone input sampling from the DSP.

## See Also

`SNDEX_SetI2SFrequency`
`SNDEX_GetI2SFrequencyAsync`
`MIC_StopLimitedSamplingAsync`
`MIC_StopAutoSamplingAsync`
`TP_RequestAutoSamplingStopAsync`

## Revision History

2008/11/07 Added mention that `SNDEX_RESULT_EXCLUSIVE` is returned during processing of shutter sound playback.
2008/11/06 Corrected Asynchronous Process Results (`SNDEX_RESULT_EXCLUSIVE`) in Return Values.
2008/02/15 Initial version.

CONFIDENTIAL