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 width="120" bgcolor="#ffffe8"><code><b><i>chan</i></b></code></TD>
33      <TD>One of the <code>WPAD_CHAN<i>n</i></code> values.</TD>
34    </TR>
35    <TR>
36      <TD width="120" bgcolor="#ffffe8"><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 width="120" bgcolor="#ffffe8"><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 information can be obtained with the <a href="./WPADGetLatestIndexInBuf.html"><CODE>WPADGetLatestIndexInBuf</CODE></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 with <a href="./WPADRead.html"><CODE>WPADRead</CODE></a>.
66</p>
67<p>
68Be aware that ring buffers registered using this function will be cleared in the following circumstances.
69</p>
70<ul>
71<li>Controller is connected</li>
72<li>Communication with the controller is lost</li>
73</ul>
74
75
76<H2>See Also</H2>
77<p>
78<A href="./toc.html" target="contents">WPAD Functions</A><br> <A href="./WPADRead.html"><CODE>WPADRead</CODE></A>, <A href="./WPADGetDataFormat.html"><CODE>WPADGetDataFormat</CODE></A>, <A href="./WPADSetDataFormat.html"><CODE>WPADSetDataFormat</CODE></A>, <A href="./WPADGetLatestIndexInBuf.html"><CODE>WPADGetLatestIndexInBuf</CODE></A>, <A href="./WPADSetSamplingCallback.html"><CODE>WPADSetSamplingCallback</CODE></A>, <A href="./WPADStatus.html"><CODE>WPADStatus</CODE></A>, <A href="./WPADFSStatus.html"><CODE>WPADFSStatus</CODE></A>, <A href="./WPADCLStatus.html"><CODE>WPADCLStatus</CODE></A>, <A href="./WPADStatusEx.html"><CODE>WPADStatusEx</CODE></A><br>
79</p>
80
81
82<H2>Revision History</H2>
83<p>
842006/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 a description of SI specifications.<br> 2006/11/01 Added the macro <code>WPAD_CHAN<i>n</i></code>. 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. <BR>2005/08/04 Revised the description of <code>bufSize</code>. <br>2005/08/01 Initial version.<br>
85</p>
86<hr>
87<P>CONFIDENTIAL</p>
88</BODY>
89</HTML>