| 1 | |
| 2 | <refentry id="changed2"> |
| 3 | <indexterm id="IndexChanged2"><primary>changed2</primary></indexterm> |
| 4 | <refentryinfo><title>Instrument Control:Sensing and Control</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>changed2</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | |
| 10 | |
| 11 | <refnamediv> |
| 12 | <refname>changed2</refname> |
| 13 | <refpurpose> |
| 14 | k-rate signal change detector. |
| 15 | </refpurpose> |
| 16 | </refnamediv> |
| 17 | |
| 18 | <refsect1> |
| 19 | <title>Description</title> |
| 20 | <para> |
| 21 | This opcode outputs a trigger signal that informs when any one |
| 22 | of its k-rate arguments has changed, or a value in an array. Useful with valuator widgets or MIDI controllers. |
| 23 | </para> |
| 24 | </refsect1> |
| 25 | <refsect1> |
| 26 | <title>Syntax</title> |
| 27 | <synopsis>ktrig <command>changed2</command> kvar1 [, kvar2,..., kvarN]</synopsis> |
| 28 | <synopsis>ktrig <command>changed2</command> karr[]</synopsis> |
| 29 | <synopsis>ktrig <command>changed2</command> aarr[]</synopsis> |
| 30 | </refsect1> |
| 31 | |
| 32 | <refsect1> |
| 33 | <title>Performance</title> |
| 34 | <para> |
| 35 | <emphasis>ktrig</emphasis> - Outputs a value of 1 when any of |
| 36 | the k-rate signals has changed, or any value in the array, otherwise outputs 0. |
| 37 | </para> |
| 38 | <para> |
| 39 | <emphasis>kvar1 [, kvar2,..., kvarN]</emphasis> - k-rate variables to watch for changes. |
| 40 | </para> |
| 41 | |
| 42 | <para> |
| 43 | <emphasis>xarray</emphasis> - any array type. |
| 44 | </para> |
| 45 | <para> |
| 46 | Unlike the opcode <emphasis>changed</emphasis> this opcode will |
| 47 | never report the first cycle as a change. |
| 48 | </para> |
| 49 | |
| 50 | </refsect1> |
| 51 | |
| 52 | <refsect1> |
| 53 | <title>Examples</title> |
| 54 | <para> |
| 55 | Here are two examples of the changed2 opcode. They use the files |
| 56 | <ulink |
| 57 | url="examples/changed2.csd"><citetitle>changed2.csd</citetitle></ulink> |
| 58 | and <ulink url="examples/changed2a.csd"><citetitle>changed2a.csd</citetitle></ulink>. |
| 59 | |
| 60 | <example> |
| 61 | <title>Example of the changed2 opcode.</title> |
| 62 | <xi:include href="examples-xml/changed2.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 63 | |
| 64 | </example> |
| 65 | Its output should include lines like: |
| 66 | <screen> |
| 67 | i 1 time 0.00267: 0.00000 |
| 68 | i1 0.00000 |
| 69 | i1 1.00000 |
| 70 | i1 0.00000 |
| 71 | i 1 time 0.20267: 1.00000 |
| 72 | i 1 time 0.40267: 1.00000 |
| 73 | i1 1.00000 |
| 74 | i1 0.00000 |
| 75 | i 1 time 0.60267: 1.00000 |
| 76 | i 1 time 0.80267: 1.00000 |
| 77 | i1 1.00000 |
| 78 | i1 0.00000 |
| 79 | i 1 time 1.00000: 0.00000 |
| 80 | i1 1.00000 |
| 81 | i1 0.00000 |
| 82 | i 1 time 1.20267: -1.00000 |
| 83 | i 1 time 1.40267: -1.00000 |
| 84 | i1 1.00000 |
| 85 | i1 0.00000 |
| 86 | i 1 time 1.60267: -1.00000 |
| 87 | i 1 time 1.80000: -1.00000 |
| 88 | i1 1.00000 |
| 89 | i1 0.00000 |
| 90 | i 1 time 2.00000: -0.00000 |
| 91 | i1 1.00000 |
| 92 | i1 0.00000 |
| 93 | ......... |
| 94 | </screen> |
| 95 | </para> |
| 96 | <example> |
| 97 | <title>Example of the changed2 opcode.</title> |
| 98 | <xi:include href="examples-xml/changed2a.csd.xml" |
| 99 | xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 100 | </example> |
| 101 | </refsect1> |
| 102 | |
| 103 | <refsect1> |
| 104 | <title>See also</title> |
| 105 | <para><link linkend="ControlSensing"><citetitle>Sensing and Control: Tempo and Sequencing</citetitle></link></para> |
| 106 | </refsect1> |
| 107 | |
| 108 | <refsect1> |
| 109 | <title>Credits</title> |
| 110 | <para>Written by &namejohn;.</para> |
| 111 | <para>Example written by &nameandres;.</para> |
| 112 | <para>New in Csound 6.7</para> |
| 113 | </refsect1> |
| 114 | </refentry> |
| 115 |