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