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>PMICRead</title> 9</head> 10 11<body> 12 13<h1>PMICRead</h1> 14 15<h2>Syntax</h2> 16<dl><dd><pre class="construction"> 17#include <revolution/pmic.h> 18 19s32 PMICRead(s16* buffer, s32 samples); 20</pre></dd></dl> 21 22<h2>Arguments</h2> 23<TABLE class="arguments" border="1" > 24 <tr> 25<th>buffer</th> 26<td>Location to store the audio data received from the Wii Speak.</td> 27 </tr> 28 <tr> 29<th>samples</th> 30<td>Number of samples of audio data to request from the Wii Speak.</td> 31 </tr> 32</TABLE> 33 34<h2>Return Values</h2> 35<p>Returns the number of samples of audio data that were obtained from the Wii Speak. The function returns -1 if the PMIC library is not initialized or if any arguments were specified incorrectly.</p> 36 37<H2>Description</H2> 38<p>Use this function when programs get the audio data collected by the Wii Speak.</p> 39 40<p>Audio data is formatted as 16-bit monaural PCM (big-endian). The sampling frequency for audio data is set to be either 16,000 Hz; 11,025 Hz; or 8000 Hz by the <code>PMICSetFreq(Async)</code> function. The default sampling frequency when the Wii Speak starts is 16,000 Hz.</p> 41 42<p>The PMIC library periodically gets audio data from the Wii Speak and stores it in a buffer inside the library. This function moves the audio data from this buffer inside the library to the region specified in the first argument. 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.</p> 43 44<p>The size of the audio data buffer in the PMIC library differs depending on the way in which the library is initialized. If the library was initialized using the <code>PMICInit</code> function, the size of the audio data buffer is 48 ms for a sampling rate of 16 kHz (or approximately 70 ms for 11 kHz, or 96 ms for 8 kHz). When the library is initialized using the <code>PMICInitEx</code> function, the buffer size is specified by an argument.</p> 45 46<p>In either case, programs must call this function at the appropriate frequency to get the audio data from the internal buffer. If for some reason a call to this function is delayed, the internal buffer is overwritten, and audio data continuity is lost.</p> 47 48<p>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). </p> 49 50<H2>See Also</H2> 51<p class="reference"> 52<a href="PMICSetFreqAsync.html"><CODE>PMICSetFreqAsync</CODE></a><BR> <a href="PMICSetFreq.html"><CODE>PMICSetFreq</CODE></a><BR> <a href="PMICInit.html"><CODE>PMICInit</CODE></a><BR> <a href="PMICInitEx.html"><CODE>PMICInitEx</CODE></a> 53</p> 54 55<H2>Revision History</H2> 56<p> 572008/10/21 Revised <B>Description</B>. <br> 2008/09/26 Revised <B>Description</B>. <br>2008/06/13 Added mention of the frequency.<br>2008/03/04 Changed the function reference format.<br>2008/01/25 Initial version. 58</p> 59<hr><p>CONFIDENTIAL</p></body> 60</html>