SNDEX_Get[Current]VolumeAsync

Syntax

#include <twl/snd.h>
SNDEXResult SNDEX_GetVolumeAsync( u8* volume, SNDEXCallback callback, void* arg );

Arguments

volume Pointer to the variable that will get the speaker volume. A value will be written to this variable asynchronously, so it must not be used for anything else until asynchronous processing is complete.
callback SNDEXCallback-type function that will be notified when the asynchronous process has completed. The asynchronous process will run even if NULL is specified here, but you will no longer be 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 This function has been called on the NITRO platform.
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_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_DEVICE_ERROR This notification is sent when the ARM7's internal operation failed to get the speaker volume for an external device. Conditions may improve on a retry, but continued failures after multiple retries could indicate that the external device is not responding, so you may handle this as if it were a notification of success. A value of 0 is stored in volume when this error occurs.
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 gets the speaker volume. The speaker volume takes a value between 0 (minimum, defined by SNDEX_VOLUME_MIN) and 7 (maximum, defined by SNDEX_VOLUME_MAX.

The only difference between GetVolumeAsync and GetCurrentVolumeAsync is that GetVolumeAsync can get the pending volume value. To read more about this pending volume value, see the description of the SNDEX_SetVolume [Async] function and Note, below.
The pending volume value is applied several frames later, so if you do not need to get the volume for the exact time the function is called or if you are not using the SNDEX_SetVolume[Async], there are no problems using the SNDEX_GetVolumeAsync function.

Change the speaker volume by the console's volume switch in addition to the SNDEX_SetVolumeAsync and SNDEX_SetVolume functions. The console records the changed value and also applies it at the next restart.

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.

Note

To keep the speaker volume from being continuously changed by the SNDEX_SetVolume[Async] functions, once a change is made, the next change is kept pending for roughly 10 frames.
After roughly 10 frames, the pending value is set to the speaker volume.

See Also

SNDEX_GetVolume
SNDEX_SetVolumeAsync

Revision History

2009/01/06 In line with the addition of SNDEX_SetCurrentVolume, added a description of the difference in return values.
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/07/10 Revised description of speaker volume.
2008/02/22 Unified terminology concerning speaker volume and added Description.
2008/02/15 Initial version.


CONFIDENTIAL