Sophie

Sophie

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

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>FLknob</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="FLkeyIn.html" title="FLkeyIn" />
    <link rel="next" href="FLlabel.html" title="FLlabel" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">FLknob</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="FLkeyIn.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="FLlabel.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry" title="FLknob">
      <a id="FLknob"></a>
      <div class="titlepage"></div>
      <a id="IndexFLknob" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">FLknob</span>
        </h2>
        <p>FLknob — 
      A FLTK widget opcode that creates a knob.
          </p>
      </div>
      <div class="refsect1" title="Description">
        <a id="idp21081832"></a>
        <h2>Description</h2>
        <p>
      A FLTK widget opcode that creates a knob.
    </p>
      </div>
      <div class="refsect1" title="Syntax">
        <a id="idp21082552"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">kout, ihandle <span class="command"><strong>FLknob</strong></span> "label", imin, imax, iexp, itype, idisp, iwidth, \
      ix, iy [, icursorsize]</pre>
      </div>
      <div class="refsect1" title="Initialization">
        <a id="idp21093096"></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 utput by <span class="emphasis"><em>FLknob</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>
      <span class="emphasis"><em>imin</em></span> -- minimum value of output range.
    </p>
        <p>
      <span class="emphasis"><em>imax</em></span> -- maximum value of output range.
    </p>
        <p>
      <span class="emphasis"><em>iexp</em></span> -- an integer number denoting the behaviour of valuator: 
      </p>
        <div class="itemizedlist">
          <ul class="itemizedlist" type="disc">
            <li class="listitem">
              <p>0 = valuator output is linear</p>
            </li>
            <li class="listitem">
              <p>-1 = valuator output is exponential</p>
            </li>
          </ul>
        </div>
        <p>
    </p>
        <p>
      All other positive numbers for <span class="emphasis"><em>iexp</em></span> indicate the number of an existing table that is used for indexing. Linear interpolation is provided in table indexing. A negative table number suppresses interpolation. 
    </p>
        <div class="warning" title="IMPORTANT!" style="margin-left: 0.5in; margin-right: 0.5in;">
          <table border="0" summary="Warning: IMPORTANT!">
            <tr>
              <td rowspan="2" align="center" valign="top" width="25">
                <img alt="[Warning]" src="images/warning.png" />
              </td>
              <th align="left">IMPORTANT!</th>
            </tr>
            <tr>
              <td align="left" valign="top">
                <p>
        Notice that the tables used by valuators must be created with the <a class="link" href="ftgen.html" title="ftgen"><em class="citetitle">ftgen</em></a> opcode and placed in the orchestra before the corresponding valuator. They can not placed
in the score. In fact, tables placed in the score are created later than the initialization of the opcodes placed in the header section of the orchestra.
      </p>
              </td>
            </tr>
          </table>
        </div>
        <p>
      <span class="emphasis"><em>itype</em></span> -- an integer number denoting the appearance of the valuator.
    </p>
        <p>
      The <span class="emphasis"><em>itype</em></span> argument can be set to the following values:

      </p>
        <div class="itemizedlist">
          <ul class="itemizedlist" type="disc">
            <li class="listitem">
              <p>1 - a 3-D knob</p>
            </li>
            <li class="listitem">
              <p>2 - a pie-like knob</p>
            </li>
            <li class="listitem">
              <p>3 - a clock-like knob</p>
            </li>
            <li class="listitem">
              <p>4 - a flat knob</p>
            </li>
          </ul>
        </div>
        <p>

      </p>
        <div class="mediaobject">
          <img src="images/flknob_3d.png" alt="A 3-D knob." />
          <div class="caption">
            <p>A 3-D knob.</p>
          </div>
        </div>
        <p>

      </p>
        <div class="mediaobject">
          <img src="images/flknob_pie.png" alt="A pie knob." />
          <div class="caption">
            <p>A pie knob.</p>
          </div>
        </div>
        <p>

      </p>
        <div class="mediaobject">
          <img src="images/flknob_clock.png" alt="A clock knob." />
          <div class="caption">
            <p>A clock knob.</p>
          </div>
        </div>
        <p>

      </p>
        <div class="mediaobject">
          <img src="images/flknob_flat.png" alt="A flat knob." />
          <div class="caption">
            <p>A flat knob.</p>
          </div>
        </div>
        <p>
    </p>
        <p>
      <span class="emphasis"><em>idisp</em></span> -- a handle value that was output from a previous instance of the <a class="link" href="FLvalue.html" title="FLvalue"><em class="citetitle">FLvalue</em></a> opcode to display the current value of the current valuator in the <span class="emphasis"><em>FLvalue</em></span> widget itself. If the user doesn't want to use this feature that displays current values, it must be set to a negative number by the user.
    </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>icursorsize</em></span> (optional) -- If <span class="emphasis"><em>FLknob</em></span>'s <span class="emphasis"><em>itype</em></span> is set to 1 (3D knob), this parameter controls the size of knob cursor.
    </p>
      </div>
      <div class="refsect1" title="Performance">
        <a id="idp21149944"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>kout</em></span> -- output value
    </p>
        <p>
      <span class="emphasis"><em>FLknob</em></span> puts a knob in the corresponding container.
    </p>
      </div>
      <div class="refsect1" title="Examples">
        <a id="idp21151328"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the FLknob opcode. It uses the file <a class="ulink" href="examples/FLknob.csd" target="_top"><em class="citetitle">FLknob.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp21152304"></a>
          <p class="title">
            <strong>Example 243. Example of the FLknob 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 FLknob.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">; A sine with oscillator with flknob controlled frequency</span>
