PMICGetLevelAsync

Syntax

#include <revolution/pmic.h>

// Input level
#define PMIC_LEVEL_SIN               0x0000
#define PMIC_LEVEL_SOUT              0x0001
#define PMIC_LEVEL_RIN               0x0002

typedef void (*PMICCallback)(PMIC_ERR result, void* arg);

PMIC_ERR PMICGetLevelAsync(u16 addr, u16* level, PMICCallback cb, void* arg);

Arguments

addr Target of the volume level received from the Wii Speak.
level Location to store the volume level received from the Wii Speak.
cb Callback function that will send notification of the execution results of this function.
arg Passed as the second argument of the callback function above.

Return Values

Returns one of the following.

PMIC_ERR_OK The function has been called normally.
PMIC_ERR_INVALID_ARGUMENTS The correct argument was not passed.
PMIC_ERR_INVALID_STATE The Wii Speak is not open.
PMIC_ERR_BUSY Cannot register the command. Call the function again.
PMIC_ERR_FATAL A fatal error has occurred.

Description

Asynchronously gets the volume levels of the various data sent and received by the Wii Speak.

This function gets the volume level for the audio data specified by the addr argument and stores it to the address specified by the level argument. The following kinds of data can be specified in addr.

PMIC_LEVEL_SIN Wii Speak input data (data before processes such as echo canceling are implemented).
PMIC_LEVEL_SOUT Data output from the Wii Speak.
PMIC_LEVEL_RIN Reference data being sent from the Wii console to the Wii Speak.

One of the following is passed to result, the callback function's first argument.

PMIC_ERR_OK The volume level has been obtained successfully.
PMIC_ERR_NO_DEVICE The Wii Speak has been unplugged.
PMIC_ERR_INVALID_STATE The Wii Speak is not open. (Confirm that the Wii Speak cable is inserted in the USB port.)
PMIC_ERR_USB_ERROR An error occurred in USB communications. Call the function again.
PMIC_ERR_FATAL A fatal error has occurred.

Each volume level is the average absolute value of the PCM data. When a sine wave of the maximum amplitude is input to the Wii Speak, the volume level is 0x517c. When displaying volume levels onscreen with a level meter (for example), it is easy to understand if an appropriate standard value is used and the display is shown in decibels converted from a relative value from the standard value. See the pmic_simple demo program because it contains a sample of the level meter.

The various volume level values that this function can get can be used as guidelines for the effective operation of the Wii Speak in different kinds of home environments.

See Also

Revision History

2009/06/11 Revised Description.
2009/03/11 Added a description of volume levels and information related to the level meter.
2008/12/22 Standardized terminology.
2008/10/23 Revised Description.
2008/04/24 Initial version.


CONFIDENTIAL