| 1 | |
| 2 | <refentry id="greaterthan"> |
| 3 | <indexterm id="IndexGtColon"><primary>:</primary></indexterm> |
| 4 | |
| 5 | <indexterm id="IndexGtQuestion"><primary>?</primary></indexterm> |
| 6 | |
| 7 | <indexterm id="IndexGtExpression"><primary>conditional expressions</primary></indexterm> |
| 8 | |
| 9 | <indexterm id="IndexGt"><primary>></primary></indexterm> |
| 10 | <refentryinfo><title>Instrument Control:Conditional Values</title></refentryinfo> |
| 11 | <refmeta> |
| 12 | <refentrytitle>></refentrytitle> |
| 13 | </refmeta> |
| 14 | |
| 15 | |
| 16 | |
| 17 | <refnamediv> |
| 18 | <refname>></refname> |
| 19 | |
| 20 | <refpurpose> |
| 21 | Determines if one value is greater than another. |
| 22 | </refpurpose> |
| 23 | </refnamediv> |
| 24 | |
| 25 | <refsect1> |
| 26 | <title>Description</title> |
| 27 | <para> |
| 28 | Determines if one value is greater than another. |
| 29 | </para> |
| 30 | </refsect1> |
| 31 | |
| 32 | <refsect1> |
| 33 | <title>Syntax</title> |
| 34 | <synopsis>(a <command>></command> b <command>?</command> v1 <command>:</command> v2)</synopsis> |
| 35 | |
| 36 | <para> |
| 37 | 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. |
| 38 | </para> |
| 39 | </refsect1> |
| 40 | |
| 41 | <refsect1> |
| 42 | <title>Performance</title> |
| 43 | <para> |
| 44 | In the above conditional, <emphasis>a</emphasis> and <emphasis>b</emphasis> are first compared. If the indicated relation is true (<emphasis>a</emphasis> greater 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>. |
| 45 | </para> |
| 46 | |
| 47 | <para> |
| 48 | NB.: If <emphasis>v1</emphasis> or <emphasis>v2</emphasis> are expressions, these will be evaluated before the conditional is determined. |
| 49 | </para> |
| 50 | |
| 51 | <para> |
| 52 | In terms of binding strength, all conditional operators (i.e. the relational operators (<emphasis><</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>&&</emphasis> and <emphasis>||</emphasis>). |
| 53 | </para> |
| 54 | |
| 55 | <para> |
| 56 | These are <emphasis>operators</emphasis> not <emphasis>opcodes</emphasis>. Therefore, they can be used within orchestra statements, but do not form complete statements themselves. |
| 57 | </para> |
| 58 | </refsect1> |
| 59 | |
| 60 | <refsect1> |
| 61 | <title>Examples</title> |
| 62 | <para> |
| 63 | Here is an example of the > operator. It uses the file <ulink url="examples/greaterthan.csd"><citetitle>greaterthan.csd</citetitle></ulink>. |
| 64 | |
| 65 | <example> |
| 66 | <title>Example of the > operator.</title> |
| 67 | |
| 68 | |
| 69 | |
| 70 | <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> |
| 71 | <xi:include href="examples-xml/greaterthan.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 72 | </example> |
| 73 | |
| 74 | Its output should include lines like this: |
| 75 | <screen> |
| 76 | k1 = 2.000000, k2 = 0.000000 |
| 77 | k1 = 3.000000, k2 = 0.000000 |
| 78 | k1 = 4.000000, k2 = 1.000000</screen> |
| 79 | </para> |
| 80 | </refsect1> |
| 81 | |
| 82 | <refsect1> |
| 83 | <title>See also</title> |
| 84 | <para><link linkend="ControlConditional"><citetitle>Conditional Values</citetitle></link></para> |
| 85 | </refsect1> |
| 86 | |
| 87 | <refsect1> |
| 88 | <title>Credits</title> |
| 89 | <para>Example written by &namekevin;.</para> |
| 90 | </refsect1> |
| 91 | </refentry> |