summaryrefslogtreecommitdiff
path: root/opcodes/lessthan.xml
blob: 999e0eefad466f64c4ac85c6aa610b12140480ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<refentry id="lessthan">
<indexterm id="IndexLtColon"><primary>:</primary></indexterm>

<indexterm id="IndexLtQuestion"><primary>?</primary></indexterm>

<indexterm id="IndexLtExpression"><primary>conditional expressions</primary></indexterm>

<indexterm id="IndexLt"><primary>&lt;</primary></indexterm>
  <refentryinfo><title>Instrument Control:Conditional Values</title></refentryinfo>
  <refmeta>
    <refentrytitle>&lt;</refentrytitle>
  </refmeta>


 
  <refnamediv>
    <refname>&lt;</refname>

    <refpurpose>
      Determines if one value is less than another.
                            </refpurpose>
  </refnamediv>
 
  <refsect1>
    <title>Description</title>
    <para>
      Determines if one value is less than another.
    </para>
  </refsect1>

  <refsect1>
    <title>Syntax</title>
    <synopsis>(a <command>&lt;</command>  b <command>?</command> v1 <command>:</command> v2)</synopsis>

    <para>
      where <emphasis>a</emphasis>, <emphasis>b</emphasis>, <emphasis>v1</emphasis> and <emphasis>v2</emphasis> may be expressions, but <emphasis>a</emphasis>, <emphasis>b</emphasis> not audio-rate.
    </para>
  </refsect1>

  <refsect1>
    <title>Performance</title>
    <para>
      In the above conditional, <emphasis>a</emphasis> and <emphasis>b</emphasis> are first compared. If the indicated relation is true (<emphasis>a</emphasis> less than <emphasis>b</emphasis>), then the conditional expression has the value of <emphasis>v1</emphasis>; if the relation is false, the expression has the value of <emphasis>v2</emphasis>.
    </para>

    <para>
      NB.: If <emphasis>v1</emphasis> or <emphasis>v2</emphasis> are expressions, these will be evaluated before the conditional is determined.
    </para>

    <para>
      In terms of binding strength, all conditional operators (i.e. the relational operators (<emphasis>&lt;</emphasis>, etc.), and <emphasis>?</emphasis>, and <emphasis>:</emphasis> ) are weaker than the arithmetic and logical operators (<emphasis>+</emphasis>, <emphasis>-</emphasis>, <emphasis>*</emphasis>, <emphasis>/</emphasis>, <emphasis>&amp;&amp;</emphasis> and <emphasis>||</emphasis>).
    </para>

    <para>
      These are <emphasis>operators</emphasis> not <emphasis>opcodes</emphasis>. Therefore, they can be used within orchestra statements, but do not form complete statements themselves.
    </para>
  </refsect1>
 
  <refsect1>
    <title>Examples</title>
    <para>
      Here is an example of the &lt; operator. It uses the file <ulink url="examples/lessthan.csd"><citetitle>lessthan.csd</citetitle></ulink>.

      <example>
        <title>Example of the &lt; operator.</title>

        

        <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>
          <xi:include href="examples-xml/lessthan.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
      </example>

      Its output should include lines like this:
      <screen>
k1 = 2.000000, k2 = 1.000000
k1 = 3.000000, k2 = 0.000000
k1 = 4.000000, k2 = 0.000000</screen>
    </para>
  </refsect1>

  <refsect1>
    <title>See Also</title>
    <para>
      <link linkend="equals"><citetitle>==</citetitle></link>,
      <link linkend="greaterequal"><citetitle>&gt;=</citetitle></link>,
      <link linkend="greaterthan"><citetitle>&gt;</citetitle></link>,
      <link linkend="lessequal"><citetitle>&lt;=</citetitle></link>,
      <link linkend="notequal"><citetitle>!=</citetitle></link>
    </para>
  </refsect1>

  <refsect1>
    <title>Credits</title>
    <para>Example written by &namekevin;.</para>
  </refsect1>
</refentry>