<!-- Converted to DocBook/SGML by Kevin Conder -->
<refentry id="schedule">
  <refmeta>
    <refentrytitle>schedule</refentrytitle>
  </refmeta>

  <refnamediv>
    <refname>schedule</refname>

    <refpurpose>
      Adds a new score event.
      <indexterm id="IndexSchedule"><primary>schedule</primary></indexterm>
    </refpurpose>
  </refnamediv>
  
  <refsect1>
    <title>Description</title>
    <para>
      Adds a new score event.
    </para>
  </refsect1>

  <refsect1>
    <title>Syntax</title>
    <synopsis><command>schedule</command> insnum, iwhen, idur [, ip4] [, ip5] [...]</synopsis>
    <synopsis><command>schedule</command> &quot;insname&quot;, iwhen, idur [, ip4] [, ip5] [...]</synopsis>
  </refsect1>

  <refsect1>
    <title>Initialization</title>
    <para>
      <emphasis>insnum</emphasis> -- instrument number. Equivalent to p1 in a score <link linkend="i"><citetitle>i statement</citetitle></link>. <emphasis>insnum</emphasis> must be a number greater than the number of the calling instrument.
    </para>

    <para>
      <emphasis><quote>insname</quote></emphasis> -- A string (in double-quotes) representing a named instrument.
    </para>

    <para>
      <emphasis>iwhen</emphasis> -- start time of the new event. Equivalent to p2 in a score <link linkend="i"><citetitle>i statement</citetitle></link>. <emphasis>iwhen</emphasis> must be nonnegative. If <emphasis>iwhen</emphasis> is zero, <emphasis>insum</emphasis> must be greater than or equal to the p1 of the current instrument.
    </para>

    <para>
      <emphasis>idur</emphasis> -- duration of event. Equivalent to p3 in a score <link linkend="i"><citetitle>i statement</citetitle></link>.
    </para>

    <para>
      <emphasis>ip4, ip5, ...</emphasis> -- Equivalent to p4, p5, etc., in a score <link linkend="i"><citetitle>i statement</citetitle></link>.
    </para>
  </refsect1>

  <refsect1>
    <title>Performance</title>
    <para>
      <emphasis>ktrigger</emphasis> -- trigger value for new event
    </para>

    <para>
      <emphasis>schedule</emphasis> adds a new score event. The arguments, including options, are the same as in a score. The <emphasis>iwhen</emphasis> time (p2) is measured from the time of this event.
    </para>

    <para>
      If the duration is zero or negative the new event is of MIDI type, and inherits the release sub-event from the scheduling instruction.
    </para>
  </refsect1>


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

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

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

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

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

  <refsect1>
    <title>Credits</title>
    <para>
      <simplelist>
        <member>Author: &namejohn;</member>
        <member>University of Bath/Codemist Ltd.</member>
        <member>Bath, UK</member>
        <member>November 1998</member>
      </simplelist>
    </para>
    <para>Example written by &namekevin;.</para>

    <para>New in Csound version 3.491</para>
    <para>Based on work by &namegabriel;</para>
    <para>Thanks goes to David Gladstein, for clarifying the <emphasis>iwhen</emphasis> parameter.</para>
  </refsect1>
</refentry>
