| 1 |
|
| 2 |
<refentry id="loop_lt"> |
| 3 |
<indexterm id="IndexLoop"><primary>loop_lt</primary></indexterm> |
| 4 |
<refentryinfo><title>Instrument Control:Program Flow Control</title></refentryinfo> |
| 5 |
<refmeta> |
| 6 |
<refentrytitle>loop_lt</refentrytitle> |
| 7 |
</refmeta> |
| 8 |
|
| 9 |
|
| 10 |
<refnamediv> |
| 11 |
<refname>loop_lt</refname> |
| 12 |
<refpurpose> |
| 13 |
Looping constructions. |
| 14 |
</refpurpose> |
| 15 |
</refnamediv> |
| 16 |
|
| 17 |
<refsect1> |
| 18 |
<title>Description</title> |
| 19 |
<para> |
| 20 |
Construction of looping operations. |
| 21 |
</para> |
| 22 |
</refsect1> |
| 23 |
|
| 24 |
<refsect1> |
| 25 |
<title>Syntax</title> |
| 26 |
<synopsis><command>loop_lt</command> indx, incr, imax, label</synopsis> |
| 27 |
<synopsis><command>loop_lt</command> kndx, kncr, kmax, label</synopsis> |
| 28 |
</refsect1> |
| 29 |
|
| 30 |
<refsect1> |
| 31 |
<title>Initialization</title> |
| 32 |
<para> |
| 33 |
<emphasis>indx</emphasis> -- i-rate variable to count loop. |
| 34 |
</para> |
| 35 |
|
| 36 |
<para> |
| 37 |
<emphasis>incr</emphasis> -- value to increment the loop. |
| 38 |
</para> |
| 39 |
|
| 40 |
<para> |
| 41 |
<emphasis>imax</emphasis> -- maximum value of loop index. |
| 42 |
</para> |
| 43 |
|
| 44 |
</refsect1> |
| 45 |
|
| 46 |
<refsect1> |
| 47 |
<title>Performance</title> |
| 48 |
<para> |
| 49 |
<emphasis>kndx</emphasis> -- k-rate variable to count loop. |
| 50 |
</para> |
| 51 |
<para> |
| 52 |
<emphasis>kncr</emphasis> -- value to increment the loop. |
| 53 |
</para> |
| 54 |
<para> |
| 55 |
<emphasis>kmax</emphasis> -- maximum value of loop index. |
| 56 |
</para> |
| 57 |
<para> |
| 58 |
The actions of <command>loop_lt</command> are equivalent to the |
| 59 |
code |
| 60 |
<programlisting> |
| 61 |
indx <emphasis role="op">=</emphasis> indx <emphasis role="op">+</emphasis> incr |
| 62 |
<emphasis role="opc">if</emphasis> (indx <emphasis role="op"><</emphasis> imax) <emphasis role="opc">igoto</emphasis> label</programlisting> |
| 63 |
|
| 64 |
or |
| 65 |
<programlisting> |
| 66 |
kndx <emphasis role="op">=</emphasis> kndx <emphasis role="op">+</emphasis> kncr |
| 67 |
<emphasis role="opc">if</emphasis> (kndx <emphasis role="op"><</emphasis> kmax) <emphasis role="opc">kgoto</emphasis> label</programlisting> |
| 68 |
</para> |
| 69 |
<para> <note> Adviced is to use the 'modern' while or until opcodes for looping constructions.</note> |
| 70 |
</para> |
| 71 |
</refsect1> |
| 72 |
|
| 73 |
<refsect1> |
| 74 |
<title>Examples</title> |
| 75 |
<para> |
| 76 |
Here is an example of the loop_lt opcode. It uses the file <ulink url="examples/loop_lt.csd"><citetitle>loop_lt.csd</citetitle></ulink>. |
| 77 |
<example> |
| 78 |
<title>Example of the loop_lt opcode.</title> |
| 79 |
<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> |
| 80 |
<xi:include href="examples-xml/loop_lt.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 81 |
</example> |
| 82 |
Its output should include a line like this: |
| 83 |
<screen> |
| 84 |
play instance 0 |
| 85 |
play instance 1 |
| 86 |
play instance 2 |
| 87 |
play instance 3 |
| 88 |
play instance 4 |
| 89 |
</screen> |
| 90 |
</para> |
| 91 |
</refsect1> |
| 92 |
|
| 93 |
<refsect1> |
| 94 |
<title>See also</title> |
| 95 |
<para><link linkend="ControlPgmctl"><citetitle>Program Flow Control: Looping Constructions</citetitle></link></para> |
| 96 |
<para> More information on this opcode: <ulink url="http://www.csoundjournal.com/2006summer/controlFlow_part2.html"><citetitle>http://www.csoundjournal.com/2006summer/controlFlow_part2.html</citetitle></ulink> written by Steven Yi, |
| 97 |
and in the Floss Manuals: <ulink url="https://flossmanual.csound.com/csound-language/control-structures"><citetitle> https://flossmanual.csound.com/csound-language/control-structures</citetitle></ulink></para> |
| 98 |
</refsect1> |
| 99 |
|
| 100 |
<refsect1> |
| 101 |
<title>Credits</title> |
| 102 |
<para>&nameistvan;.</para> |
| 103 |
<para>New in Csound version 5.01</para> |
| 104 |
</refsect1> |
| 105 |
</refentry> |