# TWL Extended Sound Features: Overview

On TWL, in addition to the NITRO-SDK's SND library, you can use the SNDEX library. This library provides several extended features to supplement the features in the NITRO-SDK's SND library.

## CODEC Mode

The TWL console has built-in hardware known as "CODEC" to control microphone input, speaker output, and Touch Screen input. By using this CODEC, TWL provides the following two modes for NITRO compatibility. See the Programming Manual for details on the CODEC hardware.

CODEC-DS | This environment is identical to the sound circuit on the NITRO console. NTR ROMs boot up in this mode when they are running on the TWL console.
CODEC-TWL | This environment uses a sound circuit specific to the TWL system. A TWL ROM usually boots up in this mode. You can specify which CODEC mode to use for a ROM in the ROM specification file.

You cannot change the CODEC mode at run time.

When you use the TWL camera feature, you must play a specific audio sample either when taking a still photo or when starting and stopping video recording. Note that the forced audio output feature can be used only when the CODEC is operating in CODEC-TWL mode. Therefore, the Camera Operations library can be used only when the CODEC is in CODEC-TWL mode.

## Extended Features

The following sound-related features have been added on the TWL console. See each function's description for more details.

- Getting the headphone connection state
- Getting and setting the mute setting
- Getting and changing the I2S frequency
- Getting and changing the rate for mixing DSP audio output
- Getting and changing the speaker volume
- Setting IIR filters for microphone input data and speaker output data
- Setting callbacks invoked when the volume button is pressed on the TWL console

## Note

Mutexes are used by processing related to each extended sound feature, so these features cannot be used simultaneously. A SNDEX function returns `SNDEX_RESULT_EXCLUSIVE` and quit if another SNDEX function is still running.

When you execute the `DSP_PlayShutterSound` shutter sound playback function, internally the function makes use of extended sound functionality automatically. For this reason, until the playback of shutter sound has ended, SNDEX functions returns `SNDEX_RESULT_EXCLUSIVE` and quits without doing anything.
The exception is the `SNDEX_SetVolumeSwitchCallback` function, which succeeds because all it does is configure function settings. Use the `DSP_IsShutterSoundPlaying` function to determine the end of the shutter sound playback process.

The SNDEX functions internally continue to block if PXI receive interrupts are prohibited because they use a PXI receive interrupt to detect that their processing completed. In asynchronous versions of these functions, callbacks do not return.

## See Also

SNDEX Function List

## Revision History

2009/01/22 Deleted the text about the Changing the Voice Forced Output Settings feature because it is not related to application development.
2008/11/07 Added mention of mutexes during shutter sound playback to Note.
2008/10/27 Added mention of the restrictions on the Changing the Voice Forced Output Settings feature.
2008/09/30 Added mention of restrictions on use of camera in different CODEC modes.
2008/09/12 Initial version.

CONFIDENTIAL