| 1 | |
| 2 | <refentry id="tablemix"> |
| 3 | <indexterm id="IndexTablemix"><primary>tablemix</primary></indexterm> |
| 4 | <refentryinfo><title>Table Control:Read/Write Operations</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>tablemix</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | |
| 10 | |
| 11 | <refnamediv> |
| 12 | <refname>tablemix</refname> |
| 13 | <refpurpose> |
| 14 | Mixes two tables. |
| 15 | </refpurpose> |
| 16 | </refnamediv> |
| 17 | |
| 18 | <refsect1> |
| 19 | <title>Description</title> |
| 20 | <para> |
| 21 | Mixes two tables. |
| 22 | </para> |
| 23 | </refsect1> |
| 24 | |
| 25 | <refsect1> |
| 26 | <title>Syntax</title> |
| 27 | <synopsis><command>tablemix</command> kdft, kdoff, klen, ks1ft, ks1off, ks1g, ks2ft, ks2off, ks2g</synopsis> |
| 28 | </refsect1> |
| 29 | |
| 30 | <refsect1> |
| 31 | <title>Performance</title> |
| 32 | <para> |
| 33 | <emphasis>kdft</emphasis> -- Destination function table. |
| 34 | </para> |
| 35 | |
| 36 | <para> |
| 37 | <emphasis>kdoff</emphasis> -- Offset to start writing from. Can be negative. |
| 38 | </para> |
| 39 | |
| 40 | <para> |
| 41 | <emphasis>klen</emphasis> -- Number of write operations to perform. Negative means work backwards. |
| 42 | </para> |
| 43 | |
| 44 | <para> |
| 45 | <emphasis>ks1ft</emphasis>, <emphasis>ks2ft</emphasis> -- Source function tables. These can be the same as the destination table, if care is exercised about direction of copying data. |
| 46 | </para> |
| 47 | |
| 48 | <para> |
| 49 | <emphasis>ks1off</emphasis>, <emphasis>ks2off</emphasis> -- Offsets to start reading from in source tables. |
| 50 | </para> |
| 51 | |
| 52 | <para> |
| 53 | <emphasis>ks1g</emphasis>, <emphasis>ks2g</emphasis> -- Gains to apply when reading from the source tables. The results are added and the sum is written to the destination table. |
| 54 | </para> |
| 55 | |
| 56 | <para> |
| 57 | <emphasis>tablemix</emphasis> -- This opcode mixes from two tables, with separate gains into the destination table. Writing is done for <emphasis>klen</emphasis> locations, usually stepping forward through the table - if <emphasis>klen</emphasis> is positive. If it is negative, then the writing and reading order is backwards - towards lower indexes in the tables. This bi-directional option makes it easy to shift the contents of a table sideways by reading from it and writing back to it with a different offset. |
| 58 | </para> |
| 59 | |
| 60 | <para> |
| 61 | If <emphasis>klen</emphasis> is 0, no writing occurs. Note that the internal integer value of <emphasis>klen</emphasis> is derived from the ANSI C floor() function - which returns the next most negative integer. Hence a fractional negative <emphasis>klen</emphasis> value of -2.3 would create an internal length of 3, and cause the copying to start from the offset locations and proceed for two locations to the left. |
| 62 | </para> |
| 63 | |
| 64 | <para> |
| 65 | The total index for table reading and writing is calculated from the starting offset for each table, plus the index value, which starts at 0 and then increments (or decrements) by 1 as mixing proceeds. |
| 66 | </para> |
| 67 | |
| 68 | <para> |
| 69 | These total indexes can potentially be very large, since there is no restriction on the offset or the <emphasis>klen</emphasis>. However each total index for each table is ANDed with a length mask (such as 0000 0111 for a table of length 8) to form a final index which is actually used for reading or writing. So no reading or writing can occur outside the tables. This is the same as <quote>wrap</quote> mode in table read and write. These opcodes do not read or write the guardpoint. If a table has been rewritten with one of these, then if it has a guardpoint which is supposed to contain the same value as the location 0, then call <link linkend="tablegpw"><citetitle>tablegpw</citetitle></link> afterwards. |
| 70 | </para> |
| 71 | |
| 72 | <para> |
| 73 | The indexes and offsets are all in table steps - they are not normalized to 0 - 1. So for a table of length 256, <emphasis>klen</emphasis> should be set to 256 if all the table was to be read or written. |
| 74 | </para> |
| 75 | |
| 76 | <para> |
| 77 | The tables do not need to be the same length - wrapping occurs individually for each table. |
| 78 | </para> |
| 79 | </refsect1> |
| 80 | |
| 81 | <refsect1> |
| 82 | <title>Examples</title> |
| 83 | <para> |
| 84 | Here is an example of the tablemix opcode. It uses the file <ulink url="examples/tablemix.csd"><citetitle>tablemix.csd</citetitle></ulink>. |
| 85 | <example> |
| 86 | <title>Example of the tablemix opcode.</title> |
| 87 | <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> |
| 88 | <xi:include href="examples-xml/tablemix.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 89 | </example> |
| 90 | </para> |
| 91 | </refsect1> |
| 92 | |
| 93 | <refsect1> |
| 94 | <title>See also</title> |
| 95 | <para><link linkend="TableReadwrit"><citetitle>Read/Write Operations</citetitle></link></para> |
| 96 | </refsect1> |
| 97 | |
| 98 | <refsect1> |
| 99 | <title>Credits</title> |
| 100 | <para> |
| 101 | <simplelist> |
| 102 | <member>Author: Robin Whittle</member> |
| 103 | <member>Australia</member> |
| 104 | <member>May 1997</member> |
| 105 | </simplelist> |
| 106 | </para> |
| 107 | <para>New in version 3.47</para> |
| 108 | </refsect1> |
| 109 | </refentry> |