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
15<H2>C Specification</H2>
16<DL>
17  <DD>
18<PRE><code>#include &lt;revolution/wpad.h&gt;
19
20#define WPAD_CHAN0               0
21#define WPAD_CHAN1               1
22#define WPAD_CHAN2               2
23#define WPAD_CHAN3               3
24
25void WPADSetAutoSamplingBuf( s32 chan, void *buf, u32 length );
26</code></PRE>
27</DL>
28<H2>Arguments</H2>
29<TABLE border="1">
30  <TBODY>
31    <TR>
32<TD><code><b><i>chan</i></b></code></TD>
33<TD>One of <code>WPAD_CHAN<i>n</i></code> values.</TD>
34    </TR>
35    <TR>
36<TD><CODE><b><i>buf</i></b></CODE></TD>
37<TD>Pointer that indicates the beginning of the ring buffer storing the controller status.</TD>
38    </TR>
39    <TR>
40<TD><CODE><b><i>length</i></b></CODE></TD>
41<TD>Length (number of elements) of the array passed with <code>buf</code>.</TD>
42    </TR>
43  </TBODY>
44</TABLE>
45<H2>Return Values</H2>
46<P>None.</P>
47
48<H2>Description</H2>
49<p>
50Sets the buffer that stores controller information received from the Wii Remote at the specified channel. This buffer is used as a ring buffer.
51</p>
52<p>
53The controller information is stored in the buffer specified by <CODE><b><i>buf</i></b></CODE>. 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 <a href="./WPADSetSamplingCallback.html"><CODE>WPADSetSamplingCallback</CODE></a>, the callback function will be called each time the controller information is stored.
54</p>
55<p>
56The buffer index that stored the most recent controller status can be obtained with the <a href="./WPADGetLatestIndexInBuf.html">WPADGetLatestIndexInBuf</a> function.
57</p>
58<p>
59The controller status stored in the newest index +1 may be overwritten unintentionally by an interrupt. To prevent an unintentional overwrite, set the number of <CODE><b><i>buf</i></b></CODE> elements that are referenced by the user program in a single frame to be less than <CODE><i>length-1</i></CODE>.
60</p>
61<p>
62To stop the storage of controller information in the ring buffer, call this function with <CODE><b><i>buf</i></b></CODE> set to NULL.
63</p>
64<p>
65This can be used together with <a href="./WPADRead.html">WPADRead</a>.
66</p>
67<p>
68Be aware that ring buffers registered using this function will be cleared in the following circumstances.
69<ul>
70<li>Communication with the controller is lost</li>
71</ul>
72</p>
73<p>
74In addition, the callback functions are not cleared when a controller is connected, so they can be registered in advance.
75</p>
76
77<H2>See Also</H2>
78<p>
79<A href="./toc.html" target="contents"><CODE>WPAD</CODE> Functions</A><br> <A href="./WPADRead.html"><CODE>WPADRead</CODE></A><br> <A href="./WPADGetDataFormat.html"><CODE>WPADGetDataFormat</CODE></A><br> <A href="./WPADSetDataFormat.html"><CODE>WPADSetDataFormat</CODE></A><br> <A href="./WPADGetLatestIndexInBuf.html"><CODE>WPADGetLatestIndexInBuf</CODE></A><br> <A href="./WPADSetSamplingCallback.html"><CODE>WPADSetSamplingCallback</CODE></A><br> <A href="./WPADStatus.html"><CODE>WPADStatus</CODE></A><br> <A href="./WPADFSStatus.html"><CODE>WPADFSStatus</CODE></A><br> <A href="./WPADCLStatus.html"><CODE>WPADCLStatus</CODE></A><br> <A href="./WPADStatusEx.html"><CODE>WPADStatusEx</CODE></A><br>
80</p>
81
82
83<H2>Revision History</H2>
84<p>
8508/15/2006 Removed statement that the callback is cleared when an external extension controller is plugged into or unplugged from the console.<br>06/19/2006 Deleted a description of SI specifications.<br> 11/01/2006 Added the macro WPAD_CHAN<i>n</i>. Deleted text about <code>WPADAttach</code> function. Changed API specs. Added links to functions. Added note about change to SI in the Description.<BR>2005/08/30 Changed name of <code><i>bufSize</i></code> argument to <code><i>length</i></code>; Modified Description. 2005/08/04 Revised the description of <code>bufSize</code>. <br>08/01/2006 Initial version.<br>
86</p>
87<hr>
88<P>CONFIDENTIAL</p>
89</BODY>
90</HTML>