1<html> 2 3<head> 4<meta name="GENERATOR" content="Microsoft FrontPage 5.0"> 5<meta name="ProgId" content="FrontPage.Editor.Document"> 6<meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> 7<LINK rel="stylesheet" type="text/css" href="../CSS/revolution.css"> 8<base target="main"> 9<title>WPAD API Introduction</title> 10</head> 11 12<body> 13 14<h1>WPAD API Introduction</h1> 15 16<hr> 17 18<h2>Introduction</h2> 19 20<p> 21The Wii console communicates with its standard controller, the Wii Remote, using wireless technology in the 2.4 GHz bandwidth. The Wii Remote features a rumble motor, a pointer, a motion sensor, a speaker, a set of player indicators, and an External Extension Connector. By connecting an assortment of External Extension Controllers to the External Extension Connector, a variety of user interfaces are available. 22</p> 23 24<h2>Library Structure</h2> 25 26<p> 27The WPAD library includes a higher-level library (KPAD) and is implemented as follows. The KPAD library is a high-level portion of the WPAD library which was designed so that WPAD library would be easier to use within games. 28</p> 29 30<table border="1" width="200"> 31 <tbody> 32 <tr> 33 <td align="center" bgcolor="khaki">KPAD API</td> 34 </tr> 35 <tr> 36 <td align="center" bgcolor="palegreen">WPAD API</td> 37 </tr> 38 </tbody> 39</table> 40 41 42<h2>Initialization</h2> 43<p> 44Begin initialization of the WPAD library by calling the <a href="./WPADRegisterAllocator.html"><code>WPADRegisterAllocator</code></a> function. This registers the allocator function used to obtain work memory during the initialization process. Be sure to implement the allocator so that that work memory can be acquired from MEM2. The total size of the work memory allocated by the library can be retrieved using the function <a href="WPADGetWorkMemorySize.html"><code>WPADGetWorkMemorySize</code></a>. 45</p> 46<p> 47Then call the <a href="WPADInit.html"><code>WPADInit</code></a> function to initialize the WPAD library. Because it will take time to initialize the WPAD library, periodically call the <a href="./WPADGetStatus.html"><code>WPADGetStatus</code></a> function to check when initialization is complete. 48</p> 49 50<h2>Controller Pairing</h2> 51<p> 52To enable communication between the Wii console and the Wii Remote, you must first pair the Wii Remote with the Wii console. Controller pairing comes in two formats: normal pairing and simple pairing. The pairing information of a Wii Remote that has been normal paired remains registered even after the power to the Wii console is turned off. Also, the on/off operation of the Wii console can be performed with the Wii Remote Power Button. 53</p> 54<p> 55<font color="red">Changed the specification for simple pairing: the pairing information for a simple-paired Wii Remote is now maintained until the Wii console is shut down.</font>As a result, simple-paired Wii Remotes can remain connected to the Wii even when applications are reset, and when moving between the Wii Menu and various Channels.<font color="red"><b>However, applications built with SDK versions SDK2.4 patch6 or earlier use the old specification for simple pairing. Thus, when you move to one of these applications, the connection of the simple-paired Wii Remote will be dropped. </b></font>Furthermore, if simple pairing is conducted while this kind of application (an application built with the SDK versions SDK2.4 patch6 or earlier) is running, the connection will be dropped even if the process later moves to an application that uses the new specification for simple pairing. 56</p> 57 58<ul> 59<li><b>Paired Device Count</b></li> 60</ul> 61<blockquote> 62The Wii console can store 10 normal pairings for Wii Remotes and six simple pairings for Wii Remotes. A single Wii Remote will be treated as being paired using one of these two methods. The Wii Remote can store both one standard pairing for a Wii console and one simple pairing for a Wii console. A single Wii console will be treated as paired using one of these two methods. 63</blockquote> 64<blockquote> 65When a normal pairing is performed on a device paired with simple pairing, that device is then treated as having normal pairing. However, when a simple pairing is performed on a device paired with normal pairing, that device continues to be treated as having normal pairing. 66</blockquote> 67<ul> 68<li><b>Normal Pairing</b></li> 69</ul> 70<blockquote> 71Normal pairing is performed by pressing the SYNCHRO button on the front of the Wii console or by calling the <a href="./WPADStartSyncDevice.html"><code>WPADStartSyncDevice</code></a> or <a href="./WPADStartFastSyncDevice.html"><code>WPADStartFastSyncDevice</code></a> function and pressing the SYNCHRO button inside the battery cover of the Wii Remote. Once pairing completes, the information in the Wii Remote is stored in the Wii console. Similarly, the information for the paired Wii console is stored in the Wii Remote. 72</blockquote> 73<blockquote> 74Game applications, by calling the <a href="WPADSetSyncDeviceCallback.html"><code>WPADSetSyncDeviceCallback</code></a> function and setting a user callback function in advance, can determine whether the SYNCHRO button on the Wii console was pressed. When a callback function is set, pairing will not occur automatically, even when the SYNCHRO button is pressed; begin pairing by calling the <a href="WPADStartSyncDevice.html"><code>WPADStartSyncDevice</code></a> function. In addition, the registered callback function is called again after pairing is complete, and you can determine how many Wii Remotes are paired. 75</blockquote> 76<ul> 77<li><b>Simple Pairing</b></li> 78</ul> 79<blockquote> 80The simple pairing remains effective only until the Wii console is shut down. The game application may start a simple pairing by calling the <a href="./WPADStartSimpleSync.html"><code>WPADStartSimpleSync</code></a> or <a href="./WPADStartFastSimpleSync.html"><code>WPADStartFastSimpleSync</code></a> functions. Simple pairing occurs when the 1 and 2 Buttons on the Wii Remote are pressed at the same time.<font color="red"> However, if there is a currently registered Wii console, the Wii Remote will attempt connection with that Wii console when the 1 and 2 Buttons are pressed. When the connection fails, the simple pairing starts.</font><br><br> Simple pairing is executed repeatedly until there are up to four Wii Remotes or is stopped when an application calls the <a href="./WPADStopSimpleSync.html"><code>WPADStopSimpleSync</code></a> function. If a callback is registered, the callback function is called once the pairing process is complete to indicate the number of paired Wii Remotes. 81</blockquote> 82<ul> 83<li><b>Attempting to Pair Different Pairing Types for the Wii Console and Wii Remote</b></li> 84</ul> 85<blockquote> 86Pairing fails when carrying out fundamentally different pairing. However, pairing will be successful in the following cases: 87</blockquote> 88<blockquote> 89<ul> 90<li>When the Wii console is simple pairing and the Wii Remote is normal pairing, the existing pairing information will not be updated and the two will be connected as-is.</li> 91<li>When the Wii console is normal pairing and the Wii Remote is simple pairing, the Wii Remote may be connected before starting simple pairing.</li> 92</ul> 93</blockquote> 94<ul> 95<li><b>Pairing an Already-paired Wii Remote</b></li> 96</ul> 97<blockquote> 98<ul> 99<li>When the Wii console is simple paired with an already normal paired Wii Remote, the pairing will succeed as normal pairing.</li> 100<li>When normal pairing is invoked for a Wii remote that has already undergone simple pairing by the Wii console, the simple pairing is eliminated and replaced by normal pairing.</li> 101</ul> 102</blockquote> 103 104<h2>Deleting Controller Pairings</h2> 105<p> 106If the Wii console SYNCHRO is pressed for 10 seconds or more, all information on the Wii Remotes paired to that Wii console will be deleted. However, the pairing information in the Wii Remote remains intact. 107</p> 108<p> 109The game application can get this information by calling the <a href="WPADSetClearDeviceCallback.html"><code>WPADSetClearDeviceCallback</code></a> function and setting a user callback function in advance. When a callback function is set, information on the remote controls is not deleted; this can be started by calling the <a href="WPADStartClearDevice.html"><code>WPADStartClearDevice</code></a> function. The registered callback function is called again when the all Wii Remotes are released. 110</p> 111<p> 112Furthermore, neither normal pairing nor simple pairing can be carried out while deleting the Wii Remote's pairing information. 113</p> 114 115<h2>Controller Power Button</h2> 116<p> 117The Wii console can be turned on and off using the Wii Remote Power Button. If turned off, the Wii console is turned on by pressing the Power Button. If the Wii console is turned on, pressing the Power Button for approximately one second will send a power off signal to the console. Also, the callback registered by the <a href="../os/Resetbutton/OSSetPowerCallback.html"><code>OSSetPowerCallback</code></a> function is called. 118</p> 119<p> 120However, the power on/off operation can be performed only with a Wii Remote paired with normal pairing. This will not work with a Wii Remote paired with simple pairing. 121</p> 122 123<h2>Controller Control</h2> 124<p> 125The game application can perform a variety of controls with the Wii Remote by sending control commands, including changing the format of received data, getting the Wii Remote's status, and starting and stopping the pointer. If a control command is sent to the Wii Remote, an ACK will be returned from the Wii Remote. If an ACK is received, the next control command can be sent to the Wii Remote. 126</p> 127<p> 128If the game application calls a function that sends a control command, the control command will be stored in the queue maintained within the WPAD library. The WPAD library will start to process the control commands stored in the queue while checking the ACKs from the Wii Remote. When it is not possible to add a new request, <code>WPAD_ERR_BUSY</code> is returned; when this error is returned to the game application, the request should be issued again after waiting. 129</p> 130<p> 131In addition, be aware that the WPAD library uses these queues internally immediately after attaching/detaching an external extension controller in order to initialize the Wii Remote or external extension controller. 132</p> 133 134<h2>Controller Status Confirmation</h2> 135<p> 136A game application can call the <a href="./WPADProbe.html"><code>WPADProbe</code></a> function to get the connection status and the controller type of each controller number. The connection statuses that can be obtained and their respective meanings are shown below: 137</p> 138<table border="1" cellpadding="3" cellspacing="0.1"> 139 <tbody> 140 <tr> 141<td><code>WPAD_ERR_NONE</code></td> 142<td>The Wii Remote is connected and control commands are not being sent from the Wii console to the Wii Remote.</td> 143 </tr> 144 <tr> 145<td><code>WPAD_ERR_NO_CONTROLLER</code></td> 146<td>The Wii Remote is disconnected.</td> 147 </tr> 148 <tr> 149<td><code>WPAD_ERR_BUSY</code></td> 150<td>A control command has been sent to a connected Wii Remote, and the system is waiting for an ACK from the Wii Remote.<br><font color="red">However, in this state, the Wii Remote sends the controller information just as it does normally. <br> This means that the <a href="./WPADRead.html"><code>WPADRead</code></a> function can be used to obtain controller information.</font></td> 151 </tr> 152 <tr> 153<td><code>WPAD_ERR_TRANSFER</code></td> 154<td>The control command that was sent to the Wii Remote has failed.</td> 155 </tr> 156 </tbody> 157</table> 158<p> 159In order to check the controller status, you can send notification by means of a callback in addition to periodically calling the <a href="./WPADProbe.html"><code>WPADProbe</code></a> function. The <a href="./WPADSetConnectCallback.html"><code>WPADSetConnectCallback</code></a> function calls the registered callback when a controller is connected or disconnected. The <a href="./WPADSetExtensionCallback.html"><code>WPADSetExtensionCallback</code></a> function calls the registered callback when an external extension controller is inserted or removed and the controller type changes. 160</p> 161<p> 162When connecting a Wii Remote with an external extension controller inserted in the Wii console, the type of the external extension controller is not immediately known, because awareness of the external extension controller only occurs after the Wii Remote has completed its connection. The status obtained by the <a href="./WPADProbe.html"><code>WPADProbe</code></a> function changes with time. 163</p> 164<table border="1" rules="cols" cellpadding="3" cellspacing="0.1"> 165<tbody> 166<tr><td align="center" width="300px">Immediately after connection</td><td><code>WPAD_DEV_CORE</code></td></tr> 167<tr><td align="center">↓</td><td></td></tr> 168<tr><td align="center">The period of time between when a external extension controller notification is made from the Wii Remote until the type is obtained</td><td><code>WPAD_DEV_UNKNOWN</code></td></tr> 169<tr><td align="center">↓</td><td></td></tr> 170<tr><td align="center">After the type of the external extension controller is obtained</td><td><code>WPAD_DEV_FREESTYLE</code><br><code>WPAD_DEV_CLASSIC</code></td></tr> 171</tbody> 172</table> 173<p> 174In addition, the <a href="./WPADGetInfo.html"><code>WPADGetInfo(Async)</code></a> function can be called to get the current information about the controller (remaining battery power, player indicator light status, and so on). 175</p> 176 177<h2>Obtaining Controller Information</h2> 178<p> 179There are two methods of obtaining controller information: (1) obtaining only the latest controller information using the <a href="./WPADRead.html"><code>WPADRead</code></a> function and (2) using the <a href="./WPADSetAutoSamplingBuf.html"><code>WPADSetAutoSamplingBuf</code></a> function to automatically store the controller information in a buffer prepared by the application. <a href="./WPADRead.html"><code>WPADRead</code></a> and <a href="./WPADSetAutoSamplingBuf.html"><code>WPADSetAutoSamplingBuf</code></a> can be used together. 180</p> 181<p> 182The <a href="./WPADRead.html"><code>WPADRead</code></a> function can be called at any time as long as the Wii Remote is connected. In other words, it can be called when the <font color="red"><b><a href="./WPADProbe.html"><code>WPADProbe</code></a> function returns anything other than <code>WPAD_ERR_NO_CONTROLLER</code>.(It can also be called when <code>WPAD_ERR_BUSY</code> is returned.)</b></font> 183</p> 184<p> 185The <a href="./WPADSetAutoSamplingBuf.html"><code>WPADSetAutoSamplingBuf</code></a> function sets the buffer that stores controller information automatically when controller information is received from the Wii Remote, and the buffer is used internally as a ring buffer. The buffer index that stored the most recent controller information can be obtained with the <a href="./WPADGetLatestIndexInBuf.html"><code>WPADGetLatestIndexInBuf</code></a> function. Using the <a href="./WPADSetSamplingCallback.html"><code>WPADSetSamplingCallback</code></a> function, it gets the number of times that controller information has been received, and by comparing this number with the previous index, it can process the stored controller information in the order in which it was received. 186</p> 187<p> 188The types of the controller information that can be obtained with the <a href="./WPADRead.html"><code>WPADRead</code></a> and <a href="./WPADSetAutoSamplingBuf.html"><code>WPADSetAutoSamplingBuf</code></a> functions are stored in the types of the structure that corresponds to the data format specified by the <a href="./WPADSetDataFormat.html"><code>WPADSetDataFormat</code></a> function. The data format of the received data and the corresponding types of structures are shown below. 189</p> 190<table border="1"> 191<TR> 192<TD width="150"><CODE>WPAD_FMT_CORE </CODE></TD> 193<TD>Wii Remote data format (<a href="./WPADStatus.html"><code>WPADStatus</code> structure</a>). Only button information is valid. <font color="ff0000"><B>Note:</B> This is the default type.</font></TD> 194</TR> 195<TR> 196<TD width="150"><CODE>WPAD_FMT_CORE_ACC </CODE></TD> 197<TD>Wii Remote data format (<a href="./WPADStatus.html"><code>WPADStatus</code> structure</a>). The button and motion sensor information is valid.</TD> 198</TR> 199<TR> 200<TD width="150"><CODE>WPAD_FMT_CORE_ACC_DPD </CODE></TD> 201<TD>Wii Remote data format (<a href="./WPADStatus.html"><code>WPADStatus</code> structure</a>). The button, motion sensor, and pointer information is valid. The pointer has valid size and coordinate data.</TD> 202</TR> 203<TR> 204<TD width="150"><CODE>WPAD_FMT_FREESTYLE</CODE></TD> 205<TD>Nunchuk Style data format type (<a href="./WPADFSStatus.html"><code>WPADFSStatus</code> structure</a>). For the Wii Remote, only the button information is valid.</TD> 206</TR> 207<TR> 208<TD width="150"><CODE>WPAD_FMT_FREESTYLE_ACC</CODE></TD> 209<TD>Nunchuk Style data format type (<a href="./WPADFSStatus.html"><code>WPADFSStatus</code> structure</a>). For the Wii Remote, the button and motion sensor information is valid.</TD> 210</TR> 211<TR> 212<TD width="150"><CODE>WPAD_FMT_FREESTYLE_ACC_DPD</CODE></TD> 213<TD>Nunchuk Style data format type (<a href="./WPADFSStatus.html"><code>WPADFSStatus</code> structure</a>). The Wii Remote button, motion sensor, and pointer information is valid. However, only the coordinate data is valid for the pointer.</TD> 214</TR> 215<TR> 216<TD width="150"><CODE>WPAD_FMT_CLASSIC</CODE></TD> 217<TD>Classic Style data format type (<a href="./WPADCLStatus.html"><code>WPADCLStatus</code> structure</a>). Only the button information is valid for the Wii Remote.</TD> 218</TR> 219<TR> 220<TD width="150"><CODE>WPAD_FMT_CLASSIC_ACC</CODE></TD> 221<TD>Classic Style data format type (<a href="./WPADCLStatus.html"><code>WPADCLStatus</code> structure</a>). The button and motion sensor information is valid for the Wii Remote.</TD> 222</TR> 223<TR> 224<TD width="150"><CODE>WPAD_FMT_CLASSIC_ACC_DPD</CODE></TD> 225<TD>Classic Style data format type (<a href="./WPADCLStatus.html"><code>WPADCLStatus</code> structure</a>). The Wii Remote button, motion sensor, and pointer information is valid. However, only the coordinate data is valid for the pointer.</TD> 226</TR> 227<TR> 228<TD width="150"><CODE>WPAD_FMT_CORE_ACC_DPD_FULL</CODE></TD> 229<TD>Wii Remote extended data format (<a href="./WPADStatus.html"><code>WPADStatusEx</code> structure</a>). The Wii Remote button, motion sensor, and pointer information is valid. For the pointer, the coordinate data, size, object radius, pixel value, and range are valid. However, the data rate is half that of normal (roughly 100 samples per second).</TD> 230</TR> 231</table> 232 233<p> 234The <code>err</code> member of the <a href="./WPADStatus.html"><code>WPADStatus structure</code></a> indicates the status of the controller information, and the value of the <code>dev</code> member indicates the controller type at the point in time when the controller information was received. For controller information that was obtained with the <font color="red"><b><a href="./WPADRead.html"><code>WPADRead</code></a> or <a href="./WPADSetAutoSamplingBuf.html"><code>WPADSetAutoSamplingBuf</code></a> functions, check the value of the <code>err</code> member and only use valid input information.</b></font> The error codes that are passed to <code>err</code> and their descriptions are shown below. 235</p> 236<table border="1" cellpadding="3" cellspacing="0.1"> 237 <tbody> 238 <tr> 239<td><code>WPAD_ERR_NONE</code></td> 240<td>The case when the controller information was received correctly. In this case, the data for the Wii Remote and the external extension controllers were all valid.</td> 241 </tr> 242 <tr> 243<td><code>WPAD_ERR_INVALID</code></td> 244<td>The case when the data that was received has a different data format than what was specified for the WPAD library. In this case, the data for the Wii Remote and external extension controllers is all invalid.</td> 245 </tr> 246 <tr> 247<td><code>WPAD_ERR_CORRUPTED</code></td> 248<td>The case when an external extension controller such as the Nunchuk or Classic Controller is partially inserted into the Wii Remote, and the data for the external extension controller is corrupted. In this case, the data from the Wii Remote's buttons, motion sensors, and pointer are not corrupted.</td> 249 </tr> 250 <tr> 251<td><code>WPAD_ERR_BUSY</code></td> 252<td>The case when an ACK has been received in response to a control command. In this case, the Wii Remote's button data can be used, but the motion sensor and pointer data are invalid.</td> 253 </tr> 254 </tbody> 255</table> 256 257<h2>Specifying the Received Data Format</h2> 258<p> 259The Wii Remote can use its buttons, pointer, and motion sensor. In addition, External Extension Controller input can be used by attaching an External Extension Controller like a Nunchuk. However, not all data can be sent because of the wireless specifications. Therefore, the game application must call the <a href="./WPADSetDataFormat.html"><code>WPADSetDataFormat</code></a> function to select the format for the controller information according to its application. The following formats for controller information are available. 260</p> 261 262<table border="1" cellpadding="3" cellspacing="0.1"> 263 <tbody> 264 <tr> 265<td><code>WPAD_FMT_CORE</code></td> 266<td>Wii Remote buttons only</td> 267 </tr> 268 <tr> 269<td><code>WPAD_FMT_CORE_ACC</code></td> 270<td>Wii Remote buttons and motion sensor</td> 271 </tr> 272 <tr> 273<td><code>WPAD_FMT_CORE_ACC_DPD</code></td> 274<td>Wii Remote buttons, motion sensor, and pointer (coordinate data and size)</td> 275 </tr> 276 <tr> 277<td><code>WPAD_FMT_FREESTYLE</code></td> 278<td>Wii Remote buttons and the Nunchuk</td> 279 </tr> 280 <tr> 281<td><code>WPAD_FMT_FREESTYLE_ACC</code></td> 282<td>Wii Remote buttons, motion sensor, and the Nunchuk</td> 283 </tr> 284 <tr> 285<td><code>WPAD_FMT_FREESTYLE_ACC_DPD</code></td> 286<td>Wii Remote buttons, motion sensor, pointer (coordinate data), and the Nunchuk</td> 287 </tr> 288 <tr> 289<td><code>WPAD_FMT_CLASSIC</code></td> 290<td>Wii Remote buttons and the Classic Controller</td> 291 </tr> 292 <tr> 293<td><code>WPAD_FMT_CLASSIC_ACC</code></td> 294<td>Wii Remote buttons, motion sensor, and the Classic Controller</td> 295 </tr> 296 <tr> 297<td><code>WPAD_FMT_CLASSIC_ACC_DPD</code></td> 298<td>Wii Remote buttons, motion sensor, pointer (coordinate data), and the Classic Controller</td> 299 </tr> 300 <tr> 301<td><code>WPAD_FMT_CORE_ACC_DPD_FULL</code></td> 302<td>Wii Remote buttons, motion sensor, and pointer (coordinate data, size, object radius, pixel values, and range)<br> <font color="red">Note that the sampling rate is half that of other formats.</font></td> 303 </tr> 304 </tbody> 305</table> 306 307<p> 308<B>Note:</B> When specifying a format from among the above that uses the pointer, call the <a href="./WPADControlDpd.html">WPADControlDpd</a> function to start the pointer before calling the <a href="./WPADSetDataFormat.html">WPADSetDataFormat</a> function. 309</p> 310 311<h2>Attaching/Detaching External Extension Controllers</h2> 312<p> 313A variety of External Extension Controllers can be attached to the Wii Remote via the External Extension Connector even while the Wii Remote is communicating. The game application can detect the attachment/detachment of an External Extension Controller by using polling with the <a href="./WPADProbe.html"><code>WPADProbe</code></a> function or by registering a callback function in advance with the <a href="./WPADSetExtensionCallback.html"><code>WPADSetExtensionCallback</code></a> function. If an External Extension Controller plug is inserted/removed during communications, the Wii Remote stops sending controller information. Therefore, when a plug insertion or removal is detected, reset the data format for controller information to match the situation using the <a href="./WPADSetDataFormat.html"><code>WPADSetDataFormat</code></a> function. Once the settings are complete, controller information will be sent from the Wii Remote. 314</p> 315 316<h2>Rumble Feature Controls</h2> 317<p> 318The Rumble Feature of the Wii Remote can be turned ON/OFF. The ON/OFF setting is stored internally within the library. When the library is initialized, the ON/OFF setting for the Rumble feature is set by default to the value in Wii Settings. When the Rumble feature is set to ON, you can use the <a href="./WPADControlMotor.html"><code>WPADControlMotor</code></a> function to control the vibration of the Wii Remote for the specified channel. In addition, the <a href="./WPADStartMotor.html"><code>WPADStartMotor</code></a> and <a href="./WPADStartMotor.html"><code>WPADStopMotor</code></a> functions are available as macro functions. 319</p> 320<p> 321The status of the ON/OFF setting for the Rumble feature that is stored within the library can be obtained using the <a href="./WPADIsMotorEnabled.html"><code>WPADIsMotorEnabled</code></a> function. 322</p> 323 324<h2>Speaker Controls</h2> 325<ul> 326<li><b>Outputting Sound through the Speaker</b></li> 327</ul> 328<blockquote> 329You can use the <a href="./WPADControlSpeaker.html"><code>WPADControlSpeaker</code></a> function to control the speaker of the Wii Remote on the specified channel. Activate the speaker using the function <a href="./WPADControlSpeaker.html"><code>WPADControlSpeaker</code></a>. Once activated, audio can be output from the speaker by sending audio data using the <a href="./WPADSendStreamData.html"><code>WPADSendStreamData</code></a> function. Due to the audio specifications of the audio processor of the Wii Remote, 20 bytes of audio data must be sent three times every 20 ms in order to achieve correct audio playback. 330</blockquote> 331<ul> 332<li><b>Starting and Stopping the Speaker</b></li> 333</ul> 334<blockquote> 335In order to avoid wearing down the batteries in scenes where no sound is output through the Wii Remote speaker for a period of time, use the <a href="./WPADControlSpeaker.html"><code>WPADControlSpeaker</code></a> function to send the <code>WPAD_SPEAKER_OFF</code> command whenever possible to stop the speaker. However, starting or stopping the speaker will prevent you from being able to obtain several input samples from the motion sensor, pointer, and external extension controller of the Wii Remote. Accordingly, in scenes in which sound is output frequently, there is no need to start and stop the speaker often. In such scenes, keep the speaker ON the whole time, and instead of starting and stopping the speaker, use the <a href="WPADControlSpeaker.html"><code>WPADControlSpeaker</code></a> function to send a <code>WPAD_SPEAKER_MUTE</code> or <code>WPAD_SPEAKER_MUTE_OFF</code> commands to turn muting ON/OFF. 336</blockquote> 337<ul> 338<li><b>Broken or Jumpy Sound</b></li> 339</ul> 340<blockquote> 341Due to the audio processor and wireless communication specifications of the Wii console and the Wii Remote, there are times when the sound will break or jump. Broken sound occurs when the start of the encoder on the Wii console side and the decoder on the Wii Remote side are out of sync with each other. Consequently, the sound will break up as long as the starts are out of sync. In order to synchronize the starts, you must restart the speaker. Jumps in sounds occur when the sample on the Wii Remote side could not be processed. Consequently, even if you don't take any particular action, there won't be any problems with subsequent playback.<br /> <br /> Due to the specifications of the audio processor, the Wii Remote's speaker <font color="red"><b>may cause the sound to break or jump if sound is played back continuously for eight minutes or longer.</b></font>To avoid this, do one of the following: 342<ul> 343<li>Restart the speaker using the <a href="WPADcontrolSpeaker.html"><code>WPADControlSpeaker</code></a> within eight minutes of playing a sound.</li> 344<li>Refrain from playing a sound for one second or more before eight minutes pass after playing back a sound.</li> 345</ul> 346 347In addition, due to the specifications for wireless communication, it has been confirmed that the Wii Remote speaker <font color="red"><b>will break up sound in the following situations.</b></font>In order to avoid the broken sound in the following cases, call the <a href="./WPADCanSendStreamData.html"><code>WPADCanSendStreamData</code></a> function when sending sounds, and make sure the sound can be sent without breaking up. 348<ul> 349<li>When packet loss due to external noise goes above a certain amount</li> 350<li>When an External Extension Controller is plugged in</li> 351<li>When attempting to pair another Wii Remote to the Wii console (regardless of whether the pairing succeeds or fails)</li> 352<li>When a command is sent (especially when accessing internal memory)</li> 353</ul> 354</blockquote> 355 356<h2>Internal Memory</h2> 357<p> 358Wii Remotes are equipped with internal memory that can be used by game applications. Game applications can use <code>3888 bytes</code> of this memory and save one file only. Furthermore, such files can be read only by the application that saved them. All game applications can overwrite files. 359</p> 360 361<h2>Automatic Disconnect</h2> 362<p> 363The WPAD library disconnects if there has been no change in controller input for a fixed period of time. This is done to avoid using up battery power of the Wii Remote due to user inattention. The WPAD Library checks all input from the buttons, motion sensor, pointer, and input from the External Extension Controller. 364</p> 365<p> 366The wait time is set to five minutes by default. However, the setting can be changed using the <a href="./WPADSetAutoSleepTime.html"><code>WPADSetAutoSleepTime</code></a> function. 367</p> 368 369<h2>Resetting the Analog Stick Origin</h2> 370<p> 371The analog stick origin of a Nunchuk or Classic Controller can be reset by holding down the A, B, +, and - buttons on the Wii Remote or Classic Controller for three seconds. However, the origin cannot be reset with combinations like the A and B Buttons on the Wii Remote and the + and - Buttons on the Classic Controller. 372</p> 373 374<h2>Controller Port Mapping</h2> 375<p> 376The WPAD library remembers the Wii Remote last used with each controller port. When a Wii Remote is connected, the same port as the previous time as based on the mapping table is assigned if possible. If the connected Wii Remote cannot be found in the mapping table, the port with the smallest number of those available is assigned. 377</p> 378<p> 379This mapping table can be cleared with the <a href="./WPADDisconnect.html"><code>WPADDisconnect</code></a> or <a href="./../os/Reset/OSShutdownSystem.html"><code>WPADShutdownSystem</code></a> functions. It is also cleared when the Wii Remote Power Button is held down, causing disconnection. 380</P> 381 382<h2>Termination Processing</h2> 383<p> 384The WPAD library close process is now performed inside the OS library reset function. When closing, call the OS library reset/shutdown function from the application. 385</p> 386<p> 387The <a href="./../os/Reset/OSShutdownSystem.html"><code>OSShutdownSystem</code></a> function disconnects all communicating Wii Remotes. Although the <a href="./../os/Reset/OSRestart.html"><code>OSRestart</code></a>, <a href="./../os/Reset/OSRestart.html"><code>OSReturnToMenu</code></a>, and <a href="./../os/Reset/OSRestart.html"><code>OSRebootSystem</code></a> functions will disconnect all communicating Wii Remotes, the remotes will be in an auto-reconnect state (reconnect without any button input) for about 15 to 20 seconds after disconnection. When a game application is restarted or moves to the console menu, it is possible to restore the state before reset without any button input on the part of the user. 388</p> 389 390<h2>Cautions When Using the Wireless LAN</h2> 391<p> 392The Wii console and the Wii Remote communicate using the 2.4 GHz band. Using a wireless LAN on the same 2.4Ghz band may cause interference that results in communication problems. To prevent this, the SDK automatically switches the frequency band it uses in order to avoid such interference. The application no longer needs to be aware of this issue. 393</p> 394 395<h2>Revision History</h2> 396<p> 3972007/12/10 Deleted descriptions of <CODE>WPADSaveConfig</CODE>, <CODE>WPADEnableMotor</CODE>, and <CODE>WPADSetSpeakerVolume</CODE>, and updated the description about checking the controller status and obtaining controller information.<br> 2007/10/11 updated the description about controlling the speaker.<br> 2007/06/07 Added an explanation about the simple pairing specification change.<br>2007/04/03 Added a description about the error codes.<br>2007/03/22 Added a supplemental description about turning the Rumble Feature on and off. <br>2007/02/08 Noted that the Classic Controller can also reset the origin. Noted that Wii Remote pairing is not possible while deleting pairing information. Added text about stopping the Wii Remote speaker when it is not in use.<br>2006/11/09 Added an explanation about the process of reconnecting while an external extension controller is attached.<br>2006/10/23 Changed explanations about pairing and end process. <br>2006/09/18 Added an explanation about the internal process to avoid interference with wireless LANs.</li> <li>Deleted warnings about the bugs found in SDK Version 2.2. </li><li>Noted about the change in the way the mapping tables are handled.</li> <li>Added a description for pairing Wii Remote.</li></ul>2006/09/06 <ul><li>In the specifications for turning the Rumble Feature on and off, and in the speaker volume settings, made the modifications to reflect the changes.</li> Described problems with controller controls and the speaker. Added information about simple registration, internal memory, automatic disconnect, controller port mapping, close operation, and Control Stick origin reset.<br> 2006/07/04 Added information on speakers.<br>2006/06/19 Deleted the object size restriction from the cautions specific to UI tools.<br> 2005/11/10 Added description of DPD module's hardware bug.<BR> 2005/11/09 <ul><li>Corrected warnings about the use of the GameCube standard controller.</li> <li>Changed the description of the PAD library treatment in DolphinSDK.</li> Added bug report.<br> 2005/11/01 <ul><li>Added a caution related to SI in conjunction with the change of interface from EXI to SI.</li> <li>Added links to functions.</li> <li>Added introduction text for KPAD library.</li> Added bug report.<br> 2005/09/27 Changed the name to DPD. Deleted the description related to hardware in the Introduction.<br>2005/08/30 Revised the button description in the Introduction, added bug report.<br>2005/08/01 Initial version. 398</p> 399 400<hr><p>CONFIDENTIAL</p></body></html>