Sophie

Sophie

distrib > Mageia > 5 > x86_64 > media > core-release > by-pkgid > b707d9a4ee443103660a75ccb6e51334 > files > 54

csound-doc-5.19.01-10.mga5.noarch.rpm

<?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>FLbutton</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.76.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="FLbutBank.html" title="FLbutBank" />
    <link rel="next" href="FLcloseButton.html" title="FLcloseButton" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">FLbutton</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="FLbutBank.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="FLcloseButton.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry" title="FLbutton">
      <a id="FLbutton"></a>
      <div class="titlepage"></div>
      <a id="IndexFlbutton" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">FLbutton</span>
        </h2>
        <p>FLbutton — 
      A FLTK widget opcode that creates a button.
          </p>
      </div>
      <div class="refsect1" title="Description">
        <a id="idp20564272"></a>
        <h2>Description</h2>
        <p>
      A FLTK widget opcode that creates a button.
    </p>
      </div>
      <div class="refsect1" title="Syntax">
        <a id="idp20565000"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">kout, ihandle <span class="command"><strong>FLbutton</strong></span> "label", ion, ioff, itype, iwidth, iheight, ix, \
      iy, iopcode [, kp1] [, kp2] [, kp3] [, kp4] [, kp5] [....] [, kpN]</pre>
      </div>
      <div class="refsect1" title="Initialization">
        <a id="idp20566232"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>ihandle</em></span> -- a handle value (an integer number) that unequivocally references a corresponding widget. This is used by other opcodes that modify a widget's properties (see <a class="link" href="ControlFltkAppearance.html" title="Modifying FLTK Widget Appearance"><em class="citetitle">Modifying FLTK Widget Appearance</em></a>). It is automatically output by <span class="emphasis"><em>FLbutton</em></span> and must not be set by the user label. (The user label is a double-quoted string containing some user-provided text placed near the widget.)
    </p>
        <p>
      <span class="emphasis"><em><span class="quote">“<span class="quote">label</span>”</span></em></span> -- a double-quoted string containing some user-provided text, placed near the corresponding widget.
    </p>
        <p>
      Notice that with <span class="emphasis"><em>FLbutton</em></span>, it is not necessary to call the <a class="link" href="FLsetTextType.html" title="FLsetTextType"><em class="citetitle">FLsetTextType</em></a> opcode at all in order to use a symbol. In this case, it is sufficient to set a label starting with <span class="quote">“<span class="quote">@</span>”</span> followed by the proper formatting string.
    </p>
        <p>
      The following symbols are supported:

      </p>
        <div class="mediaobject">
          <img src="images/symbols.png" alt="FLTK label supported symbols." />
          <div class="caption">
            <p>FLTK label supported symbols.</p>
          </div>
        </div>
        <p>
    </p>
        <p>
      The @ sign may be followed by the following optional <span class="quote">“<span class="quote">formatting</span>”</span> characters, in this order:

      </p>
        <div class="orderedlist">
          <ol class="orderedlist" type="1">
            <li class="listitem">
              <p><span class="quote">“<span class="quote">#</span>”</span> forces square scaling rather than distortion to the widget's shape.</p>
            </li>
            <li class="listitem">
              <p>+[1-9] or -[1-9] tweaks the scaling a little bigger or smaller.</p>
            </li>
            <li class="listitem">
              <p>[1-9] rotates by a multiple of 45 degrees. <span class="quote">“<span class="quote">6</span>”</span> does nothing, the others point in the direction of that key on a numeric keypad.</p>
            </li>
          </ol>
        </div>
        <p>
    </p>
        <p>
      <span class="emphasis"><em>ion</em></span> -- value output when the button is checked.
    </p>
        <p>
      <span class="emphasis"><em>ioff</em></span> -- value output when the button is unchecked.
    </p>
        <p>
      <span class="emphasis"><em>itype</em></span> -- an integer number denoting the appearance of the widget.
    </p>
        <p>
      Several kind of buttons are possible, according to the value of <span class="emphasis"><em>itype</em></span> argument:

      </p>
        <div class="itemizedlist">
          <ul class="itemizedlist" type="disc">
            <li class="listitem">
              <p>1 - normal button</p>
            </li>
            <li class="listitem">
              <p>2 - light button</p>
            </li>
            <li class="listitem">
              <p>3 - check button</p>
            </li>
            <li class="listitem">
              <p>4 - round button</p>
            </li>
          </ul>
        </div>
        <p>
      You can add 20 to the value to create a "plastic" type button. (Note that there is no Platic Round button. i.e. if you set type to 24 it will look exactly like type 23).
    </p>
        <p>
      This is the appearance of the buttons:

      </p>
        <div class="mediaobject">
          <img src="images/flbutton.png" alt="FLbutton." />
          <div class="caption">
            <p>FLbutton.</p>
          </div>
        </div>
        <p>
    </p>
        <p>
      <span class="emphasis"><em>iwidth</em></span> -- width of widget.
    </p>
        <p>
      <span class="emphasis"><em>iheight</em></span> -- height of widget.
    </p>
        <p>
      <span class="emphasis"><em>ix</em></span> -- horizontal position of upper left corner of the valuator, relative to the upper left corner of corresponding window (expressed in pixels).
    </p>
        <p>
      <span class="emphasis"><em>iy</em></span> -- vertical position of upper left corner of the valuator, relative to the upper left corner of corresponding window (expressed in pixels).
    </p>
        <p>
      <span class="emphasis"><em>iopcode</em></span> -- score opcode type. You have to provide the ascii code of the letter corresponding to the score opcode. At present time only <span class="quote">“<span class="quote">i</span>”</span> (ascii code 105) score statements are supported. A zero value refers to a default value of <span class="quote">“<span class="quote">i</span>”</span>. So both 0 and 105 activates the <a class="link" href="i.html" title="i Statement (Instrument or Note Statement)"><em class="citetitle">i</em></a> opcode. A value of -1 disables this opcode feature.
    </p>
      </div>
      <div class="refsect1" title="Performance">
        <a id="idp20584480"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>kout</em></span> -- output value
    </p>
        <p>
      <span class="emphasis"><em>kp1</em></span>, <span class="emphasis"><em>kp2</em></span>, ..., <span class="emphasis"><em>kpN</em></span> -- arguments of the activated instruments.
    </p>
        <p>
      Buttons of type 2, 3, and 4 also output (<span class="emphasis"><em>kout</em></span> argument) the value contained in the <span class="emphasis"><em>ion</em></span> argument when checked, and that contained in <span class="emphasis"><em>ioff</em></span> argument when unchecked.
    </p>
        <p>
      By adding 10 to <span class="emphasis"><em>itype</em></span> argument (i.e. by setting 11 for type 1, 12 for type 2, 13 for type 3 and 14 for type 4) it is possible to skip the button value when getting/setting snapshots (see later section). <span class="emphasis"><em>FLbutton</em></span> not only outputs a value, but can also activate (or schedule) an instrument provided by the user each time a button is pressed. You can also add 10 to "plastic" button types (31 for type 1, 32 for type 2, etc.)
    </p>
        <p>
      If the <span class="emphasis"><em>iopcode</em></span> argument is set to a negative number, no instrument is activated. So this feature is optional. In order to activate an instrument, <span class="emphasis"><em>iopcode</em></span> must be set to 0 or to 105 (the ascii code of character <span class="quote">“<span class="quote">i</span>”</span>, referring to the <a class="link" href="i.html" title="i Statement (Instrument or Note Statement)"><em class="citetitle">i</em></a> score opcode).
    </p>
        <p>
      P-fields of the activated instrument are <span class="emphasis"><em>kp1</em></span> (instrument number), <span class="emphasis"><em>kp2</em></span> (action time), <span class="emphasis"><em>kp3</em></span> (duration) and so on with user p-fields. Notice that in dual state buttons (light button, check button and round button), the instrument is activated only when button state changes from unchecked to checked (not when passing from checked to unchecked).
    </p>
      </div>
      <div class="refsect1" title="Examples">
        <a id="idp20591560"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the FLbutton opcode. It uses the file <a class="ulink" href="examples/FLbutton.csd" target="_top"><em class="citetitle">FLbutton.csd</em></a>, and <a class="ulink" href="examples/beats.wav" target="_top"><em class="citetitle">beats.wav</em></a>.
      </p>
        <div class="example">
          <a id="idp20592984"></a>
          <p class="title">
            <strong>Example 238. Example of the FLbutton opcode.</strong>
          </p>
          <div class="example-contents">
            <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p>
            <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>
