<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>elseif</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="Manuel de référence canonique de Csound" />
    <link rel="up" href="OpcodesTop.html" title="Opcodes et opérateurs de l'orchestre" />
    <link rel="prev" href="else.html" title="else" />
    <link rel="next" href="endif.html" title="endif" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">elseif</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="else.html">Précédent</a> </td>
          <th width="60%" align="center">Opcodes et opérateurs de l'orchestre</th>
          <td width="20%" align="right"> <a accesskey="n" href="endif.html">Suivant</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="elseif"></a>
      <div class="titlepage"></div>
      <a id="IndexElseif" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">elseif</span>
        </h2>
        <p>elseif — 
      Définit une autre condition "if...then" lorsqu'une condition
      "if...then" est fausse.
    </p>
      </div>
      <div class="refsect1">
        <a id="idm47887684391696"></a>
        <h2>Description</h2>
        <p>
      Définit une autre condition "if...then" lorsqu'une condition
      "if...then" est fausse.
    </p>
      </div>
      <div class="refsect1">
        <a id="idm47887684390288"></a>
        <h2>Syntaxe</h2>
        <pre class="synopsis"><span class="command"><strong>elseif</strong></span> xa R xb <span class="command"><strong>then</strong></span></pre>
        <p>
      où <span class="emphasis"><em>R</em></span> est un des opérateurs relationnels
      (<span class="emphasis"><em>&lt;</em></span>, <span class="emphasis"><em>=</em></span>, <span class="emphasis"><em>&lt;=</em></span>,
      <span class="emphasis"><em>==</em></span>, <span class="emphasis"><em>!=</em></span>) (et <span class="emphasis"><em>=</em></span> par
      commodité, voir aussi <a class="link" href="ControlConditional.html" title="Valeurs conditionnelles"><em class="citetitle">Valeurs
      Conditionnelles</em></a>).
    </p>
      </div>
      <div class="refsect1">
        <a id="idm47887684317232"></a>
        <h2>Exécution</h2>
        <p>
      <span class="emphasis"><em>elseif</em></span> est utilisé dans un bloc de code entre les opcodes
      <a class="link" href="if.html" title="if"><em class="citetitle">"if...then"</em></a> et
      <a class="link" href="endif.html" title="endif"><em class="citetitle">endif</em></a>. Lorsqu'une condition
      "if...then" est fausse, cela définit une autre condition
      "if...then" à tester. On peut utiliser n'importe quel nombre
      d'instructions <span class="emphasis"><em>elseif</em></span>.
    </p>
      </div>
      <div class="refsect1">
        <a id="idm47887684312992"></a>
        <h2>Exemples</h2>
        <p>
      Voici un exemple de l'opcode elseif. Il utilise le fichier
      <a class="ulink" href="examples/elseif.csd" target="_top"><em class="citetitle">elseif.csd</em></a>.
            </p>
        <div class="example">
          <a id="idm47887684311120"></a>
          <p class="title">
            <strong>Exemple 232. Exemple de l'opcode elseif.</strong>
          </p>
          <div class="example-contents">
            <p>Voir les sections <a class="link" href="UsingRealTime.html" title="Audio en temps réel"><em class="citetitle">Audio en Temps Réel</em></a>
        et <a class="link" href="CommandFlags.html" title="Ligne de commande de Csound"><em class="citetitle">Options de la Ligne de Commande</em></a> pour plus
        d'information sur l'utilisation des options de la ligne de commande.</p>
            <div class="refsect1">
              <a id="idm47887527218752"></a>
              <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
-odac     <span class="comment">;;;realtime audio out</span>
<span class="comment">;-iadc    ;;;uncomment -iadc if realtime audio input is needed too</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o elseif.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">ksmps</span> <span class="op">=</span> 32
<span class="ohdr">nchnls</span> <span class="op">=</span> 2
<span class="ohdr">0dbfs</span> <span class="op">=</span> 1

<span class="oblock">instr</span> 1

ipch <span class="op">=</span> <span class="opc">cpspch</span>(p4)
ienv <span class="op">=</span> p5


<span class="octrl">if</span> (ienv <span class="op">==</span> 0) then 	
	<span class="comment">;ADSR</span>
	kenv <span class="opc">adsr</span> 0.05, 0.05, .95, .05
<span class="octrl">elseif</span> (ienv <span class="op">==</span> 1) then 
	<span class="comment">;Linear Triangular Envelope</span>
	kenv <span class="opc">linseg</span> 0, p3 <span class="op">*</span> .5, 1, p3 <span class="op">*</span> .5, 0
<span class="octrl">elseif</span> (ienv <span class="op">==</span> 2) then 
	<span class="comment">;Ramp Up</span>
	kenv	<span class="opc">linseg</span> 0, p3 <span class="op">-</span> .01, 1, .01, 0
<span class="octrl">endif</span>

aout	<span class="opc">vco2</span> 	.8, ipch, 10
aout	<span class="opc">moogvcf</span>	aout, ipch <span class="op">+</span> (kenv <span class="op">*</span> 5 <span class="op">*</span> ipch) , .5

aout <span class="op">=</span> aout <span class="op">*</span> kenv

<span class="opc">outs</span> aout, aout
<span class="oblock">endin</span>
<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>

<span class="stamnt">i</span> 1 0 2 8.00 0
<span class="stamnt">i</span> 1 3 2 8.00 1
<span class="stamnt">i</span> 1 6 2 8.00 2
<span class="stamnt">e</span>
<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
            </div>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
      <div class="refsect1">
        <a id="idm47887684306752"></a>
        <h2>Voir aussi</h2>
        <p>
      <a class="link" href="else.html" title="else"><em class="citetitle">else</em></a>,
      <a class="link" href="endif.html" title="endif"><em class="citetitle">endif</em></a>,
      <a class="link" href="goto.html" title="goto"><em class="citetitle">goto</em></a>,
      <a class="link" href="if.html" title="if"><em class="citetitle">if</em></a>,
      <a class="link" href="igoto.html" title="igoto"><em class="citetitle">igoto</em></a>,
      <a class="link" href="kgoto.html" title="kgoto"><em class="citetitle">kgoto</em></a>,
      <a class="link" href="tigoto.html" title="tigoto"><em class="citetitle">tigoto</em></a>,
      <a class="link" href="timout.html" title="timout"><em class="citetitle">timout</em></a>
    </p>
        <p>
      Plus d'information sur cet opcode :
      <a class="ulink" href="http://www.csoundjournal.com/2006spring/controlFlow.html" target="_top"><em class="citetitle">http://www.csoundjournal.com/2006spring/controlFlow.html</em></a>,
      écrit par Steven Yi.
    </p>
      </div>
      <div class="refsect1">
        <a id="idm47887684296608"></a>
        <h2>Crédits</h2>
        <p>Nouveau dans la version 4.21</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="else.html">Précédent</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Niveau supérieur</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="endif.html">Suivant</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">else </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Sommaire</a>
          </td>
          <td width="40%" align="right" valign="top"> endif</td>
        </tr>
      </table>
    </div>
  </body>
</html>