<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">kr</span> <span class="op">=</span> 441
<span class="ohdr">ksmps</span> <span class="op">=</span> 100
<span class="ohdr">nchnls</span> <span class="op">=</span> 1

<span class="opc">FLpanel</span> "Frequency Knob", 900, 400, 50, 50
    <span class="comment">; Minimum value output by the knob</span>
    imin <span class="op">=</span> 200
    <span class="comment">; Maximum value output by the knob</span>
    imax <span class="op">=</span> 5000
    <span class="comment">; Logarithmic type knob selected</span>
    iexp <span class="op">=</span> <span class="op">-</span>1
    <span class="comment">; Knob graphic type (1=3D knob)</span>
    itype <span class="op">=</span> 1 
    <span class="comment">; Display handle (-1=not used)</span>
    idisp <span class="op">=</span> <span class="op">-</span>1
    <span class="comment">; Width of the knob in pixels</span>
    iwidth <span class="op">=</span> 70
    <span class="comment">; Distance of the left edge of the knob </span>
    <span class="comment">; from the left edge of the panel</span>
    ix <span class="op">=</span> 70
    <span class="comment">; Distance of the top edge of the knob </span>
    <span class="comment">; from the top of the panel</span>
    iy <span class="op">=</span> 125

    gkfreq, ihandle <span class="opc">FLknob</span> "Frequency", imin, imax, iexp, itype, idisp, iwidth, ix, iy
<span class="comment">; End of panel contents</span>
<span class="opc">FLpanelEnd</span>
<span class="comment">; Run the widget thread!</span>
<span class="opc">FLrun</span>

<span class="comment">; Set the widget's initial value</span>
<span class="opc">FLsetVal_i</span> 300, ihandle

<span class="oblock">instr</span> 1
    iamp <span class="op">=</span> 15000
    ifn <span class="op">=</span> 1
    asig <span class="opc">oscili</span> iamp, gkfreq, ifn
    <span class="opc">out</span> asig
<span class="oblock">endin</span>


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

<span class="comment">; Function table that defines a single cycle</span>
<span class="comment">; of a sine wave.</span>
<span class="stamnt">f</span> 1 0 1024 10 1

<span class="comment">; Instrument 1 will play a note for 1 hour.</span>
<span class="stamnt">i</span> 1 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>
        <p>
      Here is another example of the FLknob opcode, showing the different styles of knobs and the usage of FLvalue to display a knob's value. It uses the file <a class="ulink" href="examples/FLknob-2.csd" target="_top"><em class="citetitle">FLknob-2.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp21155256"></a>
          <p class="title">
            <strong>Example 244. More complex example of the FLknob opcode.</strong>
          </p>
          <div class="example-contents">
            <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 FLknob.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">kr</span> <span class="op">=</span> 441
