#include <revolution/pmic.h>
// Working area size on MEM2 that the PMIC library uses
#define PMIC_MEM2_WORK 17408 // 17 KB
#define PMIC_READ_BUFFER_MSEC (48) // 48 msec
#define PMIC_READ_BUFFER_SAMPLES (PMIC_READ_BUFFER_MSEC * 16) // @16 kHz, @mono
#define PMIC_READ_BUFFER_SIZE (PMIC_READ_BUFFER_SAMPLES * sizeof(s16)) // @s16
PMIC_ERR PMICInitEx(void* mem2, s32 size);
| mem2 | Starting address of the work region allocated in MEM2 for the PMIC library. |
|---|---|
| size | Size of the buffer for the audio data obtained from the Wii Speak. |
Returns one of the following.
| PMIC_ERR_OK | The library has been initialized normally. |
|---|---|
| PMIC_ERR_INVALID_ARGUMENTS | The correct argument was not passed. |
| PMIC_ERR_BUSY | The state is in transition. Call the function again. |
| PMIC_ERR_FATAL | A fatal error has occurred. |
Initializes the PMIC library. This function must be called once before using any other PMIC functions.
When the PMIC library is initialized, it will allocate work buffers, including one for audio data obtained from the Wii Speak and one for reference data to send to the Wii Speak, in the region specified by mem2. If you use this function to initialize the library, you can assign an arbitrary size to the buffer for audio data obtained from the Wii Speak.
For example, assume that we will use a buffer for 96 ms of audio data, which is twice the default 48 ms used when the PMICInit function initializes the library.
PMIC_MEM2_WORK - PMIC_READ_BUFFER_SIZE + 96 * 16 * sizeof(s16) // Bytes
A region of the size above would need to be allocated in MEM2 and then passed to this function as its first argument, mem2. In this case a value of 96*16*sizeof(s16) would be passed to the second argument, size.
Note: The default work size PMIC_MEM2_WORK includes the default audio data buffer for 48 milliseconds' worth of data.
After calling this function, be sure to call the PMICProbe function once before calling the PMICOpen(Async) functions.
PMICInit
PMICProbe
PMICOpen
PMICOpenAsync
PMICRead
2009/06/01 Added description related to calling PMICProbe.
2008/11/04 Added Description.
2008/10/21 Initial version.
CONFIDENTIAL