<span class="comment">; Audio out   Audio in    No messages</span>
-odac           -iadc     -d     <span class="comment">;;;RT audio I/O</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o FLbutton.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="comment">; Using FLbuttons to create on screen controls for play, </span>
<span class="comment">; stop, fast forward and fast rewind of a sound file</span>
<span class="comment">; This example also makes use of a preset graphic for buttons.</span>

<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">kr</span> <span class="op">=</span> 44100
<span class="ohdr">ksmps</span> <span class="op">=</span> 1
<span class="ohdr">nchnls</span> <span class="op">=</span> 2

<span class="opc">FLpanel</span> "Buttons", 240, 400, 100, 100
    ion <span class="op">=</span> 0
    ioff <span class="op">=</span> 0
    itype <span class="op">=</span> 1
    iwidth <span class="op">=</span> 50
    iheight <span class="op">=</span> 50
    ix <span class="op">=</span> 10
    iy <span class="op">=</span> 10
    iopcode <span class="op">=</span> 0
    istarttim <span class="op">=</span> 0
    idur <span class="op">=</span> <span class="op">-</span>1  <span class="comment">;Turn instruments on idefinitely</span>

    <span class="comment">; Normal speed forwards</span>
    gkplay, ihb1 <span class="opc">FLbutton</span> "@<span class="op">&gt;</span>", ion, ioff, itype, iwidth, iheight, ix, iy, iopcode, 1, istarttim, idur, 1 
    <span class="comment">; Stationary </span>
    gkstop, ihb2 <span class="opc">FLbutton</span> "@square", ion,ioff, itype, iwidth, iheight, ix<span class="op">+</span>55, iy, iopcode, 2, istarttim, idur
    <span class="comment">; Double speed backwards</span>
    gkrew, ihb3 <span class="opc">FLbutton</span> "@<span class="op">&lt;</span><span class="op">&lt;</span>", ion, ioff, itype, iwidth, iheight, ix <span class="op">+</span> 110, iy, iopcode, 1, istarttim, idur, <span class="op">-</span>2
    <span class="comment">; Double speed forward</span>
    gkff, ihb4 <span class="opc">FLbutton</span> "@<span class="op">&gt;</span><span class="op">&gt;</span>", ion, ioff, itype, iwidth, iheight, ix<span class="op">+</span>165, iy, iopcode, 1, istarttim, idur, 2
    <span class="comment">; Type 1</span>
    gkt1, iht1 <span class="opc">FLbutton</span> "1<span class="op">-</span>Normal Button", ion, ioff, 1, 200, 40, ix, iy <span class="op">+</span> 65, <span class="op">-</span>1 
    <span class="comment">; Type 2</span>
    gkt2, iht2 <span class="opc">FLbutton</span> "2<span class="op">-</span>Light Button", ion, ioff, 2, 200, 40, ix, iy <span class="op">+</span> 110, <span class="op">-</span>1 
    <span class="comment">; Type 3</span>
    gkt3, iht3 <span class="opc">FLbutton</span> "3<span class="op">-</span>Check Button", ion, ioff, 3, 200, 40, ix, iy <span class="op">+</span> 155, <span class="op">-</span>1 
    <span class="comment">; Type 4</span>
    gkt4, iht4 <span class="opc">FLbutton</span> "4<span class="op">-</span>Round Button", ion, ioff, 4, 200, 40, ix, iy <span class="op">+</span> 200, <span class="op">-</span>1 
    <span class="comment">; Type 21</span>
    gkt5, iht5 <span class="opc">FLbutton</span> "21<span class="op">-</span>Plastic Button", ion, ioff, 21, 200, 40, ix, iy <span class="op">+</span> 245, <span class="op">-</span>1 
    <span class="comment">; Type 22</span>
    gkt6, iht6 <span class="opc">FLbutton</span> "22<span class="op">-</span>Plastic Light Button", ion, ioff, 22, 200, 40, ix, iy <span class="op">+</span> 290, <span class="op">-</span>1
    <span class="comment">; Type 23</span>
    gkt7, iht7 <span class="opc">FLbutton</span> "23<span class="op">-</span>Plastic Check Button", ion, ioff, 23, 200, 40, ix, iy <span class="op">+</span> 335, <span class="op">-</span>1 
