| 1 |
|
| 2 |
<refentry id="wiidata"> |
| 3 |
<indexterm id="Indexwiidata"><primary>wiidata</primary></indexterm> |
| 4 |
<refentryinfo><title>Instrument Control:Sensing and Control</title></refentryinfo> |
| 5 |
<refmeta> |
| 6 |
<refentrytitle>wiidata</refentrytitle> |
| 7 |
</refmeta> |
| 8 |
|
| 9 |
<refnamediv> |
| 10 |
<refname>wiidata</refname> |
| 11 |
<refpurpose> |
| 12 |
Reads data fields from a number of external Nintendo Wiimote controllers. |
| 13 |
</refpurpose> |
| 14 |
</refnamediv> |
| 15 |
|
| 16 |
<refsect1> |
| 17 |
<title>Description</title> |
| 18 |
<para>Plugin opcode in wiimote. This opcode is part of the plugin repository and has to be installed separately. |
| 19 |
The plugin repository can be found here: <ulink url="https://github.com/csound/plugins"><citetitle>https://github.com/csound/plugins</citetitle></ulink></para> |
| 20 |
<para> |
| 21 |
Reads data fields from upto four external Nintendo Wiimote controllers. |
| 22 |
</para> |
| 23 |
</refsect1> |
| 24 |
|
| 25 |
<refsect1> |
| 26 |
<title>Syntax</title> |
| 27 |
<synopsis>kres <command>wiidata</command> kcontrol[, knum]</synopsis> |
| 28 |
</refsect1> |
| 29 |
|
| 30 |
<refsect1> |
| 31 |
<title>Initialization</title> |
| 32 |
<para> |
| 33 |
This opcode must be used in conjuction with |
| 34 |
a running <emphasis>wiiconnect</emphasis> opcode. |
| 35 |
</para> |
| 36 |
|
| 37 |
</refsect1> |
| 38 |
|
| 39 |
<refsect1> |
| 40 |
<title>Performance</title> |
| 41 |
<note> |
| 42 |
<para> |
| 43 |
Please note that these opcodes are currently only supported on |
| 44 |
Linux. |
| 45 |
</para> |
| 46 |
</note> |
| 47 |
<para> |
| 48 |
<emphasis>kcontrol</emphasis> -- the code for which control to read |
| 49 |
</para> |
| 50 |
<para> |
| 51 |
<emphasis>knum</emphasis> -- the number of the which Wiimote to |
| 52 |
access, which defaults to the first one. |
| 53 |
</para> |
| 54 |
<para> |
| 55 |
On each access a particular data item of the Wiimote is read. |
| 56 |
The currently implemented controls are given below, together with |
| 57 |
the macro name defined in the file <emphasis>wii_mac</emphasis>: |
| 58 |
</para> |
| 59 |
<para> |
| 60 |
0 (WII_BUTTONS): returns a bit pattern for all buttons that were pressed. |
| 61 |
</para> |
| 62 |
<para> |
| 63 |
1 (WII_TWO): returns 1 if the button has just been pressed, or 0 otherwise. |
| 64 |
</para> |
| 65 |
<para> |
| 66 |
2 (WII_ONE): as above. |
| 67 |
</para> |
| 68 |
<para> |
| 69 |
3 (WII_B): as above. |
| 70 |
</para> |
| 71 |
<para> |
| 72 |
4 (WII_A): as above. |
| 73 |
</para> |
| 74 |
<para> |
| 75 |
5 (WII_MINUS): as above. |
| 76 |
</para> |
| 77 |
<para> |
| 78 |
8 (WII_HOME): as above. |
| 79 |
</para> |
| 80 |
<para> |
| 81 |
9 (WII_LEFT): as above. |
| 82 |
</para> |
| 83 |
<para> |
| 84 |
10 (WII_RIGHT): as above. |
| 85 |
</para> |
| 86 |
<para> |
| 87 |
11 (WII_DOWN): as above. |
| 88 |
</para> |
| 89 |
<para> |
| 90 |
12 (WII_UP): as above. |
| 91 |
</para> |
| 92 |
<para> |
| 93 |
13 (WII_PLUS): as above. |
| 94 |
</para> |
| 95 |
<para> |
| 96 |
If the control number is 100 more than one of these button codes then |
| 97 |
the current state of the button is returned. Macros with names |
| 98 |
like WII_S_TWO etc are defined for this. |
| 99 |
</para> |
| 100 |
<para> |
| 101 |
If the control number is 200 more than one of these button codes then |
| 102 |
the return value is 1 if the button i held and 0 otherwise. Macros with names |
| 103 |
like WII_H_TWO etc are defined for this. |
| 104 |
</para> |
| 105 |
<para> |
| 106 |
If the control number is 300 more than one of these button codes then |
| 107 |
the value is 1 if the button has just been released, and 0 otherwise. |
| 108 |
Macros with names like WII_R_TWO etc are defined for this. |
| 109 |
</para> |
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
<para> |
| 121 |
20 (WII_PITCH): The pitch of the Wiimote. The value is in |
| 122 |
degrees between -90 and +90, unless modified by a <emphasis>wiirange</emphasis> call. |
| 123 |
</para> |
| 124 |
<para> |
| 125 |
21 (WII_ROLL): The roll of the Wiimote. The value is in |
| 126 |
degrees between -90 and +90, unless modified by a <emphasis>wiirange</emphasis> call. |
| 127 |
</para> |
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
<para> |
| 132 |
23 (WII_FORCE_X): The force applied to the Wiimote in the three axes. |
| 133 |
</para> |
| 134 |
<para> |
| 135 |
24 (WII_FORCE_Y): |
| 136 |
</para> |
| 137 |
<para> |
| 138 |
25 (WII_FORCE_Z): |
| 139 |
</para> |
| 140 |
<para> |
| 141 |
26 (WII_FORCE_TOTAL): The total magnitude of the force applied to |
| 142 |
the Wiimote. |
| 143 |
</para> |
| 144 |
<para> |
| 145 |
27 (WII_BATTERY): The percent of the battery that remains. |
| 146 |
</para> |
| 147 |
<para> |
| 148 |
28 (WII_NUNCHUK_ANG): The angle of the nunchuk joystick in degrees. |
| 149 |
</para> |
| 150 |
<para> |
| 151 |
29 (WII_NUNCHUK_MAG): The magnitude of the nunchuk joystick from neutral. |
| 152 |
</para> |
| 153 |
<para> |
| 154 |
30 (WII_NUNCHUK_PITCH): The pitch of the nunchuk in degrees, in |
| 155 |
range -90 to +90 unless modified by a <emphasis>wiirange</emphasis> call. |
| 156 |
</para> |
| 157 |
<para> |
| 158 |
31 (WII_NUNCHUK_ROLL): The roll of the nunchuk in degrees, in |
| 159 |
range -90 to +90 unless modified by a <emphasis>wiirange</emphasis> call. |
| 160 |
</para> |
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
<para> |
| 165 |
33 (WII_NUNCHUK_Z): The state of the nunchuk Z button. |
| 166 |
</para> |
| 167 |
<para> |
| 168 |
34 (WII_NUNCHUK_C): The state of the nunchuk C button. |
| 169 |
</para> |
| 170 |
<para> |
| 171 |
35 (WII_IR1_X): The infrared pointing of the Wiimote. |
| 172 |
</para> |
| 173 |
<para> |
| 174 |
36 (WII_IR1_Y): |
| 175 |
</para> |
| 176 |
<para> |
| 177 |
37 (WII_IR1_Z): |
| 178 |
</para> |
| 179 |
</refsect1> |
| 180 |
|
| 181 |
<refsect1> |
| 182 |
<title>Examples</title> |
| 183 |
<para> |
| 184 |
See the example for <link linkend="wiiconnect"><citetitle>wiiconnect</citetitle></link>. |
| 185 |
</para> |
| 186 |
</refsect1> |
| 187 |
|
| 188 |
<refsect1> |
| 189 |
<title>See Also</title> |
| 190 |
<para><link linkend="nonMIDIdevices"><citetitle>non-MIDI Devices</citetitle></link></para> |
| 191 |
</refsect1> |
| 192 |
|
| 193 |
<refsect1> |
| 194 |
<title>Credits</title> |
| 195 |
<para> |
| 196 |
<simplelist> |
| 197 |
<member>Author: &namejohn;</member> |
| 198 |
<member>Codemist Ltd</member> |
| 199 |
<member>2009</member> |
| 200 |
</simplelist> |
| 201 |
</para> |
| 202 |
<para>New in version 5.11</para> |
| 203 |
</refsect1> |
| 204 |
</refentry> |