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>PMICChangeRate</title> 9</head> 10 11<body> 12 13<h1>PMICChangeRate</h1> 14 15<h2>Syntax</h2> 16<dl><dd><pre class="construction"> 17#include <revolution/pmic.h> 18#include <revolution/ai.h> 19 20#define AI_SAMPLERATE_48KHZ 0x00000001 21#define AI_SAMPLERATE_32KHZ 0x00000000 22 23s32 PMICChangeRate(s16* input, 24 s32 samples, 25 u32 rate, 26 s16* output, 27 BOOL init); 28</pre></dd></dl> 29 30<h2>Arguments</h2> 31<TABLE class="arguments" border="1" > 32 <tr> 33<th>input</th> 34<td>Pointer to the data to convert, which was output from the audio library.</td> 35 </tr> 36 <tr> 37<th>samples</th> 38<td>Number of samples of data to convert.</td> 39 </tr> 40 <tr> 41<th>rate</th> 42<td>Sampling frequency of the data to convert.</td> 43 </tr> 44 <tr> 45<th>output</th> 46<td>Location to output the data after its sampling frequency has been converted.</td> 47 </tr> 48 <tr> 49<th>init</th> 50<td>Whether this is the first conversion (<code>TRUE</code>) or a second or subsequent conversion (<code>FALSE</code>).</td> 51 </tr> 52</table> 53 54<h2>Return Values</h2> 55<p>The number of samples in the output data. The function returns -1 if the PMIC library is not initialized or if any arguments were specified incorrectly.</p> 56 57<H2>Description</H2> 58<p>The program must send the audio data to be output from the speaker to the microphone to properly use Wii Speak functionality (the echo canceller). This data is called the <I>reference data</I>, and its format is 16-kHz 16-bit stereo PCM. The format of the audio data that the Wii console outputs from the speakers is either 32-kHz or 48-kHz 16-bit stereo PCM. For the Wii Speak to operate properly, the program must use this function to convert the sampling frequency of the speaker data into the frequency required for reference data.</p> 59 60<p>The first argument, <SPAN class="argument">input</SPAN>, passes a pointer to the data output from the audio library. However, Revolution SDK's standard AX library (for example) directly passes the output data to the AI (Audio Interface) library, the component that controls data output to the speakers. For this reason, the program must implement some mechanism to pass AX output data to this function. For details, see the PMIC library sample program <code>pmic_simple</code>.</p> 61 62<p>The second argument, <SPAN class="argument">samples</SPAN>, specifies (in samples) the amount of audio library output data that this function will convert. When making this specification, consider the left channel and the right channel as separate samples rather than two halves of one sample. The range of specifiable values is 0-4608 (48 milliseconds' worth of data at 48 kHz).</p> 63 64<p>The third argument, <SPAN class="argument">rate</SPAN>, specifies the sampling frequency of the audio data that will be converted. If the sampling rate of the audio data is 32 kHz, specify <code>AI_SAMPLERATE_32KHZ</code>. For 48 kHz, specify <code>AI_SAMPLERATE_48KHZ</code>.</p> 65<p><strong>Note: The current version does not support a rate of 48 kHz.</strong></p> 66 67<p>The fourth argument, <SPAN class="argument">output</SPAN>, specifies where to output the reference data after its sampling rate has been converted. The size required of this output destination is calculated as follows.</p> 68 69<ul> 70<li>When the sampling rate of the conversion-source data is 32 kHz: 71 <ul> 72<li>If the amount of data per channel (<SPAN class="argument">samples</SPAN>/2) is an even number: <SPAN class="argument">samples</SPAN> bytes.</li> 73<li>If the amount of data per channel (<SPAN class="argument">samples</SPAN>/2) is an odd number: <SPAN class="argument">samples</SPAN>+2 bytes.</li> 74 </ul> 75</li> 76<li>When the sampling rate of the conversion-source data is 48 KHz 77 <ul> 78<li>If the amount of data per channel (<SPAN class="argument">samples</SPAN>/2) is .....</li> 79 </ul> 80</li> 81</ul> 82 83<p><strong>Note: The current version does not support a rate of 48 kHz.</strong></p> 84 85<p>The fifth argument, <SPAN class="argument">init</SPAN>, specifies whether this is the first time that this function has been called. If it is the first time (<code>TRUE</code>), this function initializes the state used to convert the sampling frequency. If there has been an interruption in calls to this function or in the data specified as input to this function, you should once again specify <code>TRUE</code> for the <SPAN class="argument">init</SPAN> argument.</p> 86 87<p><strong>Note: This function is not optimized, so it has a heavy processing load.</strong></p> 88 89<H2>See Also</H2> 90<p class="reference"> 91</p> 92 93<H2>Revision History</H2> 94<p> 952009/06/11 Revised <B>Description</B>.<br>2008/12/22 Standardized terminology.<br>2008/10/22 Added argument descriptions.<br>2008/04/16 Updated the arguments relating to the sampling frequency.<br>2008/03/04 Changed the function reference format.<br>2008/01/25 Initial version. 96</p> 97 98<hr><p>CONFIDENTIAL</p></body> 99 100</html> 101