Sophie

Sophie

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

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>FLmouse</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="FLloadsnap.html" title="FLloadsnap" />
    <link rel="next" href="flooper.html" title="flooper" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">FLmouse</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="FLloadsnap.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="flooper.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry" title="FLmouse">
      <a id="FLmouse"></a>
      <div class="titlepage"></div>
      <a id="IndexFLmouse" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">FLmouse</span>
        </h2>
        <p>FLmouse — 
      Returns the mouse position and the state of the three mouse buttons.
    </p>
      </div>
      <div class="refsect1" title="Description">
        <a id="idp21238848"></a>
        <h2>Description</h2>
        <p>
      <span class="emphasis"><em>FLmouse</em></span> returns the coordinates of the mouse position within an FLTK panel and the state of the three mouse buttons.
    </p>
      </div>
      <div class="refsect1" title="Syntax">
        <a id="idp21282608"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">kx, ky, kb1, kb2, kb3 <span class="command"><strong>FLmouse</strong></span> [imode]</pre>
      </div>
      <div class="refsect1" title="Initialization">
        <a id="idp21283712"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>imode</em></span> – (optional, default = 0)  Determines the mode for mouse location reporting.
    </p>
        <div class="itemizedlist">
          <ul class="itemizedlist" type="disc">
            <li class="listitem">
              <p>0 - Absolute position normalized to range 0-1</p>
            </li>
            <li class="listitem">
              <p>1 - Absolute raw pixel position</p>
            </li>
            <li class="listitem">
              <p>2 - Raw pixel position, relative to FLTK panel</p>
            </li>
          </ul>
        </div>
        <p>
    </p>
      </div>
      <div class="refsect1" title="Performance">
        <a id="idp21285808"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>kx, ky</em></span> – the mouse coordinates, whose range depends on the <span class="emphasis"><em>imode</em></span> argument (see above).
    </p>
        <p><span class="emphasis"><em>kb1, kb2, kb3</em></span> – the states of the mouse buttons, 1 when corresponding button is pressed, 0 when the button is not pressed.
    </p>
        <p>
      <span class="emphasis"><em>FLmouse</em></span> returns the coordinates of the mouse position and the state of the three mouse buttons. The coordinates can be retrieved in three modes depending on the <span class="emphasis"><em>imode</em></span> argument value (see above). Modes 0 and 1 report mouse position in relation to the complete screen (Absolute mode), while mode 2, reports the pixel position within an FLTK panel. Notice that FLmouse is only active when the mouse cursor passes on an <a class="link" href="FLpanel.html" title="FLpanel"><em class="citetitle">FLpanel</em></a> area.
    </p>
      </div>
      <div class="refsect1" title="Examples">
        <a id="idp21289056"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the FLmouse opcode. It uses the file <a class="ulink" href="examples/FLmouse.csd" target="_top"><em class="citetitle">FLmouse.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp21290032"></a>
          <p class="title">
            <strong>Example 245. Example of the FLmouse 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="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>128
<span class="ohdr">nchnls</span><span class="op">=</span>2

<span class="comment">;Example by Andres Cabrera 2007</span>
giwidth <span class="op">=</span> 400
giheight <span class="op">=</span> 300
<span class="opc">FLpanel</span> "FLmouse", giwidth, giheight, 10, 10
<span class="opc">FLpanelEnd</span>

<span class="opc">FLrun</span>

<span class="ohdr">0dbfs</span> <span class="op">=</span> 1

<span class="oblock">instr</span> 1
  kx, ky, kb1, kb2, kb3    <span class="opc">FLmouse</span> 2
  ktrig <span class="opc">changed</span> kx, ky  <span class="comment">;Print only if coordinates have changed</span>
  <span class="opc">printf</span> "kx <span class="op">=</span> <span class="op">%</span>f   ky <span class="op">=</span> <span class="op">%</span>f \n", ktrig, kx, ky
kfreq <span class="op">=</span> ((giwidth <span class="op">-</span> ky)<span class="op">*</span>1000<span class="op">/</span>giwidth) <span class="op">+</span> 300

<span class="comment">; y coordinate determines frequency, x coordinate determines amplitude</span>
<span class="comment">; Left mouse button (kb1) doubles the frequency</span>
<span class="comment">; Right mouse button (kb3) activates sound on channel 2</span>
  aout <span class="opc">oscil</span> kx <span class="op">/</span>giwidth , kfreq <span class="op">*</span> (kb1 <span class="op">+</span> 1), 1
  <span class="opc">outs</span> aout, aout <span class="op">*</span> kb3
<span class="oblock">endin</span>

<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>
<span class="stamnt">f</span> 1 0 1024 10 1

<span class="stamnt">i</span> 1 0 120
<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="Credits">
        <a id="idp21292376"></a>
        <h2>Credits</h2>
        <p>Author: Gabriel Maldonado</p>
        <p>New in version 5.06</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="FLloadsnap.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="flooper.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">FLloadsnap </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> flooper</td>
        </tr>
      </table>
    </div>
  </body>
</html>