1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<html> 3 4<head> 5<META http-equiv="Content-Type" content="text/html; charset=windows-1252"> 6<META http-equiv="Content-Style-Type" content="text/css"> 7<LINK rel="stylesheet" type="text/css" href="../../CSS/revolution.css"> 8<title>PMICGetLevelAsync</title> 9</head> 10 11<body> 12 13<h1>PMICGetLevelAsync</h1> 14 15<h2>Syntax</h2> 16<dl><dd><pre class="construction"> 17#include <revolution/pmic.h> 18 19// Input level 20#define PMIC_LEVEL_SIN 0x0000 21#define PMIC_LEVEL_SOUT 0x0001 22#define PMIC_LEVEL_RIN 0x0002 23 24typedef void (*PMICCallback)(PMIC_ERR result, void* arg); 25 26PMIC_ERR PMICGetLevelAsync(u16 addr, u16* level, PMICCallback cb, void* arg); 27</pre></dd></dl> 28 29<h2>Arguments</h2> 30<TABLE class="arguments" border="1" > 31 <tr> 32<th>addr</th> 33<td>Target of the volume level received from the Wii Speak.</td> 34 </tr> 35 <tr> 36<th>level</th> 37<td>Location to store the volume level received from the Wii Speak.</td> 38 </tr> 39 <tr> 40<th>cb</th> 41<td>Callback function that will send notification of the execution results of this function.</td> 42 </tr> 43 <tr> 44<th>arg</th> 45<td>Passed as the second argument of the callback function above.</td> 46 </tr> 47</TABLE> 48 49<h2>Return Values</h2> 50<p> 51Returns one of the following. 52</p> 53 54<TABLE class="arguments" border="1"> 55 <tr> 56<th><CODE>PMIC_ERR_OK</CODE></th> 57<td>The function has been called normally.</td> 58 </tr> 59 <tr> 60<th><CODE>PMIC_ERR_INVALID_ARGUMENTS</CODE></th> 61<td>The correct argument was not passed.</td> 62 </tr> 63 <tr> 64<th><CODE>PMIC_ERR_INVALID_STATE</CODE></th> 65<td>The Wii Speak is not open.</td> 66 </tr> 67 <tr> 68<th><CODE>PMIC_ERR_BUSY</CODE></th> 69<td>Cannot register the command. Call the function again.</td> 70 </tr> 71 <tr> 72<th><CODE>PMIC_ERR_FATAL</CODE></th> 73<td>A fatal error has occurred.</td> 74 </tr> 75</TABLE> 76 77<H2>Description</H2> 78<p>Asynchronously gets the volume levels of the various data sent and received by the Wii Speak.</p> 79 80<p>This function gets the volume level for the audio data specified by the <SPAN class="argument">addr</SPAN> argument and stores it to the address specified by the <SPAN class="argument">level</SPAN> argument. The following kinds of data can be specified in <SPAN class="argument">addr</SPAN>.</p> 81 82<TABLE class="arguments" border="1" > 83 <tr> 84<th><CODE>PMIC_LEVEL_SIN</CODE></th> 85<td>Wii Speak input data (data before processes such as echo canceling are implemented).</td> 86 </tr> 87 <tr> 88<th><CODE>PMIC_LEVEL_SOUT</CODE></th> 89<td>Data output from the Wii Speak.</td> 90 </tr> 91 <tr> 92<th><CODE>PMIC_LEVEL_RIN</CODE></th> 93<td>Reference data being sent from the Wii console to the Wii Speak.</td> 94 </tr> 95</TABLE> 96 97<p>One of the following is passed to <SPAN class="argument">result</SPAN>, the callback function's first argument.</p> 98 99<TABLE class="arguments" border="1" > 100 <tr> 101<th><CODE>PMIC_ERR_OK</CODE></th> 102<td>The volume level has been obtained successfully.</td> 103 </tr> 104 <tr> 105<th><CODE>PMIC_ERR_NO_DEVICE</CODE></th> 106<td>The Wii Speak has been unplugged.</td> 107 </tr> 108 <tr> 109<th><CODE>PMIC_ERR_INVALID_STATE</CODE></th> 110<td>The Wii Speak is not open. (Confirm that the Wii Speak cable is inserted in the USB port.)</td> 111 </tr> 112 <tr> 113<th><CODE>PMIC_ERR_USB_ERROR</CODE></th> 114<td>An error occurred in USB communications. Call the function again.</td> 115 </tr> 116 <tr> 117<th><CODE>PMIC_ERR_FATAL</CODE></th> 118<td>A fatal error has occurred.</td> 119 </tr> 120</TABLE> 121 122<p>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 <code>0x517c</code>. 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 <code>pmic_simple</code> demo program because it contains a sample of the level meter.</p> 123 124<p>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.</p> 125 126<H2>See Also</H2> 127 128<H2>Revision History</H2> 129<p> 1302009/06/11 Revised <B>Description</B>.<br>2009/03/11 Added a description of volume levels and information related to the level meter.<br>2008/12/22 Standardized terminology.<br>2008/10/23 Revised <B>Description</B>.<br>2008/04/24 Initial version. 131</p> 132 133<hr><p>CONFIDENTIAL</p></body> 134 135</html> 136