PMICWrite

Syntax

#include <revolution/pmic.h>

s32 PMICWrite(s16* buffer, s32 samples);

Arguments

buffer Location to store the reference data to send to the Wii Speak.
samples Number of samples of reference data to send to the Wii Speak.

Return Values

Returns the number of samples of reference data that were sent to the Wii Speak. The function returns -1 if the PMIC library is not initialized or if any arguments were specified incorrectly.

Description

The program must send the audio data to be output from the speaker, such as a television, to the microphone to properly use Wii Speak functionality (the echo canceller). This data is called reference data.

This function is used when sending reference data to the Wii Speak.

The reference data is formatted as 16-kHz 16-bit stereo PCM (big-endian). For example, if the program uses the AX library for audio playback, audio data is output as 32-kHz 16-bit stereo PCM. To use the Wii Speak, the program must first resample this 32-kHz audio data at 16 kHz and then send it to the Wii Speak. The PMIC library provides the PMICChangeRate function for resampling.

The PMIC library periodically sends reference data from an internal library buffer to the Wii Speak. This function moves reference data from the region specified by the first argument to the library's internal buffer. Calling this function is a separate process from accessing the Wii Speak through the USB, so you do not need to consider synchrony/asynchrony when calling this function.

The PMIC library has a ring buffer that can hold 48 ms of reference data. Programs must call this function at the appropriate frequency to constantly place data in the reference data buffer. If a call to this function is delayed and the internal buffer becomes empty, Wii Speak's echo canceler may stop working properly.

Note: The size of the reference data buffer is fixed regardless of the method used to initialize the PMIC library.

This function can be called regardless of the state of the Wii Speak (such as before it is open or while it is stopped or operating).

See Also

PMICChangeRate

Revision History

2009/06/11 Revised Description.
2008/12/22 Standardized terminology.
2008/10/21 Revised Description.
2008/09/26 Revised Description.
2008/03/04 Changed the function reference format.
2008/01/25 Initial version.


CONFIDENTIAL