WPADControlSpeaker

C Specification

#include <revolution/wpad.h>

#define WPAD_CHAN0               0
#define WPAD_CHAN1               1
#define WPAD_CHAN2               2
#define WPAD_CHAN3               3

#define WPAD_SPEAKER_OFF         0
#define WPAD_SPEAKER_ON          1
#define WPAD_SPEAKER_MUTE        2
#define WPAD_SPEAKER_MUTE_OFF    3
#define WPAD_SPEAKER_PLAY        4

typedef void (*WPADCallback) ( s32 chan, s32 result );

s32 WPADControlSpeaker( s32 chan, u32 command, WPADCallback callback );

Arguments

chan One of the WPAD_CHANn values.
pattern Set to one of the WPAD_SPEAKER_OFF, WPAD_SPEAKER_ON, WPAD_SPEAKER_MUTE, WPAD_SPEAKER_MUTE_OFF, or WPAD_SPEAKER_PLAY.
callback Callback function to notify about the result. Notification processing is omitted if NULL is specified.

Return Values

Returns one of the following codes:

WPAD_ERR_NONE
WPAD_ERR_NO_CONTROLLER
WPAD_ERR_BUSY

Description

Controls the speaker of the Wii Remote Control on the specified channel. This function registers the speaker control command in the library. The WPAD library processes registered commands when other commands are not running.

To output audio from the speaker on the Wii Remote, first start the speaker using the WPAD_SPEAKER_ON command. Next, audio can be output from the speaker using the WPAD_SPEAKER_PLAY command. Sending audio data using the WPADSendStreamData at this time will cause audio to be output from the speaker of the Wii Remote.

The different commands are defined as follows.

WPAD_SPEAKER_OFFTurns off the Wii Remote speaker.
WPAD_SPEAKER_ONTurns on the Wii Remote speaker.
WPAD_SPEAKER_MUTEMutes the Wii Remote speaker.
WPAD_SPEAKER_MUTE_OFFUnmutes the Wii Remote speaker.
WPAD_SPEAKER_PLAYAllows audio data to be output from the Wii Remote speaker.

The return values have the following meanings:

WPAD_ERR_NONEThe WPAD library received a command.
WPAD_ERR_BUSYThe WPAD library was unable to receive a command.
WPAD_ERR_NO_CONTROLLERThe connection was broken.

In addition, if a callback function is set, the callback function returns the following error codes when the processing is complete. Their meanings are as follows:

WPAD_ERR_NONE The command was processed normally.
WPAD_ERR_BUSY The WPAD library was unable to receive a command. Call it again later.
WPAD_ERR_TRANSFER A communications error prevented normal processing of the command.
WPAD_ERR_NO_CONTROLLER The connection was broken.

See Also

WPAD Functions
WPADIsSpeakerEnabled, WPADSendStreamData

Revision History

2006/11/29 Added WPAD_ERR_BUSY, which had been left out from the list, to the error codes passed by the callback.
2006/08/15 Initial version.


CONFIDENTIAL