| 1 | |
| 2 | <refentry id="ptable"> |
| 3 | <indexterm id="IndexPtable"><primary>ptable</primary></indexterm> |
| 4 | <refentryinfo><title>Signal Generators:Table Access</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>ptable</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | <refnamediv> |
| 10 | <refname>ptable</refname> |
| 11 | <refpurpose> |
| 12 | Accesses table values by direct indexing. |
| 13 | </refpurpose> |
| 14 | </refnamediv> |
| 15 | |
| 16 | <refsect1> |
| 17 | <title>Description</title> |
| 18 | <para> |
| 19 | Accesses table values by direct indexing. |
| 20 | </para> |
| 21 | </refsect1> |
| 22 | |
| 23 | <refsect1> |
| 24 | <title>Syntax</title> |
| 25 | <synopsis>ares <command>ptable</command> andx, ifn [, ixmode] [, ixoff] [, iwrap]</synopsis> |
| 26 | |
| 27 | <synopsis>ires <command>ptable</command> indx, ifn [, ixmode] [, ixoff] [, iwrap]</synopsis> |
| 28 | |
| 29 | <synopsis>kres <command>ptable</command> kndx, ifn [, ixmode] [, ixoff] [, iwrap]</synopsis> |
| 30 | </refsect1> |
| 31 | |
| 32 | <refsect1> |
| 33 | <title>Initialization</title> |
| 34 | <para> |
| 35 | <emphasis>ifn</emphasis> -- function table number. |
| 36 | </para> |
| 37 | |
| 38 | <para> |
| 39 | <emphasis>ixmode</emphasis> (optional) -- index data mode. The default value is 0. |
| 40 | <itemizedlist> |
| 41 | <listitem><para>0 = raw index</para></listitem> |
| 42 | <listitem><para>1 = normalized (0 to 1)</para></listitem> |
| 43 | </itemizedlist> |
| 44 | </para> |
| 45 | |
| 46 | <para> |
| 47 | <emphasis>ixoff</emphasis> (optional) -- amount by which index is to be offset. For a table with origin at center, use tablesize/2 (raw) or .5 (normalized). The default value is 0. |
| 48 | </para> |
| 49 | |
| 50 | <para> |
| 51 | <emphasis>iwrap</emphasis> (optional) -- wraparound index flag. The default value is 0. |
| 52 | <itemizedlist> |
| 53 | <listitem> |
| 54 | <para>0 = nowrap (index < 0 treated as index=0; index > tablesize sticks at index=size)</para> |
| 55 | </listitem> |
| 56 | |
| 57 | <listitem> |
| 58 | <para>1 = wraparound.</para> |
| 59 | </listitem> |
| 60 | </itemizedlist> |
| 61 | </para> |
| 62 | </refsect1> |
| 63 | |
| 64 | <refsect1> |
| 65 | <title>Performance</title> |
| 66 | <para> |
| 67 | <emphasis>ptable</emphasis> invokes table lookup on behalf of init, control or audio indices. These indices can be raw entry numbers (0, 1, 2,... size - 1) or scaled values (0 to 1). Indices are first modified by the offset value then checked for range before table lookup (see <emphasis>iwrap</emphasis>). If index is likely to be full scale, or if interpolation is being used, the table should have an extended guard point. <emphasis>table</emphasis> indexed by a periodic phasor ( see <link linkend="phasor"><citetitle>phasor</citetitle></link>) will simulate an oscillator. |
| 68 | </para> |
| 69 | </refsect1> |
| 70 | |
| 71 | <refsect1> |
| 72 | <title>Examples</title> |
| 73 | <para> |
| 74 | Here is an example of the ptable opcode. It uses the file <ulink url="examples/ptable.csd"><citetitle>ptable.csd</citetitle></ulink>. |
| 75 | |
| 76 | <example> |
| 77 | <title>Example of the ptable 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/ptable.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 80 | </example> |
| 81 | </para> |
| 82 | </refsect1> |
| 83 | |
| 84 | <refsect1> |
| 85 | <title>See Also</title> |
| 86 | <para> |
| 87 | <link linkend="table"><citetitle>table</citetitle></link>, |
| 88 | <link linkend="tablei"><citetitle>tablei</citetitle></link>, |
| 89 | <link linkend="table3"><citetitle>table3</citetitle></link>, |
| 90 | <link linkend="ptable3"><citetitle>ptable3</citetitle></link>, |
| 91 | <link linkend="ptablei"><citetitle>ptablei</citetitle></link>, |
| 92 | <link linkend="oscil1"><citetitle>oscil1</citetitle></link>, |
| 93 | <link linkend="oscil1i"><citetitle>oscil1i</citetitle></link>, |
| 94 | <link linkend="osciln"><citetitle>osciln</citetitle></link> |
| 95 | </para> |
| 96 | </refsect1> |
| 97 | |
| 98 | <refsect1> |
| 99 | <title>Credits</title> |
| 100 | <para> |
| 101 | <simplelist> |
| 102 | <member>Author: &namejohn;</member> |
| 103 | <member>Jan 2012</member> |
| 104 | </simplelist> |
| 105 | </para> |
| 106 | <para>New in Csound version 5.16</para> |
| 107 | </refsect1> |
| 108 | </refentry> |