| 1 | |
| 2 | <refentry id="joystick"> |
| 3 | <indexterm id="Indexjoystick"><primary>joystick</primary></indexterm> |
| 4 | <refentryinfo><title>Instrument Control:Sensing and Control</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>joystick</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | <refnamediv> |
| 10 | <refname>joystick</refname> |
| 11 | <refpurpose> |
| 12 | Reads data from a joystick controller. |
| 13 | </refpurpose> |
| 14 | </refnamediv> |
| 15 | |
| 16 | <refsect1> |
| 17 | <title>Description</title> |
| 18 | <para>Plugin opcode in joystick.</para> |
| 19 | <para> |
| 20 | Reads data from a Linux joystick controller |
| 21 | </para> |
| 22 | </refsect1> |
| 23 | |
| 24 | <refsect1> |
| 25 | <title>Syntax</title> |
| 26 | <synopsis>kres <command>joystick</command> kdevice, ktab</synopsis> |
| 27 | </refsect1> |
| 28 | |
| 29 | <refsect1> |
| 30 | <title>Performance</title> |
| 31 | <note> |
| 32 | <para> |
| 33 | Please note that this opcode is currently only supported on |
| 34 | GNU/Linux. |
| 35 | </para> |
| 36 | </note> |
| 37 | <para> |
| 38 | <emphasis>kdevice</emphasis> -- the index of the joystick device, either /dev/js<emphasis>N</emphasis> or |
| 39 | /dev/input/js<emphasis>N</emphasis>. |
| 40 | </para> |
| 41 | <para> |
| 42 | <emphasis>ktab</emphasis> -- A table to hold input results, |
| 43 | should be at least enough elements to store one value for each |
| 44 | stick axis and one for each button + 2. The first two elements |
| 45 | of the table are initialized with the number of axes and the |
| 46 | number of buttons, respectively, when a joystick is opened. If a |
| 47 | joystick is unplugged during performance, the opcode will |
| 48 | repeatedly attempt to reopen the device with a delay between |
| 49 | attempts. |
| 50 | </para> |
| 51 | </refsect1> |
| 52 | |
| 53 | <refsect1> |
| 54 | <title>Examples</title> |
| 55 | <para> |
| 56 | Here is an example of the joystick opcode. It uses the file <ulink url="examples/joystick.csd"><citetitle>joystick.csd</citetitle></ulink>. |
| 57 | <para>See the sections <link linkend="UsingRealTime"><citetitle>Real-time Audio</citetitle></link> and <link linkend="CommandFlags"><citetitle>Command Line Flags</citetitle></link> for more information on using command line flags.</para> |
| 58 | </para> |
| 59 | <xi:include href="examples-xml/joystick.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 60 | <para> |
| 61 | Here is another example of the joystick opcode. It uses the file <ulink url="examples/joystick-2.csd"><citetitle>joystick-2.csd</citetitle></ulink>. |
| 62 | </para> |
| 63 | <xi:include href="examples-xml/joystick-2.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 64 | </refsect1> |
| 65 | |
| 66 | <refsect1> |
| 67 | <title>See also</title> |
| 68 | <para><link linkend="ControlSensing"><citetitle>Sensing and Control: Keyboard and mouse sensing</citetitle></link></para> |
| 69 | <para><link linkend="nonMIDIdevices"><citetitle>non-MIDI devices</citetitle></link></para> |
| 70 | </refsect1> |
| 71 | |
| 72 | <refsect1> |
| 73 | <title>Credits</title> |
| 74 | <para> |
| 75 | <simplelist> |
| 76 | <member>Author: Justin Glenn Smith</member> |
| 77 | <member>2010</member> |
| 78 | </simplelist> |
| 79 | </para> |
| 80 | <para>New in version 5.17.12</para> |
| 81 | </refsect1> |
| 82 | </refentry> |