<?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>FLbutBank</title> <link rel="stylesheet" type="text/css" href="csound.css" /> <link rel="stylesheet" type="text/css" href="syntax-highlighting.css" /> <meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /> <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="FLbox.html" title="FLbox" /> <link rel="next" href="FLbutton.html" title="FLbutton" /> </head> <body> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center">FLbutBank</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="FLbox.html">Prev</a> </td> <th width="60%" align="center">Orchestra Opcodes and Operators</th> <td width="20%" align="right"> <a accesskey="n" href="FLbutton.html">Next</a></td> </tr> </table> <hr /> </div> <div class="refentry"> <a id="FLbutBank"></a> <div class="titlepage"></div> <a id="IndexFLbutBank" class="indexterm"></a> <div class="refnamediv"> <h2> <span class="refentrytitle">FLbutBank</span> </h2> <p>FLbutBank — A FLTK widget opcode that creates a bank of buttons. </p> </div> <div class="refsect1"> <a id="idm281472936830728"></a> <h2>Description</h2> <p> A FLTK widget opcode that creates a bank of buttons. </p> </div> <div class="refsect1"> <a id="idm281472936787240"></a> <h2>Syntax</h2> <pre class="synopsis">kout, ihandle <span class="command"><strong>FLbutBank</strong></span> itype, inumx, inumy, iwidth, iheight, ix, iy, \ iopcode [, kp1] [, kp2] [, kp3] [, kp4] [, kp5] [....] [, kpN]</pre> </div> <div class="refsect1"> <a id="idm281472936784936"></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>FLbutBank</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>itype</em></span> -- an integer number denoting the appearance of the widget. The valid numbers are: </p> <div class="itemizedlist"> <ul class="itemizedlist" style="list-style-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> <span class="emphasis"><em>inumx</em></span> -- number of buttons in each row of the bank. </p> <p> <span class="emphasis"><em>inumy</em></span> -- number of buttons in each column of the bank </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"> <a id="idm281472936771544"></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> The <span class="emphasis"><em>FLbutBank</em></span> opcode creates a bank of buttons. For example, the following line: </p> <div class="informalexample"> <pre class="programlisting"> gkButton,ihb1 FLbutBank 22, 8, 8, 380, 180, 50, 350, 0, 7, 0, 0, 5000, 6000 </pre> </div> <p> will create the this bank: </p> <div class="mediaobject"> <img src="images/flbutbank.png" alt="FLbutBank." /> <div class="caption"> <p>FLbutBank.</p> </div> </div> <p> </p> <p> A click to a button checks that button. It may also uncheck a previous checked button belonging to the same bank. So the behaviour is always that of radio-buttons. Notice that each button is labeled with a progressive number. The <span class="emphasis"><em>kout</em></span> argument is filled with that number when corresponding button is checked. </p> <p> <span class="emphasis"><em>FLbutBank</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. 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-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. </p> <p> The <span class="emphasis"><em>itype</em></span> argument sets the type of buttons identically to the <a class="link" href="FLbutton.html" title="FLbutton"><em class="citetitle">FLbutton</em></a> opcode. By adding 10 to the <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 current <span class="emphasis"><em>FLbutBank</em></span> value when getting/setting snapshots (see <a class="link" href="ControlFltkGeneral.html" title="General FLTK Widget-related Opcodes"><em class="citetitle">General FLTK Widget-related Opcodes</em></a>). You can also add 10 to "plastic" button types (31 for type 1, 32 for type 2, etc.) </p> <p> FLbutBank is very useful to retrieve snapshots. </p> </div> <div class="refsect1"> <a id="idm281472936752696"></a> <h2>Examples</h2> <p> Here is an example of the FLbutBank opcode. It uses the file <a class="ulink" href="examples/FLbutBank.csd" target="_top"><em class="citetitle">FLbutBank.csd</em></a>. </p> <div class="example"> <a id="idm281472936750872"></a> <p class="title"> <strong>Example 285. Example of the FLbutBank 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> <div class="refsect1"> <a id="idm281472769176568"></a> <pre class="programlisting"> <span class="nt"><CsoundSynthesizer></span> <span class="nt"><CsOptions></span> <span class="c1">; Select audio/midi flags here according to platform</span> <span class="c1">; Audio out Audio in No messages</span> -odac -iadc -d <span class="c1">;;;RT audio I/O</span> <span class="c1">; For Non-realtime ouput leave only the line below:</span> <span class="c1">; -o FLbutton.wav -W ;;; for file output any platform</span> <span class="nt"></CsOptions></span> <span class="nt"><CsInstruments></span> <span class="vg">sr</span> <span class="o">=</span> <span class="mi">44100</span> <span class="vg">nchnls</span> <span class="o">=</span> <span class="mi">1</span> <span class="nb">FLpanel</span> <span class="s">"Button Bank"</span><span class="p">,</span> <span class="mi">520</span><span class="p">,</span> <span class="mi">140</span><span class="p">,</span> <span class="mi">100</span><span class="p">,</span> <span class="mi">100</span> <span class="c1">;itype = 2 ;Light Buttons</span> i<span class="n">type</span> <span class="o">=</span> <span class="mi">22</span> <span class="c1">;Plastic Light Buttons</span> i<span class="n">numx</span> <span class="o">=</span> <span class="mi">10</span> i<span class="n">numy</span> <span class="o">=</span> <span class="mi">4</span> i<span class="n">width</span> <span class="o">=</span> <span class="mi">500</span> i<span class="n">height</span> <span class="o">=</span> <span class="mi">120</span> i<span class="n">x</span> <span class="o">=</span> <span class="mi">10</span> i<span class="n">y</span> <span class="o">=</span> <span class="mi">10</span> i<span class="n">opcode</span> <span class="o">=</span> <span class="mi">0</span> i<span class="n">starttim</span> <span class="o">=</span> <span class="mi">0</span> i<span class="n">dur</span> <span class="o">=</span> <span class="mi">1</span> gk<span class="n">button</span><span class="p">,</span> i<span class="n">hbb</span> <span class="nb">FLbutBank</span> i<span class="n">type</span><span class="p">,</span> i<span class="n">numx</span><span class="p">,</span> i<span class="n">numy</span><span class="p">,</span> i<span class="n">width</span><span class="p">,</span> i<span class="n">height</span><span class="p">,</span> i<span class="n">x</span><span class="p">,</span> i<span class="n">y</span><span class="p">,</span> i<span class="n">opcode</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> i<span class="n">starttim</span><span class="p">,</span> i<span class="n">dur</span> <span class="nb">FLpanelEnd</span> <span class="nb">FLrun</span> <span class="kd">instr</span> <span class="nf">1</span> i<span class="n">button</span> <span class="o">=</span> <span class="nb">i</span><span class="p">(</span>gk<span class="n">button</span><span class="p">)</span> <span class="nb">prints</span> <span class="s">"Button </span><span class="si">%i</span><span class="s"> pushed!</span><span class="se">\\</span><span class="s">n"</span><span class="p">,</span> i<span class="n">button</span> <span class="kd">endin</span> <span class="nt"></CsInstruments></span> <span class="nt"><CsScore></span> <span class="c1">; Real-time performance for 1 hour.</span> <span class="nb">f</span> <span class="mi">0</span> <span class="mi">3600</span> <span class="nb">e</span> <span class="nt"></CsScore></span> <span class="nt"></CsoundSynthesizer></span> </pre> </div> </div> </div> <p><br class="example-break" /> </p> </div> <div class="refsect1"> <a id="idm281472936746584"></a> <h2>See Also</h2> <p> <a class="link" href="FLbox.html" title="FLbox"><em class="citetitle">FLbox</em></a>, <a class="link" href="FLbutton.html" title="FLbutton"><em class="citetitle">FLbutton</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"> <a id="idm281472936740696"></a> <h2>Credits</h2> <p>Author: Gabriel Maldonado</p> <p>New in version 4.22</p> </div> </div> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"><a accesskey="p" href="FLbox.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="FLbutton.html">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top">FLbox </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> FLbutton</td> </tr> </table> </div> </body> </html>