| 1 | |
| 2 | <refentry id="tablekt"> |
| 3 | <indexterm id="IndexTablekt"><primary>tablekt</primary></indexterm> |
| 4 | <refentryinfo><title>Table Control:Dynamic Selection</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>tablekt</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | <refnamediv> |
| 10 | <refname>tablekt</refname> |
| 11 | <refpurpose> |
| 12 | Provides k-rate control over table numbers. |
| 13 | </refpurpose> |
| 14 | </refnamediv> |
| 15 | |
| 16 | <refsect1> |
| 17 | <title>Description</title> |
| 18 | <para> |
| 19 | k-rate control over table numbers. |
| 20 | </para> |
| 21 | |
| 22 | <para> |
| 23 | The standard Csound opcode <link linkend="table"><citetitle>table</citetitle></link> when producing a k- or a-rate result, can only use an init-time variable to select the table number. <emphasis>tablekt</emphasis> accepts k-rate control as well as i-time. In all other respects they are similar to the original opcodes. |
| 24 | </para> |
| 25 | </refsect1> |
| 26 | |
| 27 | <refsect1> |
| 28 | <title>Syntax</title> |
| 29 | <synopsis>ares <command>tablekt</command> xndx, kfn [, ixmode] [, ixoff] [, iwrap]</synopsis> |
| 30 | |
| 31 | <synopsis>kres <command>tablekt</command> kndx, kfn [, ixmode] [, ixoff] [, iwrap]</synopsis> |
| 32 | </refsect1> |
| 33 | |
| 34 | <refsect1> |
| 35 | <title>Initialization</title> |
| 36 | <para> |
| 37 | <emphasis>ixmode</emphasis> -- if 0, <emphasis>xndx</emphasis> and <emphasis>ixoff</emphasis> ranges match the length of the table. if non-zero <emphasis>xndx</emphasis> and <emphasis>ixoff</emphasis> have a 0 to 1 range. Default is 0 |
| 38 | </para> |
| 39 | |
| 40 | <para> |
| 41 | <emphasis>ixoff</emphasis> -- if 0, total index is controlled directly by <emphasis>xndx,</emphasis> ie. the indexing starts from the start of the table. If non-zero, start indexing from somewhere else in the table. Value must be positive and less than the table length (<emphasis>ixmode</emphasis> = 0) or less than 1 (<emphasis>ixmode</emphasis> not equal to 0). Default is 0. |
| 42 | </para> |
| 43 | |
| 44 | <para> |
| 45 | <emphasis>iwrap</emphasis> -- if <emphasis>iwrap</emphasis> = 0, <emphasis>Limit mode</emphasis>: when total index is below 0, then final index is 0.Total index above table length results in a final index of the table length - high out of range total indexes stick at the upper limit of the table. If <emphasis>iwrap</emphasis> not equal to 0, <emphasis>Wrap mode</emphasis>: total index is wrapped modulo the table length so that all total indexes map into the table. For instance, in a table of length 8, <emphasis>xndx</emphasis> = 5 and <emphasis>ixoff</emphasis> = 6 gives a total index of 11, which wraps to a final index of 3. Default is 0. |
| 46 | </para> |
| 47 | </refsect1> |
| 48 | |
| 49 | <refsect1> |
| 50 | <title>Performance</title> |
| 51 | <para> |
| 52 | <emphasis>kndx</emphasis> -- Index into table, either a positive number range matching the table length (<emphasis>ixmode</emphasis> = 0) or a 0 to 1 range (<emphasis>ixmode</emphasis> not equal to 0). |
| 53 | </para> |
| 54 | |
| 55 | <para> |
| 56 | <emphasis>xndx</emphasis> -- matching the table length (<emphasis>ixmode</emphasis> = 0) or a 0 to 1 range (<emphasis>ixmode</emphasis> not equal to 0) |
| 57 | </para> |
| 58 | |
| 59 | <para> |
| 60 | <emphasis>kfn</emphasis> -- Table number. Must be >= 1. Floats are rounded down to an integer. If a table number does not point to a valid table, or the table has not yet been loaded (<link linkend="GEN01"><citetitle>GEN01</citetitle></link>) then an error will result and the instrument will be de-activated. |
| 61 | </para> |
| 62 | |
| 63 | <caution> |
| 64 | <title>Caution with k-rate table numbers</title> |
| 65 | <para> |
| 66 | At k-rate, if a table number of < 1 is given, or the table number points to a non-existent table, or to one which has a length of 0 (it is to be loaded from a file later) then an error will result and the instrument will be deactivated. <emphasis>kfn</emphasis> must be initialized at the appropriate rate using <link linkend="init"><citetitle>init</citetitle></link>. Attempting to load an i-rate value into <emphasis>kfn</emphasis> will result in an error. |
| 67 | </para> |
| 68 | </caution> |
| 69 | </refsect1> |
| 70 | |
| 71 | <refsect1> |
| 72 | <title>Examples</title> |
| 73 | <para> |
| 74 | Here is an example of the tablekt opcode. It uses the file <ulink url="examples/tablekt.csd"><citetitle>tablekt.csd</citetitle></ulink>. |
| 75 | |
| 76 | <example> |
| 77 | <title>Example of the tablekt opcode.</title> |
| 78 | <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> |
| 79 | <xi:include href="examples-xml/tablekt.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 80 | </example> |
| 81 | Its output should include lines like these: |
| 82 | <screen> |
| 83 | i1 2.00000 |
| 84 | i1 1.00000 |
| 85 | i1 2.00000 |
| 86 | i1 1.00000 |
| 87 | .... |
| 88 | </screen> |
| 89 | </para> |
| 90 | </refsect1> |
| 91 | |
| 92 | <refsect1> |
| 93 | <title>See also</title> |
| 94 | <para><link linkend="TableSelect"><citetitle>Table Reading with Dynamic Selection</citetitle></link></para> |
| 95 | </refsect1> |
| 96 | |
| 97 | <refsect1> |
| 98 | <title>Credits</title> |
| 99 | <para> |
| 100 | <simplelist> |
| 101 | <member>Author: Robin Whittle</member> |
| 102 | <member>Australia</member> |
| 103 | <member>May 1997</member> |
| 104 | </simplelist> |
| 105 | </para> |
| 106 | <para>New in version 3.47</para> |
| 107 | </refsect1> |
| 108 | </refentry> |