| 1 |
<refentry id="ftgenonce"> |
| 2 |
<indexterm id="Indexftgenonce"><primary>ftgenonce</primary></indexterm> |
| 3 |
<refentryinfo><title>Signal Flow Graph Opcodes</title></refentryinfo> |
| 4 |
<refmeta> |
| 5 |
<refentrytitle>ftgenonce</refentrytitle> |
| 6 |
</refmeta> |
| 7 |
|
| 8 |
<refnamediv> |
| 9 |
<refname>ftgenonce</refname> |
| 10 |
<refpurpose> |
| 11 |
Generate a function table from within an instrument definition, without duplication of data. |
| 12 |
</refpurpose> |
| 13 |
</refnamediv> |
| 14 |
|
| 15 |
<refsect1> |
| 16 |
<title>Description</title> |
| 17 |
<para>Plugin opcode in signalflowgraph.</para> |
| 18 |
<para> |
| 19 |
Enables the creation of function tables entirely inside |
| 20 |
instrument definitions, without any duplication of data. |
| 21 |
</para> |
| 22 |
|
| 23 |
<para> |
| 24 |
The ftgenonce opcode is designed to simplify writing instrument definitions |
| 25 |
that can be re-used in different orchestras simply by #including them |
| 26 |
and plugging them into some output instrument. There is no need to define |
| 27 |
function tables either in the score, or in the orchestra header. |
| 28 |
</para> |
| 29 |
|
| 30 |
<para> |
| 31 |
The ftgenonce opcode is similar to ftgentmp, and has identical arguments. |
| 32 |
However, function tables are neither duplicated nor deleted. Instead, |
| 33 |
all of the arguments to the opcode are concatenated to form the key to a |
| 34 |
lookup table that points to the function table number. Thus, every request |
| 35 |
to ftgenonce with the same arguments receives the same instance of the |
| 36 |
function table data. Every change in the value of any ftgenonce argument |
| 37 |
causes the creation of a new function table. |
| 38 |
</para> |
| 39 |
</refsect1> |
| 40 |
|
| 41 |
<refsect1> |
| 42 |
<title>Syntax</title> |
| 43 |
<synopsis>ifno <command>ftgenonce</command> ip1, ip2dummy, isize, igen, iarga, iargb, ...</synopsis> |
| 44 |
</refsect1> |
| 45 |
|
| 46 |
<refsect1> |
| 47 |
<title>Initialization</title> |
| 48 |
<para> |
| 49 |
<emphasis>ifno</emphasis> -- an automatically |
| 50 |
assigned table number. |
| 51 |
</para> |
| 52 |
<para> |
| 53 |
<emphasis>ip1</emphasis> -- the number of the table to be |
| 54 |
generated or 0 if the number is to be assigned. |
| 55 |
</para> |
| 56 |
<para> |
| 57 |
|
| 58 |
<emphasis>ip2dummy</emphasis> -- ignored. |
| 59 |
</para> |
| 60 |
<para> |
| 61 |
<emphasis>isize</emphasis> -- table size. Corresponds to p3 of the score <emphasis>f statement</emphasis>. |
| 62 |
</para> |
| 63 |
|
| 64 |
<para> |
| 65 |
<emphasis>igen</emphasis> -- function table <emphasis>GEN</emphasis> routine. Corresponds to p4 of the score <emphasis>f statement</emphasis>. |
| 66 |
</para> |
| 67 |
|
| 68 |
<para> |
| 69 |
<emphasis>iarga, iargb, ...</emphasis> -- function table arguments. Correspond to p5 through p<emphasis>n</emphasis> of the score <emphasis>f statement</emphasis>. |
| 70 |
</para> |
| 71 |
<note> |
| 72 |
<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> |
| 73 |
</note> |
| 74 |
</refsect1> |
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
<refsect1> |
| 81 |
<title>Examples</title> |
| 82 |
<para> |
| 83 |
Here is an example of the ftgenonce opcode. It uses the file <ulink url="examples/ftgenonce.csd"><citetitle>ftgenonce.csd</citetitle></ulink>. |
| 84 |
|
| 85 |
<example> |
| 86 |
<title>Example of the ftgenonce opcode.</title> |
| 87 |
<xi:include href="examples-xml/ftgenonce.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 88 |
</example> |
| 89 |
</para> |
| 90 |
</refsect1> |
| 91 |
|
| 92 |
<refsect1> |
| 93 |
<title>See also</title> |
| 94 |
<para><link linkend="SignalFlowGraphOpcodes"><citetitle>Signal Flow Graph Opcodes</citetitle></link></para> |
| 95 |
</refsect1> |
| 96 |
|
| 97 |
<refsect1> |
| 98 |
<title>Credits</title> |
| 99 |
<para> |
| 100 |
<simplelist> |
| 101 |
<member>Authors: &namemichael;</member> |
| 102 |
<member>2009</member> |
| 103 |
</simplelist> |
| 104 |
</para> |
| 105 |
</refsect1> |
| 106 |
</refentry> |