<span class="opc">FLpanelEnd</span>
<span class="opc">FLrun</span>

<span class="comment">; Ensure that only 1 instance of instr 1</span>
<span class="comment">; plays even if the play button is clicked repeatedly</span>
insnum <span class="op">=</span> 1
icount <span class="op">=</span> 1
<span class="opc">maxalloc</span> insnum, icount

<span class="oblock">instr</span> 1
    asig <span class="opc">diskin2</span> "beats.wav", p4, 0, 1
    <span class="opc">outs</span> asig, asig
<span class="oblock">endin</span>

<span class="oblock">instr</span> 2
    <span class="opc">turnoff2</span> 1, 0, 0   <span class="comment">;Turn off instr 1</span>
    <span class="opc">turnoff</span>   <span class="comment">;Turn off this instrument</span>
<span class="oblock">endin</span>

<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>

<span class="comment">; Real-time performance for 1 hour.</span>
<span class="stamnt">f</span> 0 3600
<span class="stamnt">e</span>


<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
      <div class="refsect1" title="See Also">
        <a id="idp20595264"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="FLbox.html" title="FLbox"><em class="citetitle">FLbox</em></a>,
      <a class="link" href="FLbutBank.html" title="FLbutBank"><em class="citetitle">FLbutBank</em></a>,
      <a class="link" href="FLprintk.html" title="FLprintk"><em class="citetitle">FLprintk</em></a>,
      <a class="link" href="FLprintk2.html" title="FLprintk2"><em class="citetitle">FLprintk2</em></a>,
      <a class="link" href="FLvalue.html" title="FLvalue"><em class="citetitle">FLvalue</em></a>
    </p>
      </div>
      <div class="refsect1" title="Credits">
        <a id="idp20598264"></a>
        <h2>Credits</h2>
        <p>Author: Gabriel Maldonado</p>
        <p>New in version 4.22</p>
        <p>Example written by Iain McCurdy, edited by Kevin Conder.</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="FLbutBank.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="FLcloseButton.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">FLbutBank </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> FLcloseButton</td>
        </tr>
      </table>
    </div>
  </body>
</html>