<!-- Converted to DocBook/SGML by Kevin Conder -->
<refentry id="table">
  <refmeta>
    <refentrytitle>table</refentrytitle>
  </refmeta>
 
  <refnamediv>
    <refname>table</refname>
    <refpurpose>
      Accesses table values by direct indexing.
      <indexterm id="IndexTable"><primary>table</primary></indexterm>
    </refpurpose>
  </refnamediv>
 
  <refsect1>
    <title>Description</title>
    <para>
      Accesses table values by direct indexing.
    </para>
  </refsect1>
 
  <refsect1>
    <title>Syntax</title>
    <synopsis>ar <command>table</command> andx, ifn [, ixmode] [, ixoff] [, iwrap]</synopsis>

    <synopsis>ir <command>table</command> indx, ifn [, ixmode] [, ixoff] [, iwrap]</synopsis>

    <synopsis>kr <command>table</command> kndx, ifn [, ixmode] [, ixoff] [, iwrap]</synopsis>
  </refsect1>
 
  <refsect1>
    <title>Initialization</title>
    <para>
      <emphasis>ifn</emphasis> -- function table number.
    </para>

    <para>
      <emphasis>ixmode</emphasis> (optional) -- index data mode. The default value is 0.
      <itemizedlist>
        <listitem><para>0 = raw index</para></listitem>
        <listitem><para>1 = normalized (0 to 1)</para></listitem>
      </itemizedlist>
    </para>

    <para>
      <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.
    </para>

    <para>
      <emphasis>iwrap</emphasis> (optional) -- wraparound index flag. The default value is 0.
      <itemizedlist>
        <listitem>
          <para>0 = nowrap (index &lt; 0 treated as index=0; index tablesize sticks at index=size)</para>
        </listitem>

        <listitem>
          <para>1 = wraparound.</para>
        </listitem>
      </itemizedlist>
    </para>
  </refsect1>
 
  <refsect1>
    <title>Performance</title>
    <para>
      <emphasis>table</emphasis> invokes table lookup on behalf of init, control or audio indices. These indices can be raw entry numbers (0,l,2...size - 1) or scaled values (0 to 1-e). 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.
    </para>
  </refsect1>

  <refsect1>
    <title>Examples</title>
    <para>
      Here is an example of the table opcode. It uses the files <ulink url="examples/table.orc"><citetitle>table.orc</citetitle></ulink> and <ulink url="examples/table.sco"><citetitle>table.sco</citetitle></ulink>.

      <example>
        <title>Example of the table opcode.</title>

        <programlisting>
<inlinemediaobject>
            <imageobject>
              <imagedata fileref="examples/table.orc" format="linespecific">
            </imageobject>
          </inlinemediaobject>
        </programlisting>

        <programlisting>
<inlinemediaobject>
            <imageobject>
              <imagedata fileref="examples/table.sco" format="linespecific">
            </imageobject>
          </inlinemediaobject>
        </programlisting>
      </example>
    </para>
  </refsect1>

  <refsect1>
    <title>See Also</title>
    <para>
      <link linkend="tablei"><citetitle>tablei</citetitle></link>, 
      <link linkend="table3"><citetitle>table3</citetitle></link>, 
      <link linkend="oscil1"><citetitle>oscil1</citetitle></link>, 
      <link linkend="oscil1i"><citetitle>oscil1i</citetitle></link>, 
      <link linkend="osciln"><citetitle>osciln</citetitle></link>
    </para>
  </refsect1>

  <refsect1>
    <title>Credits</title>
    <para>Example written by &namekevin;.</para>
  </refsect1>
</refentry>
