| 1 | |
| 2 | <refentry id="xyin"> |
| 3 | <indexterm id="IndexXyin"><primary>xyin</primary></indexterm> |
| 4 | <refentryinfo><title>Instrument Control:Sensing and Control</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>xyin</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | |
| 10 | |
| 11 | <refnamediv> |
| 12 | <refname>xyin</refname> |
| 13 | |
| 14 | <refpurpose> |
| 15 | Sense the cursor position in an output window |
| 16 | </refpurpose> |
| 17 | </refnamediv> |
| 18 | |
| 19 | <refsect1> |
| 20 | <title>Description</title> |
| 21 | <para> |
| 22 | Sense the cursor position in an output window. When <emphasis>xyin</emphasis> is called the position of the mouse within the output window is used to reply to the request. This simple mechanism does mean that only one <emphasis>xyin</emphasis> can be used accurately at once. The position of the mouse is reported in the output window. |
| 23 | </para> |
| 24 | </refsect1> |
| 25 | |
| 26 | <refsect1> |
| 27 | <title>Syntax</title> |
| 28 | <synopsis>kx, ky <command>xyin</command> iprd, ixmin, ixmax, iymin, iymax [, ixinit] [, iyinit]</synopsis> |
| 29 | </refsect1> |
| 30 | |
| 31 | <refsect1> |
| 32 | <title>Initialization</title> |
| 33 | <para> |
| 34 | <emphasis>iprd</emphasis> -- period of cursor sensing (in seconds). Typically .1 seconds. |
| 35 | </para> |
| 36 | |
| 37 | <para> |
| 38 | <emphasis>xmin, xmax, ymin, ymax</emphasis> -- edge values for the x-y coordinates of a cursor in the input window. |
| 39 | </para> |
| 40 | |
| 41 | <para> |
| 42 | <emphasis>ixinit, iyinit</emphasis> (optional) -- initial x-y coordinates reported; the default values are 0,0. If these values are not within the given min-max range, they will be coerced into that range. |
| 43 | </para> |
| 44 | </refsect1> |
| 45 | |
| 46 | <refsect1> |
| 47 | <title>Performance</title> |
| 48 | <para> |
| 49 | <emphasis>xyin</emphasis> samples the cursor x-y position in an input window every <emphasis>iprd</emphasis> seconds. Output values are repeated (not interpolated) at the k-rate, and remain fixed until a new change is registered in the window. There may be any number of input windows. This unit is useful for real-time control, but continuous motion should be avoided if <emphasis>iprd</emphasis> is unusually small. |
| 50 | </para> |
| 51 | <note> |
| 52 | <para> |
| 53 | Depending on your platform and distribution, you might need to enable displays using the <emphasis>--displays</emphasis> command line flag. |
| 54 | </para> |
| 55 | </note> |
| 56 | </refsect1> |
| 57 | |
| 58 | <refsect1> |
| 59 | <title>Examples</title> |
| 60 | <para> |
| 61 | Here is an example of the xyin opcode. It uses the file <ulink url="examples/xyin.csd"><citetitle>xyin.csd</citetitle></ulink>. |
| 62 | |
| 63 | <example> |
| 64 | <title>Example of the xyin opcode.</title> |
| 65 | |
| 66 | |
| 67 | |
| 68 | <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> |
| 69 | <xi:include href="examples-xml/xyin.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 70 | </example> |
| 71 | |
| 72 | As the values of kx and ky change, they will be printed out like this: |
| 73 | <screen> |
| 74 | kx=8.612036, ky=22.677933 |
| 75 | kx=10.765685, ky=15.644135 |
| 76 | </screen> |
| 77 | </para> |
| 78 | </refsect1> |
| 79 | |
| 80 | <refsect1> |
| 81 | <title>See also</title> |
| 82 | <para><link linkend="ControlSensing"><citetitle>Sensing and Control: Keyboard and mouse sensing</citetitle></link></para> |
| 83 | </refsect1> |
| 84 | |
| 85 | <refsect1> |
| 86 | <title>Credits</title> |
| 87 | <para>Example written by &namekevin;.</para> |
| 88 | </refsect1> |
| 89 | </refentry> |