| 1 | |
| 2 | <refentry id="ftgen"> |
| 3 | <indexterm id="IndexFtgen"><primary>ftgen</primary></indexterm> |
| 4 | <refentryinfo><title>Table Control</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>ftgen</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | <refnamediv> |
| 10 | <refname>ftgen</refname> |
| 11 | <refpurpose> |
| 12 | Generate a score function table from within the orchestra. |
| 13 | </refpurpose> |
| 14 | </refnamediv> |
| 15 | |
| 16 | <refsect1> |
| 17 | <title>Description</title> |
| 18 | <para>Generate a score function table from within the orchestra.</para> |
| 19 | </refsect1> |
| 20 | |
| 21 | <refsect1> |
| 22 | <title>Syntax</title> |
| 23 | <synopsis>gir <command>ftgen</command> ifn, itime, isize, igen, iarga [, iargb ] [...]</synopsis> |
| 24 | <synopsis>gir <command>ftgen</command> ifn, itime, isize, igen, iarray</synopsis> |
| 25 | </refsect1> |
| 26 | |
| 27 | <refsect1> |
| 28 | <title>Initialization</title> |
| 29 | <para> |
| 30 | <emphasis>gir</emphasis> -- either a requested or automatically assigned table number above 100. |
| 31 | </para> |
| 32 | |
| 33 | <para> |
| 34 | <emphasis>ifn</emphasis> -- requested table number If <emphasis>ifn</emphasis> is zero, the number is assigned automatically and the value placed in <emphasis>gir</emphasis>. Any other value is used as the table number |
| 35 | </para> |
| 36 | |
| 37 | <para> |
| 38 | <emphasis>itime</emphasis> -- is ignored, but otherwise corresponds to p2 in the score <emphasis>f statement</emphasis>. |
| 39 | </para> |
| 40 | |
| 41 | <para> |
| 42 | <emphasis>isize</emphasis> -- table size. Corresponds to p3 of the score <emphasis>f statement</emphasis>. |
| 43 | </para> |
| 44 | |
| 45 | <para> |
| 46 | <emphasis>igen</emphasis> -- function table <emphasis>GEN</emphasis> routine. Corresponds to p4 of the score <emphasis>f statement</emphasis>. |
| 47 | </para> |
| 48 | |
| 49 | <para> |
| 50 | <emphasis>iarga, iargb, ...</emphasis> -- function table arguments. Correspond to p5 through p<emphasis>n</emphasis> of the score <emphasis>f statement</emphasis>. |
| 51 | </para> |
| 52 | |
| 53 | <para> |
| 54 | <emphasis>iarray</emphasis> -- ane dimensionl array holding the function table arguments. Correspond to p5 through p<emphasis>n</emphasis> of the score <emphasis>f statement</emphasis>. |
| 55 | </para> |
| 56 | </refsect1> |
| 57 | |
| 58 | <refsect1> |
| 59 | <title>Performance</title> |
| 60 | <para> |
| 61 | This is equivalent to table generation in the score with the <emphasis>f statement</emphasis>. |
| 62 | </para> |
| 63 | <note> |
| 64 | <para>Csound was originally designed to support tables with power of two sizes only. Though this has changed in recent versions (you can use any size by using a negative number), many opcodes will not accept them.</para> |
| 65 | </note> |
| 66 | |
| 67 | <warning> |
| 68 | <title>Warning</title> |
| 69 | <para> |
| 70 | Although Csound will not protest if ftgen is used inside instr-endin statements, this is not the intended or supported use, and must be handled with care as it has global effects. (In particular, a different size usually leads to relocation of the table, which may cause a crash or otherwise erratic behaviour. |
| 71 | </para> |
| 72 | </warning> |
| 73 | </refsect1> |
| 74 | |
| 75 | <refsect1> |
| 76 | <title>Examples</title> |
| 77 | <para> |
| 78 | Here is an example of the ftgen opcode. It uses the file <ulink url="examples/ftgen.csd"><citetitle>ftgen.csd</citetitle></ulink>. |
| 79 | |
| 80 | <example> |
| 81 | <title>Example of the ftgen opcode.</title> |
| 82 | <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> |
| 83 | <xi:include href="examples-xml/ftgen.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 84 | </example> |
| 85 | </para> |
| 86 | <para> |
| 87 | Here is another example of the ftgen opcode. It uses the file <ulink url="examples/ftgen-2.csd"><citetitle>ftgen-2.csd</citetitle></ulink>. |
| 88 | <example> |
| 89 | <title>Example of the ftgen opcode.</title> |
| 90 | <para> |
| 91 | This example queries a file for it length to create an f-table of the appropriate size. |
| 92 | </para> |
| 93 | <xi:include href="examples-xml/ftgen-2.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 94 | </example> |
| 95 | </para> |
| 96 | </refsect1> |
| 97 | |
| 98 | <refsect1> |
| 99 | <title>See also</title> |
| 100 | <para> |
| 101 | <link linkend="ScoreGenRef"><citetitle>GEN routine overview</citetitle></link> |
| 102 | </para> |
| 103 | <para><link linkend="OrchHeader"><citetitle>Orchestra Header Statements</citetitle></link></para> |
| 104 | </refsect1> |
| 105 | |
| 106 | <refsect1> |
| 107 | <title>Credits</title> |
| 108 | <para> |
| 109 | <simplelist> |
| 110 | <member>Author: &namebarry;</member> |
| 111 | <member>M.I.T., Cambridge, Mass</member> |
| 112 | <member>1997</member> |
| 113 | </simplelist> |
| 114 | </para> |
| 115 | |
| 116 | <para>Added warning April 2002 by &namerasmus;</para> |
| 117 | </refsect1> |
| 118 | </refentry> |