Sophie

Sophie

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

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>wiiconnect</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="wguide2.html" title="wguide2" />
    <link rel="next" href="wiidata.html" title="wiidata" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">wiiconnect</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="wguide2.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="wiidata.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry" title="wiiconnect">
      <a id="wiiconnect"></a>
      <div class="titlepage"></div>
      <a id="Indexwiiconnect" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">wiiconnect</span>
        </h2>
        <p>wiiconnect — 
      Reads data from a number of external Nintendo Wiimote controllers.
    </p>
      </div>
      <div class="refsect1" title="Description">
        <a id="idp54015528"></a>
        <h2>Description</h2>
        <p>
      Opens and at control-rate polls up to four external Nintendo Wiimote controllers.
    </p>
      </div>
      <div class="refsect1" title="Syntax">
        <a id="idp54016224"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">ires <span class="command"><strong>wiiconnect</strong></span> [itimeout, imaxnum]</pre>
      </div>
      <div class="refsect1" title="Initialization">
        <a id="idp54026688"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>itimeout</em></span> -- integer number of seconds the
      system should wait for all Wiimotes to be connected.  If not
      given it defaults to 10 seconds.
    </p>
        <p>
      <span class="emphasis"><em>imaxnum</em></span> -- maximum number of Wiimotes to locate.  If not
      given it defaults to 4.
    </p>
        <p>
      Initially each Wiimote has its numeric allocation indicated by
      lighting one of the four LEDs.
    </p>
        <p>
      <span class="emphasis"><em>ires</em></span> -- return value is 1 if sucess or zero
      on failure.
    </p>
      </div>
      <div class="refsect1" title="Performance">
        <a id="idp54028928"></a>
        <h2>Performance</h2>
        <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
          <table border="0" summary="Note">
            <tr>
              <td rowspan="2" align="center" valign="top" width="25">
                <img alt="[Note]" src="images/note.png" />
              </td>
              <th align="left">Note</th>
            </tr>
            <tr>
              <td align="left" valign="top">
                <p>
       Please note that these opcodes are currently only supported on
       Linux.
     </p>
              </td>
            </tr>
          </table>
        </div>
        <p>
      Every control cycle each Wiimote is polled for its status and
      position.  These values are read by
      the <span class="emphasis"><em>wiidata</em></span> opcode.  The result returned is
      1 in most cases, but will be zero if a Wiimote disconnects,
    </p>
      </div>
      <div class="refsect1" title="Example">
        <a id="idp54064856"></a>
        <h2>Example</h2>
        <p>
      Here is an example of the wii opcodes. It uses the file <a class="ulink" href="examples/wii.csd" target="_top"><em class="citetitle">wii.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp54065824"></a>
          <p class="title">
            <strong>Example 998. Example of the wii opcodes.</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>
-+rtaudio=alsa -o dac:hw:0
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>
<span class="ohdr">nchnls</span> <span class="op">=</span> 2
<span class="ohdr">ksmps</span> <span class="op">=</span> 400

<span class="omacro">#define</span> WII_B           #3#
<span class="omacro">#define</span> WII_A           #4#
<span class="omacro">#define</span> WII_R_A         #304#
<span class="omacro">#define</span> WII_PITCH       #20#
<span class="omacro">#define</span> WII_ROLL        #21#
<span class="omacro">#define</span> WII_BATTERY     #27#

<span class="omacro">#define</span> WII_RUMBLE      #3#
<span class="omacro">#define</span> WII_SET_LEDS    #4#

gkcnt <span class="opc">init</span> 1

<span class="oblock">instr</span> 1  
  i1  wiiconnect 3,1

      wiirange   $WII_PITCH., <span class="op">-</span>20, 0
  kb  wiidata    $WII_BATTERY.
  kt  wiidata    $WII_B.
  ka  wiidata    $WII_A.
  kra wiidata    $WII_R_A.
  gka wiidata    $WII_PITCH.
  gkp wiidata    $WII_ROLL.
<span class="comment">; If the B (trigger) button is pressed then activate a note</span>
  <span class="octrl">if</span>  (kt<span class="op">==</span>0)    <span class="octrl">goto</span> <span class="olabel">ee</span>
  <span class="opc">event</span> "i", 2, 0, 5
  gkcnt <span class="op">=</span> gkcnt <span class="op">+</span> 1
  wiisend       $WII_SET_LEDS., gkcnt
<span class="olabel">ee</span><span class="op">:</span>
  <span class="octrl">if</span> (ka<span class="op">==</span>0)    <span class="octrl">goto</span> <span class="olabel">ff</span>
  wiisend       $WII_RUMBLE., 1
<span class="olabel">ff</span><span class="op">:</span>
  <span class="octrl">if</span> (kra<span class="op">==</span>0)   <span class="octrl">goto</span> <span class="olabel">gg</span>
  wiisend       $WII_RUMBLE., 0
<span class="olabel">gg</span><span class="op">:</span>
  <span class="opc">printk2</span>  kb
<span class="oblock">endin</span>

<span class="oblock">instr</span> 2
  a1 <span class="opc">oscil</span>  <span class="opc">ampdbfs</span>(gka), 440<span class="op">+</span>gkp, 1
     <span class="opc">outs</span>   a1, a1
<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 4096 10 1
<span class="stamnt">i</span>1 0 300

<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="idp54068088"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="wiidata.html" title="wiidata"><em class="citetitle">wiidata</em></a>,
      <a class="link" href="wiirange.html" title="wiirange"><em class="citetitle">wiirange</em></a>,
      <a class="link" href="wiisend.html" title="wiisend"><em class="citetitle">wiisend</em></a>
     </p>
      </div>
      <div class="refsect1" title="Credits">
        <a id="idp54070064"></a>
        <h2>Credits</h2>
        <p>
      </p>
        <table border="0" summary="Simple list" class="simplelist">
          <tr>
            <td>Author: John ffitch</td>
          </tr>
          <tr>
            <td>Codemist Ltd</td>
          </tr>
          <tr>
            <td>2009</td>
          </tr>
        </table>
        <p>
    </p>
        <p>New in version 5.11</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="wguide2.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="wiidata.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">wguide2 </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> wiidata</td>
        </tr>
      </table>
    </div>
  </body>
</html>