<!-- Converted to DocBook/SGML by Kevin Conder -->
<refentry id="GEN02">
  <refmeta>
    <refentrytitle>GEN02</refentrytitle>
  </refmeta>
 
  <refnamediv>
    <refname>GEN02</refname>
    <refpurpose>
      Transfers data from immediate pfields into a function table.
      <indexterm id="IndexGEN02"><primary>GEN02</primary></indexterm>
    </refpurpose>
  </refnamediv>
 
  <refsect1>
    <title>Description</title>
    <para>
      This subroutine transfers data from immediate pfields into a function table.
    </para>
  </refsect1>
 
  <refsect1>
    <title>Syntax</title>
    <synopsis><command>f</command> # time size 2 v1 v2 v3 ...</synopsis>
  </refsect1>
 
  <refsect1>
    <title>Initialization</title>
    <para>
      <emphasis>size</emphasis> -- number of points in the table. Must be a power of 2 or a power-of-2 plus 1 (see <link linkend="f"><citetitle>f statement</citetitle></link>). The maximum tablesize is 16777216 (2<superscript>24</superscript>) points.
    </para>

    <para>
      <emphasis>v1, v2, v3,</emphasis> etc. -- values to be copied directly into the table space. The number of values is limited by the compile-time variable <emphasis>PMAX</emphasis>, which controls the maximum pfields (currently 1000). The values copied may include the table guard point; any table locations not filled will contain zeros.
    </para>

    <note>
      <title>Note</title>
      <para>
        If p4 is positive, the table will be post-normalized (rescaled to a maximum absolute value of 1 after generation). A negative p4 will cause rescaling to be skipped.
      </para>
    </note>
  </refsect1>
 
  <refsect1>
    <title>Examples</title>
    <para>
      Here is a simple example of the GEN02 routine. It uses the files <ulink url="examples/gen02.orc"><citetitle>gen02.orc</citetitle></ulink> and <ulink url="examples/gen02.sco"><citetitle>gen02.sco</citetitle></ulink>. It places 12 values plus an explicit wrap-around guard value into a table of size next-highest power of 2. Rescaling is inhibited. Here is its diagram:

      <mediaobject>
        <imageobject>
          <imagedata fileref="images/gen02.png" format="PNG">
        </imageobject>

        <textobject>
          <phrase>Diagram of the waveform generated by GEN02.</phrase>
        </textobject>

        <caption>
          <para>Diagram of the waveform generated by GEN02.</para>
        </caption>
      </mediaobject>

      <example>
        <title>A simple example of the GEN02 routine.</title>

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

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

  <refsect1>
     <title>See Also</title>
     <para>
       <link linkend="GEN17"><citetitle>GEN17</citetitle></link>
     </para>
  </refsect1>

  <refsect1>
    <title>Credits</title>
    <para>December 2002. Thanks to &namerasmus;, corrected the limit of the <emphasis>PMAX</emphasis> variable.</para>
  </refsect1>
</refentry>
