1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<HTML> 3<HEAD> 4<META http-equiv="Content-Type" content="text/html; charset=windows-1252"> 5<META http-equiv="Content-Style-Type" content="text/css"> 6<META name="GENERATOR" content="Microsoft FrontPage 5.0"> 7<LINK rel="stylesheet" type="text/css" href="../CSS/revolution.css"> 8<TITLE>WPADSetAutoSamplingBuf</TITLE> 9</HEAD> 10<BODY> 11 12<H1>WPADSetAutoSamplingBuf</H1> 13 14<H2>Syntax</H2> 15<dl><dd><pre class="construction"> 16#include <revolution/wpad.h> 17 18#define WPAD_CHAN0 0 19#define WPAD_CHAN1 1 20#define WPAD_CHAN2 2 21#define WPAD_CHAN3 3 22 23void WPADSetAutoSamplingBuf( s32 chan, void *buf, u32 length ); 24</pre></dd></dl> 25 26<H2>Arguments</H2> 27<TABLE class="arguments" border="1" > 28 <TBODY> 29 <TR> 30<TH>chan</TH> 31<TD>One of the <code>WPAD_CHAN<i>n</i></code> values.</TD> 32 </TR> 33 <TR> 34<TH>buf</TH> 35<TD>Pointer that indicates the beginning of the ring buffer storing the controller status.</TD> 36 </TR> 37 <TR> 38<TH>length</TH> 39<TD>Length (number of elements) of the array passed with <SPAN class="argument">buf</SPAN>.</TD> 40 </TR> 41 </TBODY> 42</TABLE> 43 44<H2>Return Values</H2> 45<P>None.</P> 46 47<H2>Description</H2> 48<p> 49Sets the buffer that stores controller information received from the Wii Remote at the specified channel. This buffer is used as a ring buffer. 50</p> 51<p> 52The controller information is stored in the buffer specified by <SPAN class="argument">buf</SPAN>. This buffer must be an array of structures having the data format specified by the <a href="./WPADSetDataFormat.html"><CODE>WPADSetDataFormat</CODE></a> function. If a callback function was set with the <a href="./WPADSetSamplingCallback.html"><CODE>WPADSetSamplingCallback</CODE></a> function, the callback function will be called each time the controller information is stored. 53</p> 54<p> 55The buffer index that stored the most recent controller information can be obtained with the <a href="./WPADGetLatestIndexInBuf.html"><CODE>WPADGetLatestIndexInBuf</CODE></a> function. 56</p> 57<p> 58The controller status stored in the newest index +1 may be overwritten unintentionally by an interrupt. As a workaround for this problem, set the number of <SPAN class="argument">buf</SPAN> elements that are referenced by the user program in a single frame to be <SPAN class="argument">length</SPAN>-1 or smaller. 59</p> 60<p> 61To stop storing controller information in the ring buffer, call this function with <SPAN class="argument">buf</SPAN> set to <CODE>NULL</CODE>. 62</p> 63<p> 64This can be used with the <a href="./WPADRead.html"><CODE>WPADRead</CODE></a> function. 65</p> 66<p> 67Be aware that ring buffers registered using this function will be cleared in the following circumstances. 68</p> 69<ul> 70<li>Controller is connected</li> 71<li>Communication with the controller is lost</li> 72</ul> 73 74<H2>See Also</H2> 75<p class="reference"> 76<A href="./WPADRead.html">WPADRead</A>, 77<A href="./WPADGetDataFormat.html">WPADGetDataFormat</A>, 78<A href="./WPADSetDataFormat.html">WPADSetDataFormat</A>, 79<A href="./WPADGetLatestIndexInBuf.html">WPADGetLatestIndexInBuf</A>, 80<A href="./WPADSetSamplingCallback.html">WPADSetSamplingCallback</A>, 81<A href="./WPADStatus.html">WPADStatus</A> 82</p> 83 84<H2>Revision History</H2> 85<p> 862008/04/16 Deleted the <CODE>WPADFSStatus</CODE>, <CODE>WPADCLStatus</CODE>, and <CODE>WPADStatusEx</CODE> structures from <B>See Also</B>.<br>2006/10/05 Added mention that the buffer is cleared when a controller is connected.<br>2006/08/15 Removed statement that the callback is cleared when an external extension controller is plugged into or unplugged from the console.<br>2006/06/19 Deleted designations specific to SI specifications.<br>2005/11/01 Added the <CODE>WPAD_CHAN<i>n</i></CODE> macros. Deleted text about the <code>WPADAttach</code> function. Changed API specs. Added links to functions. Added note about change to SI in the Description.<br>2005/08/30 Renamed the <SPAN class="argument">bufSize</SPAN> argument to <SPAN class="argument">length</SPAN>; modified <B>Description.</B><br>2005/08/04 Revised the description of the <SPAN class="argument">bufSize</SPAN> argument.<br>2005/08/01 Initial version.<br> 87</p> 88 89<hr><p>CONFIDENTIAL</p></body> 90</HTML>