<span class="ohdr">ksmps</span> <span class="op">=</span> 100
<span class="ohdr">nchnls</span> <span class="op">=</span> 1

<span class="comment">;By Andres Cabrera 2007</span>
<span class="opc">FLpanel</span> "Knob Types", 330, 230, 50, 50
    <span class="comment">; Distance of the left edge of the knob </span>
    <span class="comment">; from the left edge of the panel</span>
    ix <span class="op">=</span> 20
    <span class="comment">; Distance of the top edge of the knob </span>
    <span class="comment">; from the top of the panel</span>
    iy <span class="op">=</span> 20

    <span class="comment">;Create boxes that display a widget's value</span>
    ihandleA <span class="opc">FLvalue</span> "A", 60, 20, ix <span class="op">+</span> 130, iy <span class="op">+</span> 110
    ihandleB <span class="opc">FLvalue</span> "B", 60, 20, ix <span class="op">+</span> 220, iy <span class="op">+</span> 110
    ihandleC <span class="opc">FLvalue</span> "C", 60, 20, ix <span class="op">+</span> 130, iy <span class="op">+</span> 160
    ihandleD <span class="opc">FLvalue</span> "D", 60, 20, ix <span class="op">+</span> 220, iy <span class="op">+</span> 160

    <span class="comment">; The foru types of FLknobs</span>
    gkdummy1, ihandle1 <span class="opc">FLknob</span> "Type 1", 200, 5000, <span class="op">-</span>1, 1, ihandleA, 70, ix, iy, 90
    gkdummy2, ihandle2 <span class="opc">FLknob</span> "Type 2", 200, 5000, <span class="op">-</span>1, 2, ihandleB, 70, ix <span class="op">+</span> 100, iy
    gkdummy3, ihandle3 <span class="opc">FLknob</span> "Type 3", 200, 5000, <span class="op">-</span>1, 3, ihandleC, 70, ix <span class="op">+</span> 200, iy
    gkdummy4, ihandle4 <span class="opc">FLknob</span> "Type 4", 200, 5000, <span class="op">-</span>1, 4, ihandleD, 70, ix , iy <span class="op">+</span> 100
<span class="comment">; End of panel contents</span>
<span class="opc">FLpanelEnd</span>
<span class="comment">; Run the widget thread!</span>
<span class="opc">FLrun</span>

<span class="comment">; Set the color of widgets</span>
<span class="opc">FLsetColor</span> 20, 23, 100, ihandle1
<span class="opc">FLsetColor</span> 0, 123, 100, ihandle2
<span class="opc">FLsetColor</span> 180, 23, 12, ihandle3
<span class="opc">FLsetColor</span> 10, 230, 0, ihandle4

<span class="opc">FLsetColor2</span> 200, 230, 0, ihandle1
<span class="opc">FLsetColor2</span> 200,0 ,123 , ihandle2
<span class="opc">FLsetColor2</span> 180, 180, 100, ihandle3
<span class="opc">FLsetColor2</span> 180, 23, 12, ihandle4


<span class="comment">; Set the initial value of the widget</span>
<span class="opc">FLsetVal_i</span> 300, ihandle1
<span class="opc">FLsetVal_i</span> 1000, ihandle2


<span class="oblock">instr</span> 1
<span class="comment">; Nothing here for now</span>
<span class="oblock">endin</span>


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

<span class="stamnt">f</span> 0 3600   <span class="comment">;Dumy table to make csound wait for realtime events</span>

<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="idp21156288"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="FLcount.html" title="FLcount"><em class="citetitle">FLcount</em></a>,
      <a class="link" href="FLjoy.html" title="FLjoy"><em class="citetitle">FLjoy</em></a>,
      <a class="link" href="FLroller.html" title="FLroller"><em class="citetitle">FLroller</em></a>,
      <a class="link" href="FLslider.html" title="FLslider"><em class="citetitle">FLslider</em></a>,
      <a class="link" href="FLtext.html" title="FLtext"><em class="citetitle">FLtext</em></a>
    </p>
      </div>
      <div class="refsect1" title="Credits">
        <a id="idp21159288"></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="FLkeyIn.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="FLlabel.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">FLkeyIn </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> FLlabel</td>
        </tr>
      </table>
    </div>
  </body>
</html>