Sophie

Sophie

distrib > Fedora > 13 > i386 > media > os > by-pkgid > 52a37fb77746ef557a2ec666070d732e > files > 25

bigloo-doc-3.2b-3.fc12.i686.rpm

<!-- 95% W3C COMPLIANT, 95% CSS FREE, RAW HTML -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
<title>BiglooA ``practical Scheme compiler''User manual for version 3.2bJune 2009</title>
 <style type="text/css">
  <!--
  pre { font-family: monospace }
  tt { font-family: monospace }
  code { font-family: monospace }
  p.flushright { text-align: right }
  p.flushleft { text-align: left }
  span.sc { font-variant: small-caps }
  span.sf { font-family: sans-serif }
  span.skribetitle { font-family: sans-serif; font-weight: bolder; font-size: x-large; }
  span.refscreen { }
  span.refprint { display: none; }
  -->
 </style>
</head>

<body class="chapter" bgcolor="#ffffff">
<table width="100%" class="skribetitle" cellspacing="0" cellpadding="0"><tbody>
<tr><td align="center" bgcolor="#8381de"><div class="skribetitle"><strong><big><big><big>19. Bigloo<br/>A ``practical Scheme compiler''<br/>User manual for version 3.2b<br/>June 2009 -- Multimedia library</big></big></big></strong></div><center>
</center>
</td></tr></tbody></table>
<table cellpadding="3" cellspacing="0" width="100%" class="skribe-margins"><tr>
<td align="left" valign="top" class="skribe-left-margin" width="20%" bgcolor="#dedeff"><div class="skribe-left-margin">
<br/><center id='center29542'
><table width="97%" border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse;" frame="box" rules="none"><tbody>
<tr bgcolor="#8381de"><th id="tc29532" align="center" colspan="1"><font color="#ffffff"><strong id='bold29530'
>main page</strong></font></th></tr>
<tr bgcolor="#ffffff"><td id="tc29539" align="center" colspan="1"><table width="100%" border="0" style="border-collapse: collapse;" frame="void" rules="none"><tbody>
<tr><td id="tc29535" align="left" valign="top" colspan="1"><strong id='bold29534'
>top:</strong></td><td id="tc29536" align="right" valign="top" colspan="1"><a href="bigloo.html#Bigloo-A-``practical-Scheme-compiler''-User-manual-for-version-3.2b-June-2009" class="inbound">Bigloo<br/>A ``practical Scheme compiler''<br/>User manual for version 3.2b<br/>June 2009</a></td></tr>
</tbody></table>
</td></tr>
</tbody></table>
</center>
<br/><br/><center id='center29552'
><table width="97%" border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse;" frame="box" rules="none"><tbody>
<tr bgcolor="#8381de"><th id="tc29546" align="center" colspan="1"><font color="#ffffff"><strong id='bold29544'
>Multimedia library</strong></font></th></tr>
<tr bgcolor="#ffffff"><td id="tc29549" align="center" colspan="1"><table cellspacing="1" cellpadding="1" width="100%" class="toc">
<tbody>
 <tr><td valign="top" align="left">19.1</td><td colspan="4" width="100%"><a href="bigloo-20.html#Photography">Photography</a></td></tr>
 <tr><td valign="top" align="left">19.2</td><td colspan="4" width="100%"><a href="bigloo-20.html#Music">Music</a></td></tr>
 <tr><td></td><td valign="top" align="left">19.2.1</td><td colspan="3" width="100%"><a href="bigloo-20.html#Metadata-and-Playlist">Metadata and Playlist</a></td></tr>
 <tr><td></td><td valign="top" align="left">19.2.2</td><td colspan="3" width="100%"><a href="bigloo-20.html#Mixer">Mixer</a></td></tr>
 <tr><td></td><td valign="top" align="left">19.2.3</td><td colspan="3" width="100%"><a href="bigloo-20.html#Playback">Playback</a></td></tr>
 <tr><td></td><td valign="top" align="left">19.2.4</td><td colspan="3" width="100%"><a href="bigloo-20.html#Music-Player-Daemon">Music Player Daemon</a></td></tr>
</tbody>
</table>
</td></tr>
</tbody></table>
</center>
<br/><br/><center id='center29562'
><table width="97%" border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse;" frame="box" rules="none"><tbody>
<tr bgcolor="#8381de"><th id="tc29556" align="center" colspan="1"><font color="#ffffff"><strong id='bold29554'
>Chapters</strong></font></th></tr>
<tr bgcolor="#ffffff"><td id="tc29559" align="center" colspan="1"><table cellspacing="1" cellpadding="1" width="100%" class="toc">
<tbody>
 <tr><td valign="top" align="left"></td><td colspan="4" width="100%"><a href="bigloo-1.html#Acknowledgements">Acknowledgements</a></td></tr>
 <tr><td valign="top" align="left">1</td><td colspan="4" width="100%"><a href="bigloo-2.html#Table-of-contents">Table of contents</a></td></tr>
 <tr><td valign="top" align="left">2</td><td colspan="4" width="100%"><a href="bigloo-3.html#Overview-of-Bigloo">Overview of Bigloo</a></td></tr>
 <tr><td valign="top" align="left">3</td><td colspan="4" width="100%"><a href="bigloo-4.html#Modules">Modules</a></td></tr>
 <tr><td valign="top" align="left">4</td><td colspan="4" width="100%"><a href="bigloo-5.html#Core-Language">Core Language</a></td></tr>
 <tr><td valign="top" align="left">5</td><td colspan="4" width="100%"><a href="bigloo-6.html#DSSSL-support">DSSSL support</a></td></tr>
 <tr><td valign="top" align="left">6</td><td colspan="4" width="100%"><a href="bigloo-7.html#Standard-Library">Standard Library</a></td></tr>
 <tr><td valign="top" align="left">7</td><td colspan="4" width="100%"><a href="bigloo-8.html#Pattern-Matching">Pattern Matching</a></td></tr>
 <tr><td valign="top" align="left">8</td><td colspan="4" width="100%"><a href="bigloo-9.html#Fast-search">Fast search</a></td></tr>
 <tr><td valign="top" align="left">9</td><td colspan="4" width="100%"><a href="bigloo-10.html#Structures-and-Records">Structures and Records</a></td></tr>
 <tr><td valign="top" align="left">10</td><td colspan="4" width="100%"><a href="bigloo-11.html#Object-System">Object System</a></td></tr>
 <tr><td valign="top" align="left">11</td><td colspan="4" width="100%"><a href="bigloo-12.html#Regular-parsing">Regular parsing</a></td></tr>
 <tr><td valign="top" align="left">12</td><td colspan="4" width="100%"><a href="bigloo-13.html#Lalr(1)-parsing">Lalr(1) parsing</a></td></tr>
 <tr><td valign="top" align="left">13</td><td colspan="4" width="100%"><a href="bigloo-14.html#Posix-Regular-Expressions">Posix Regular Expressions</a></td></tr>
 <tr><td valign="top" align="left">14</td><td colspan="4" width="100%"><a href="bigloo-15.html#Command-Line-Parsing">Command Line Parsing</a></td></tr>
 <tr><td valign="top" align="left">15</td><td colspan="4" width="100%"><a href="bigloo-16.html#Cryptography">Cryptography</a></td></tr>
 <tr><td valign="top" align="left">16</td><td colspan="4" width="100%"><a href="bigloo-17.html#Errors-Assertions-and-Traces">Errors, Assertions, and Traces</a></td></tr>
 <tr><td valign="top" align="left">17</td><td colspan="4" width="100%"><a href="bigloo-18.html#Threads">Threads</a></td></tr>
 <tr><td valign="top" align="left">18</td><td colspan="4" width="100%"><a href="bigloo-19.html#Database-library">Database library</a></td></tr>
 <tr><td valign="top" align="left">19</td><td colspan="4" width="100%"><a href="bigloo-20.html#Multimedia-library">Multimedia library</a></td></tr>
 <tr><td valign="top" align="left">20</td><td colspan="4" width="100%"><a href="bigloo-21.html#Mail-library">Mail library</a></td></tr>
 <tr><td valign="top" align="left">21</td><td colspan="4" width="100%"><a href="bigloo-22.html#Eval-and-code-interpretation">Eval and code interpretation</a></td></tr>
 <tr><td valign="top" align="left">22</td><td colspan="4" width="100%"><a href="bigloo-23.html#Macro-expansion">Macro expansion</a></td></tr>
 <tr><td valign="top" align="left">23</td><td colspan="4" width="100%"><a href="bigloo-24.html#Parameters">Parameters</a></td></tr>
 <tr><td valign="top" align="left">24</td><td colspan="4" width="100%"><a href="bigloo-25.html#Explicit-typing">Explicit typing</a></td></tr>
 <tr><td valign="top" align="left">25</td><td colspan="4" width="100%"><a href="bigloo-26.html#The-C-interface">The C interface</a></td></tr>
 <tr><td valign="top" align="left">26</td><td colspan="4" width="100%"><a href="bigloo-27.html#The-Java-interface">The Java interface</a></td></tr>
 <tr><td valign="top" align="left">27</td><td colspan="4" width="100%"><a href="bigloo-28.html#Bigloo-Libraries">Bigloo Libraries</a></td></tr>
 <tr><td valign="top" align="left">28</td><td colspan="4" width="100%"><a href="bigloo-29.html#Extending-the-Runtime-System">Extending the Runtime System</a></td></tr>
 <tr><td valign="top" align="left">29</td><td colspan="4" width="100%"><a href="bigloo-30.html#SRFIs">SRFIs</a></td></tr>
 <tr><td valign="top" align="left">30</td><td colspan="4" width="100%"><a href="bigloo-31.html#Compiler-description">Compiler description</a></td></tr>
 <tr><td valign="top" align="left">31</td><td colspan="4" width="100%"><a href="bigloo-32.html#User-Extensions">User Extensions</a></td></tr>
 <tr><td valign="top" align="left">32</td><td colspan="4" width="100%"><a href="bigloo-33.html#Bigloo-Development-Environment">Bigloo Development Environment</a></td></tr>
 <tr><td valign="top" align="left">33</td><td colspan="4" width="100%"><a href="bigloo-34.html#Global-Index">Global Index</a></td></tr>
 <tr><td valign="top" align="left">34</td><td colspan="4" width="100%"><a href="bigloo-35.html#Library-Index">Library Index</a></td></tr>
 <tr><td valign="top" align="left"></td><td colspan="4" width="100%"><a href="bigloo-36.html#Bibliography">Bibliography</a></td></tr>
</tbody>
</table>
</td></tr>
</tbody></table>
</center>
</div></td>
<td align="left" valign="top" class="skribe-body"><div class="skribe-body">
<a name="Multimedia-library" class="mark"></a><a name="g20333" class="mark"></a>
Bigloo provides various facilities for programming multimedia
applications. It provides functions for parsing images and sounds and
functions for controlling music players. All the functions, variables,
and classes presented in the document are accessible via the
<code id='code20335'
>multimedia</code> library. Here is an example of module that uses this
library:<br/><br/><center id='center20346'
><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody>
<tr><td bgcolor="#ffffcc"><pre class="prog" id='prog20344'
><font color="#ffa600"><em id='it29563'
>;; Extract the thumbnail of a digital photography.</em></font>
(<font color="#1919af"><strong id='bold29565'
>module</strong></font> <font color="#1919af"><strong id='bold29567'
>thumbnail</strong></font>
   (<font color="#1919af"><strong id='bold29569'
>library</strong></font> <font color="#1919af"><strong id='bold29571'
>multimedia</strong></font>)
   (main main))<br/><br/>(<font color="#6959cf"><strong id='bold29573'
>define</strong></font> (<font color="#6959cf"><strong id='bold29575'
>main</strong></font> argv)
   (when (and (pair? (cdr argv)) (file-exists? (cadr argv)))
      (<strong id='bold29577'
>let</strong> ((ex (jpeg-exif (cadr argv))))
          (when (exif? ex)
             (display (exif-thumbnail ex))))))
</pre>
</td></tr>
</tbody></table></center>


<!-- Photography -->
<a name="Photography"></a>
<div class="section-atitle"><table width="100%"><tr><td bgcolor="#dedeff"><h3><font color="black">19.1 Photography</font>
</h3></td></tr></table>
</div><div class="section">
<a name="Photography" class="mark"></a><a name="g20347" class="mark"></a>
The multimedia library provides functions for accessing the metadata
generated by digital camera.<br/><br/><table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody>
<tr><td><a name="g20351" class="mark"></a><a name="jpeg-exif" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody>
<tr><td id="tc20355" align="left" colspan="1"><strong id='bold20353'
>jpeg-exif</strong><em id='it20354'
> file-name</em></td><td id="tc20356" align="right" colspan="1">Bigloo Multimedia procedure</td></tr>
</tbody></table>
The function <code id='code20359'
>jpeg-exif</code> extracts the EXIF 
(<a href="http://en.wikipedia.org/wiki/Exif">http://en.wikipedia.org/wiki/Exif</a>) metadata of a JPEG file as created
by digital camera. The argument <code id='code20361'
><em id='it20360'
>file-name</em></code> is the name of the JPEG 
file. If the file contains an EXIF section it is returned as an instance
of the <code id='code20362'
>exif</code> class. Otherwise, this function returns <code id='code20363'
>#f</code>.
</td></tr>
</tbody></table><br/>
<table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody>
<tr><td><a name="g20367" class="mark"></a><a name="jpeg-exif-comment-set!" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody>
<tr><td id="tc20371" align="left" colspan="1"><strong id='bold20369'
>jpeg-exif-comment-set!</strong><em id='it20370'
> file-name text</em></td><td id="tc20372" align="right" colspan="1">Bigloo Multimedia procedure</td></tr>
</tbody></table>

Set the comment of the EXIF metadata section of the file file-name
to <code id='code20376'
><em id='it20375'
>text</em></code>.
</td></tr>
</tbody></table><br/>
<table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody>
<tr><td><a name="g20380" class="mark"></a><a name="exif" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody>
<tr><td id="tc20384" align="left" colspan="1"><strong id='bold20382'
>exif</strong><em id='it20383'
></em></td><td id="tc20385" align="right" colspan="1">Bigloo Multimedia class</td></tr>
</tbody></table>
<center id='center20391'
><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody>
<tr><td bgcolor="#ffffcc"><pre class="prog" id='prog20389'
>(<strong id='bold29578'
>class</strong> exif
   (version (default #f))
   (jpeg-encoding (default #f))
   (jpeg-compress (default #f))
   (comment (default #f))
   (commentpos (default #f))
   (commentlen (default #f))
   (date (default #f))
   (make (default #f))
   (model (default #f))
   (orientation (default 'landscape))
   (width (default #f))
   (height (default #f))
   (ewidth (default #f))
   (eheight (default #f))
   (xresolution (default #f))
   (yresolution (default #f))
   (resolution-unit (default #f))
   (focal-length (default #f))
   (flash (default #f))
   (fnumber (default #f))
   (iso (default #f))
   (shutter-speed-value (default #f))
   (exposure-time (default #f))
   (exposure-bias-value (default #f))
   (aperture (default #f))
   (metering-mode (default #f))
   (cdd-width (default #f))
   (focal-plane-xres (default #f))
   (focal-plane-units (default #f))
   (thumbnail (default #f))
   (thumbnail-path (default #f))
   (thumbnail-offset (default #f))
   (thumbnail-length (default #f)))
</pre>
</td></tr>
</tbody></table></center>

The instance of the <code id='code20392'
>exif</code> class maps the EXIF metadata found in JPEG
files into Bigloo objects. Since all fields are optional they are untyped.
</td></tr>
</tbody></table><br/>
<table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody>
<tr><td><a name="g20396" class="mark"></a><a name="exif-date->date" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody>
<tr><td id="tc20400" align="left" colspan="1"><strong id='bold20398'
>exif-date-&gt;date</strong><em id='it20399'
></em></td><td id="tc20401" align="right" colspan="1">Bigloo Multimedia procedure</td></tr>
</tbody></table>
Parses an exif date, i.e., a string of characters, and returns 
corresponding date. Raises an <code id='code20405'
><em id='it20404'
>&amp;io-parse-error</em></code> if the string does
not represents an exif date whose syntax is given by the following regular
expression:<br/><br/><center id='center20409'
><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody>
<tr><td bgcolor="#ffffcc"><pre class="prog" id='prog20407'
>  [0-9][0-9][0-9]:[0-9][0-9]:[0-9][0-9] :[0-9][0-9]:[0-9][0-9]:[0-9][0-9]
</pre>
</td></tr>
</tbody></table></center>

</td></tr>
</tbody></table><br/>
</div><br>
<!-- Music -->
<a name="Music"></a>
<div class="section-atitle"><table width="100%"><tr><td bgcolor="#dedeff"><h3><font color="black">19.2 Music</font>
</h3></td></tr></table>
</div><div class="section">
<a name="Music" class="mark"></a><a name="g20412" class="mark"></a>
The multimedia library provides an extensive set of functions for dealing
with music. It provides functions for accessing the metadata of certain
music file formats, it provides functions for controlling the volume
of the hardware mixers and it provides functions for playing and controlling
music playback.<br/><br/>
<!-- Metadata and Playlist -->
<a name="Metadata-and-Playlist"></a>
<div class="subsection-atitle"><table width="100%"><tr><td bgcolor="#ffffff"><h3><font color="#8381de">19.2.1 Metadata and Playlist</font>
</h3></td></tr></table>
</div><div class="subsection">
<a name="Metadata-and-Playlist" class="mark"></a><a name="g20415" class="mark"></a>
<table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody>
<tr><td><a name="g20418" class="mark"></a><a name="read-m3u" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody>
<tr><td id="tc20422" align="left" colspan="1"><strong id='bold20420'
>read-m3u</strong><em id='it20421'
> input-port</em></td><td id="tc20423" align="right" colspan="1">Bigloo Multimedia procedure</td></tr>
</tbody></table>
<a name="g20427" class="mark"></a><a name="write-m3u" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody>
<tr><td id="tc20431" align="left" colspan="1"><strong id='bold20429'
>write-m3u</strong><em id='it20430'
> list output-port</em></td><td id="tc20432" align="right" colspan="1">Bigloo Multimedia procedure</td></tr>
</tbody></table>

The function <code id='code20435'
>read-m3u</code> reads a playlist expressed in the M3U
format from <code id='code20437'
><em id='it20436'
>input-port</em></code> and returns a list of songs. The function
<code id='code20438'
>write-m3u</code> encode such a list encoded in the M3U format to an
output port.
</td></tr>
</tbody></table><br/>
<table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody>
<tr><td><a name="g20442" class="mark"></a><a name="mp3-id3" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody>
<tr><td id="tc20446" align="left" colspan="1"><strong id='bold20444'
>mp3-id3</strong><em id='it20445'
> file-name</em></td><td id="tc20447" align="right" colspan="1">Bigloo Multimedia procedure</td></tr>
</tbody></table>
Extracts the ID3 tag of MP3 file named <code id='code20451'
><em id='it20450'
>file-name</em></code>. If the file contains
an ID3 section, this function returns an instance of the Bigloo class
<code id='code20452'
>id3</code>. Otherwise, it returns <code id='code20453'
>#f</code>. This function is able to deal
with all the versions of ID3 encoding.
</td></tr>
</tbody></table><br/>
<table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody>
<tr><td><a name="g20457" class="mark"></a><a name="id3" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody>
<tr><td id="tc20461" align="left" colspan="1"><strong id='bold20459'
>id3</strong><em id='it20460'
></em></td><td id="tc20462" align="right" colspan="1">Bigloo Multimedia class</td></tr>
</tbody></table>
<center id='center20480'
><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody>
<tr><td bgcolor="#ffffcc"><pre class="prog" id='prog20478'
>(<strong id='bold29579'
>class</strong> id3
   version<font color="#00cf00"><strong id='bold29580'
>::bstring</strong></font>
   (title<font color="#00cf00"><strong id='bold29582'
>::bstring</strong></font> read-only)
   (artist<font color="#00cf00"><strong id='bold29584'
>::bstring</strong></font> read-only)
   (orchestra<font color="#00cf00"><strong id='bold29586'
>::obj</strong></font> read-only (default #f))
   (conductor<font color="#00cf00"><strong id='bold29588'
>::obj</strong></font> read-only (default #f))
   (interpret<font color="#00cf00"><strong id='bold29590'
>::obj</strong></font> read-only (default #f))
   (album<font color="#00cf00"><strong id='bold29592'
>::bstring</strong></font> read-only)
   (year<font color="#00cf00"><strong id='bold29594'
>::int</strong></font> read-only)
   (recording read-only (default #f))
   (comment<font color="#00cf00"><strong id='bold29596'
>::bstring</strong></font> read-only)
   (genre<font color="#00cf00"><strong id='bold29598'
>::bstring</strong></font> read-only)
   (track<font color="#00cf00"><strong id='bold29600'
>::int</strong></font> (default -1))
   (cd<font color="#00cf00"><strong id='bold29602'
>::obj</strong></font> (default #f)))
</pre>
</td></tr>
</tbody></table></center>

This class is used to reify the ID3 metadata used in the MP3 format.
</td></tr>
</tbody></table><br/>
</div>
<!-- Mixer -->
<a name="Mixer"></a>
<div class="subsection-atitle"><table width="100%"><tr><td bgcolor="#ffffff"><h3><font color="#8381de">19.2.2 Mixer</font>
</h3></td></tr></table>
</div><div class="subsection">
<a name="Mixer" class="mark"></a><a name="g20483" class="mark"></a>
Bigloo proposes various functions and classes for controlling the
audio volume of sound cards.<br/><br/><table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody>
<tr><td><a name="g20487" class="mark"></a><a name="mixer" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody>
<tr><td id="tc20491" align="left" colspan="1"><strong id='bold20489'
>mixer</strong><em id='it20490'
></em></td><td id="tc20492" align="right" colspan="1">Bigloo Multimedia class</td></tr>
</tbody></table>
<center id='center20499'
><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody>
<tr><td bgcolor="#ffffcc"><pre class="prog" id='prog20497'
>(<strong id='bold29604'
>class</strong> mixer
   (devices<font color="#00cf00"><strong id='bold29605'
>::pair-nil</strong></font> (default '())))
</pre>
</td></tr>
</tbody></table></center>

The field <code id='code20501'
><em id='it20500'
>devices</em></code> is a list of available channels.
</td></tr>
</tbody></table><br/>
<table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody>
<tr><td><a name="g20505" class="mark"></a><a name="mixer-close" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody>
<tr><td id="tc20509" align="left" colspan="1"><strong id='bold20507'
>mixer-close</strong><em id='it20508'
> mix</em></td><td id="tc20510" align="right" colspan="1">Bigloo Multimedia procedure</td></tr>
</tbody></table>
Closes a mixer. The argument <code id='code20514'
><em id='it20513'
>mix</em></code> must be an instance of
the <code id='code20515'
>mixer</code> class.
</td></tr>
</tbody></table><br/>
<table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody>
<tr><td><a name="g20519" class="mark"></a><a name="mixer-volume-get" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody>
<tr><td id="tc20523" align="left" colspan="1"><strong id='bold20521'
>mixer-volume-get</strong><em id='it20522'
> mix channel</em></td><td id="tc20524" align="right" colspan="1">Bigloo Multimedia procedure</td></tr>
</tbody></table>
<a name="g20528" class="mark"></a><a name="mixer-volume-set!" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody>
<tr><td id="tc20532" align="left" colspan="1"><strong id='bold20530'
>mixer-volume-set!</strong><em id='it20531'
> mix channel leftv rightv</em></td><td id="tc20533" align="right" colspan="1">Bigloo Multimedia procedure</td></tr>
</tbody></table>
The function <code id='code20537'
><em id='it20536'
>mixer-volume-get</em></code> returns the left and right volume
levels (two values) of the <code id='code20539'
><em id='it20538'
>channel</em></code> of the mixer <code id='code20541'
><em id='it20540'
>mix</em></code>. The 
<code id='code20543'
><em id='it20542'
>channel</em></code> is denoted by its name and is represented as a string of
characters. The argument <code id='code20545'
><em id='it20544'
>mix</em></code> is an instance of the <code id='code20546'
>mixer</code> class.<br/><br/>The function <code id='code20549'
><em id='it20548'
>mixer-volume-set!</em></code> changes the audio level of a mixer
channel.
</td></tr>
</tbody></table><br/>
<table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody>
<tr><td><a name="g20553" class="mark"></a><a name="soundcard::mixer" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody>
<tr><td id="tc20557" align="left" colspan="1"><strong id='bold20555'
>soundcard::mixer</strong><em id='it20556'
></em></td><td id="tc20558" align="right" colspan="1">Bigloo Multimedia class</td></tr>
</tbody></table>
<center id='center20566'
><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody>
<tr><td bgcolor="#ffffcc"><pre class="prog" id='prog20564'
>(<strong id='bold29607'
>class</strong> soundcard<font color="#00cf00"><strong id='bold29608'
>::mixer</strong></font>
   (device<font color="#00cf00"><strong id='bold29610'
>::bstring</strong></font> read-only))
</pre>
</td></tr>
</tbody></table></center>

The instances of the class <code id='code20567'
>soundcard</code>, a subclass of the
<code id='code20568'
>mixer</code> class, are used to access physical soundcard as supported
by operating systems. The class field <code id='code20570'
><em id='it20569'
>device</em></code> stands for the name
of the system device (e.g., <code id='code20571'
>&quot;/dev/mixer&quot;</code> for the Linux
OS). During the initialization of the instance, the device is opened
and initialized.
</td></tr>
</tbody></table><br/>
</div>
<!-- Playback -->
<a name="Playback"></a>
<div class="subsection-atitle"><table width="100%"><tr><td bgcolor="#ffffff"><h3><font color="#8381de">19.2.3 Playback</font>
</h3></td></tr></table>
</div><div class="subsection">
<a name="Playback" class="mark"></a>
Bigloo supports various functions for playing music. These functions
rely on two data structure: <em id='emph20574'
>music players</em> and <em id='emph20575'
>music status</em>.
The first ones are used to control player back-ends. The second ones are
used to get information about the music being played. The following 
example shows how a simple music player using either MPlayer, MPG123, or
MPC can be programmed with Bigloo.<br/><br/><center id='center20632'
><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody>
<tr><td bgcolor="#ffffcc"><pre class="prog" id='prog20630'
>(<font color="#1919af"><strong id='bold29612'
>module</strong></font> <font color="#1919af"><strong id='bold29614'
>musicplay</strong></font>
   (<font color="#1919af"><strong id='bold29616'
>library</strong></font> <font color="#1919af"><strong id='bold29618'
>multimedia</strong></font>)
   (main main))<br/><br/>(<font color="#6959cf"><strong id='bold29620'
>define</strong></font> (<font color="#6959cf"><strong id='bold29622'
>main</strong></font> args)
   (<strong id='bold29624'
>let</strong> ((files '())
	 (backend 'mplayer)
	 (command #f))
      (args-parse (cdr args)
	 ((<font color="red">&quot;--mpg123&quot;</font> (help <font color="red">&quot;Select the mpg123 back-end&quot;</font>))
	  (<strong id='bold29627'
>set!</strong> backend 'mpg123))
	 ((<font color="red">&quot;--mpc&quot;</font> (help <font color="red">&quot;Select the mpc back-end&quot;</font>))
	  (<strong id='bold29630'
>set!</strong> backend 'mpc))
	 ((<font color="red">&quot;--mplayer&quot;</font> (help <font color="red">&quot;Select the mplayer back-end&quot;</font>))
	  (<strong id='bold29633'
>set!</strong> backend 'mplayer))
	 ((<font color="red">&quot;--command&quot;</font> ?cmd (help <font color="red">&quot;Set the command path&quot;</font>))
	  (<strong id='bold29636'
>set!</strong> command cmd))
	 ((<font color="red">&quot;--help&quot;</font> (help <font color="red">&quot;This help&quot;</font>))
	  (print <font color="red">&quot;usage: music [options] file ...&quot;</font>)
	  (args-parse-usage #f)
	  (exit 0))
	 (else
	  (<strong id='bold29640'
>set!</strong> files (cons else files))))
      <font color="#ffa600"><em id='it29641'
>;; create a music player</em></font>
      (<strong id='bold29643'
>let</strong> ((player (<strong id='bold29644'
>case</strong> backend
		       ((mpg123)
			(<strong id='bold29645'
>if</strong> command
			    (<strong id='bold29646'
>instantiate</strong><font color="#00cf00"><strong id='bold29647'
>::mpg123</strong></font>
			       (path command))
			    (<strong id='bold29649'
>instantiate</strong><font color="#00cf00"><strong id='bold29650'
>::mpg123</strong></font>)))
		       ((mplayer)
			(<strong id='bold29652'
>if</strong> command
			    (<strong id='bold29653'
>instantiate</strong><font color="#00cf00"><strong id='bold29654'
>::mplayer</strong></font>
			       (path command))
			    (<strong id='bold29656'
>instantiate</strong><font color="#00cf00"><strong id='bold29657'
>::mplayer</strong></font>)))
		       ((mpc)
			(<strong id='bold29659'
>instantiate</strong><font color="#00cf00"><strong id='bold29660'
>::mpc</strong></font>)))))
         <font color="#ffa600"><em id='it29662'
>;; fill the music play list</em></font>
	 (for-each (<strong id='bold29664'
>lambda</strong> (p) (music-playlist-add! player p)) (reverse files))
         <font color="#ffa600"><em id='it29665'
>;; start playing</em></font>
	 (music-play player)
         <font color="#ffa600"><em id='it29667'
>;; run an event loop with call-backs associated to some events</em></font>
	 (music-event-loop player
            <strong id='bold29669'
>:onstate</strong> (<strong id='bold29671'
>lambda</strong> (status)
			(<strong id='bold29672'
>with-access</strong><font color="#00cf00"><strong id='bold29673'
>::musicstatus</strong></font> status (state song volume)
			   (print <font color="red">&quot;state   : &quot;</font> state)
			   (print <font color="red">&quot;song    : &quot;</font> song)))
	    <strong id='bold29677'
>:onmeta</strong> (<strong id='bold29679'
>lambda</strong> (meta playlist)
		       (print <font color="red">&quot;meta    : &quot;</font> meta)
		       (print <font color="red">&quot;playlist: &quot;</font>)
		       (for-each (<strong id='bold29682'
>lambda</strong> (s) (print <font color="red">&quot;        &quot;</font> s)) playlist))
	    <strong id='bold29684'
>:onvolume</strong> (<strong id='bold29686'
>lambda</strong> (volume)
		       (print <font color="red">&quot;volume  : &quot;</font> volume))))))
</pre>
</td></tr>
</tbody></table></center>

<table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody>
<tr><td><a name="g20634" class="mark"></a><a name="music" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody>
<tr><td id="tc20638" align="left" colspan="1"><strong id='bold20636'
>music</strong><em id='it20637'
></em></td><td id="tc20639" align="right" colspan="1">Bigloo Multimedia abstract class</td></tr>
</tbody></table>
<center id='center20645'
><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody>
<tr><td bgcolor="#ffffcc"><pre class="prog" id='prog20643'
>(abstract-class music
   (frequency<font color="#00cf00"><strong id='bold29688'
>::long</strong></font> (default 2000000))
</pre>
</td></tr>
</tbody></table></center>

This abstract class is the root class of all music players.
</td></tr>
</tbody></table><br/>
<table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody>
<tr><td><a name="g20649" class="mark"></a><a name="musicproc::music" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody>
<tr><td id="tc20653" align="left" colspan="1"><strong id='bold20651'
>musicproc::music</strong><em id='it20652'
></em></td><td id="tc20654" align="right" colspan="1">Bigloo Multimedia class</td></tr>
</tbody></table>
<center id='center20662'
><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody>
<tr><td bgcolor="#ffffcc"><pre class="prog" id='prog20660'
>(<strong id='bold29690'
>class</strong> musicproc<font color="#00cf00"><strong id='bold29691'
>::music</strong></font>
   (charset<font color="#00cf00"><strong id='bold29693'
>::symbol</strong></font> (default 'ISO-LATIN-1)))
</pre>
</td></tr>
</tbody></table></center>

This class is used to reify player that are run in an external process.
</td></tr>
</tbody></table><br/>
<table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody>
<tr><td><a name="g20666" class="mark"></a><a name="mplayer::musicproc" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody>
<tr><td id="tc20670" align="left" colspan="1"><strong id='bold20668'
>mplayer::musicproc</strong><em id='it20669'
></em></td><td id="tc20671" align="right" colspan="1">Bigloo Multimedia class</td></tr>
</tbody></table>
<center id='center20688'
><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody>
<tr><td bgcolor="#ffffcc"><pre class="prog" id='prog20686'
>(<strong id='bold29695'
>class</strong> mplayer<font color="#00cf00"><strong id='bold29696'
>::musicproc</strong></font>
   (path<font color="#00cf00"><strong id='bold29698'
>::bstring</strong></font> read-only (default <font color="red">&quot;mplayer&quot;</font>))
   (args<font color="#00cf00"><strong id='bold29701'
>::pair-nil</strong></font> read-only (default '(<font color="red">&quot;-vo&quot;</font> <font color="red">&quot;null&quot;</font> <font color="red">&quot;-quiet&quot;</font> <font color="red">&quot;-slave&quot;</font> <font color="red">&quot;-idle&quot;</font>)))
   (ao<font color="#00cf00"><strong id='bold29708'
>::obj</strong></font> read-only (default #unspecified))
   (ac<font color="#00cf00"><strong id='bold29710'
>::obj</strong></font> read-only (default #unspecified)))
</pre>
</td></tr>
</tbody></table></center>

A player based on the external software <code id='code20689'
>MPlayer</code>. Creating such a player
spawns in background a MPlayer process.<br/><br/></td></tr>
</tbody></table><br/>
<table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody>
<tr><td><a name="g20694" class="mark"></a><a name="mpg123::musicproc" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody>
<tr><td id="tc20698" align="left" colspan="1"><strong id='bold20696'
>mpg123::musicproc</strong><em id='it20697'
></em></td><td id="tc20699" align="right" colspan="1">Bigloo Multimedia class</td></tr>
</tbody></table>
<center id='center20710'
><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody>
<tr><td bgcolor="#ffffcc"><pre class="prog" id='prog20708'
>(<strong id='bold29712'
>class</strong> mpg123<font color="#00cf00"><strong id='bold29713'
>::musicproc</strong></font>
   (path<font color="#00cf00"><strong id='bold29715'
>::bstring</strong></font> read-only (default <font color="red">&quot;mpg123&quot;</font>))
   (args<font color="#00cf00"><strong id='bold29718'
>::pair-nil</strong></font> read-only (default '(<font color="red">&quot;--remote&quot;</font>))))
</pre>
</td></tr>
</tbody></table></center>

A player based on the external software <code id='code20711'
>mpg123</code>.<br/><br/></td></tr>
</tbody></table><br/>
<table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody>
<tr><td><a name="g20716" class="mark"></a><a name="mpc::music" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody>
<tr><td id="tc20720" align="left" colspan="1"><strong id='bold20718'
>mpc::music</strong><em id='it20719'
></em></td><td id="tc20721" align="right" colspan="1">Bigloo Multimedia class</td></tr>
</tbody></table>
<center id='center20729'
><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody>
<tr><td bgcolor="#ffffcc"><pre class="prog" id='prog20727'
>(<strong id='bold29721'
>class</strong> mpc<font color="#00cf00"><strong id='bold29722'
>::music</strong></font>
   (hello read-only (default #f))
   (host read-only (default <font color="red">&quot;localhost&quot;</font>))
   (port read-only (default 6600))
   (timeout read-only (default 10008993))
   (prefix (default #f)))
</pre>
</td></tr>
</tbody></table></center>

A MPC client.<br/><br/><ul class="itemize" id='itemize20736'
><li><code id='code20731'
>hello</code>: an optional string written when the connection
is establish with the MPD server.
</li>
<li><code id='code20733'
>prefix</code>: an optional path prefix to be removed from music 
playlist. This is needed because MPD can only play music files registered
in is private database. The file names used by MPD are relative a 
root directory used to fill the database. The <code id='code20734'
>prefix</code> field allows
programmer to write portable code that manages play list file names 
independently of the player selected.
</li>
</ul></td></tr>
</tbody></table><br/>
<table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody>
<tr><td><a name="g20740" class="mark"></a><a name="musicstatus" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody>
<tr><td id="tc20744" align="left" colspan="1"><strong id='bold20742'
>musicstatus</strong><em id='it20743'
></em></td><td id="tc20745" align="right" colspan="1">Bigloo Multimedia class</td></tr>
</tbody></table>
<center id='center20764'
><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody>
<tr><td bgcolor="#ffffcc"><pre class="prog" id='prog20762'
>(<strong id='bold29725'
>class</strong> musicstatus
   (state<font color="#00cf00"><strong id='bold29726'
>::symbol</strong></font> (default 'stop))
   (volume<font color="#00cf00"><strong id='bold29728'
>::obj</strong></font> (default -1))
   (repeat<font color="#00cf00"><strong id='bold29730'
>::bool</strong></font> (default #f))
   (random<font color="#00cf00"><strong id='bold29732'
>::bool</strong></font> (default #f))
   (playlistid<font color="#00cf00"><strong id='bold29734'
>::int</strong></font> (default -1))
   (playlistlength<font color="#00cf00"><strong id='bold29736'
>::int</strong></font> (default 0))
   (xfade<font color="#00cf00"><strong id='bold29738'
>::int</strong></font> (default 0))
   (song<font color="#00cf00"><strong id='bold29740'
>::int</strong></font> (default 0))
   (songid<font color="#00cf00"><strong id='bold29742'
>::int</strong></font> (default 0))
   (songpos (default 0))
   (songlength<font color="#00cf00"><strong id='bold29744'
>::int</strong></font> (default 0))
   (bitrate<font color="#00cf00"><strong id='bold29746'
>::int</strong></font> (default 0))
   (khz<font color="#00cf00"><strong id='bold29748'
>::int</strong></font> (default 0))
   (err<font color="#00cf00"><strong id='bold29750'
>::obj</strong></font> (default #f)))
</pre>
</td></tr>
</tbody></table></center>

The instances of the class <code id='code20765'
>musicstatus</code> denote that state of a 
player.
</td></tr>
</tbody></table><br/>
<table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody>
<tr><td><a name="g20769" class="mark"></a><a name="music-close" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody>
<tr><td id="tc20773" align="left" colspan="1"><strong id='bold20771'
>music-close</strong><em id='it20772'
> music</em></td><td id="tc20774" align="right" colspan="1">Bigloo Multimedia procedure</td></tr>
</tbody></table>
<a name="g20778" class="mark"></a><a name="music-reset!" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody>
<tr><td id="tc20782" align="left" colspan="1"><strong id='bold20780'
>music-reset!</strong><em id='it20781'
> music</em></td><td id="tc20783" align="right" colspan="1">Bigloo Multimedia procedure</td></tr>
</tbody></table>
<a name="g20787" class="mark"></a><a name="music-closed?" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody>
<tr><td id="tc20791" align="left" colspan="1"><strong id='bold20789'
>music-closed?</strong><em id='it20790'
> music</em></td><td id="tc20792" align="right" colspan="1">Bigloo Multimedia procedure</td></tr>
</tbody></table>
Closes, resets, and tests the state of a music player.
</td></tr>
</tbody></table><br/>
<table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody>
<tr><td><a name="g20798" class="mark"></a><a name="music-playlist-get" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody>
<tr><td id="tc20802" align="left" colspan="1"><strong id='bold20800'
>music-playlist-get</strong><em id='it20801'
> music</em></td><td id="tc20803" align="right" colspan="1">Bigloo Multimedia procedure</td></tr>
</tbody></table>
<a name="g20807" class="mark"></a><a name="music-playlist-add!" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody>
<tr><td id="tc20811" align="left" colspan="1"><strong id='bold20809'
>music-playlist-add!</strong><em id='it20810'
> music song</em></td><td id="tc20812" align="right" colspan="1">Bigloo Multimedia procedure</td></tr>
</tbody></table>
<a name="g20816" class="mark"></a><a name="music-playlist-delete!" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody>
<tr><td id="tc20820" align="left" colspan="1"><strong id='bold20818'
>music-playlist-delete!</strong><em id='it20819'
> music int</em></td><td id="tc20821" align="right" colspan="1">Bigloo Multimedia procedure</td></tr>
</tbody></table>
<a name="g20825" class="mark"></a><a name="music-playlist-clear!" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody>
<tr><td id="tc20829" align="left" colspan="1"><strong id='bold20827'
>music-playlist-clear!</strong><em id='it20828'
> music</em></td><td id="tc20830" align="right" colspan="1">Bigloo Multimedia procedure</td></tr>
</tbody></table>
These functions controls the playlist used by a player. <br/><br/>Note: The <code id='code20835'
><em id='it20834'
>song</em></code> argument is an UTF8 encoded string (see
Section <a href="bigloo-7.html#Unicode-(UCS-2)-Strings" class="inbound">Unicode (UCS-2) Strings</a>) <em id='emph20836'
>whatever</em> the local file
system encoding is. The function <code id='code20837'
>music-playlist-get</code> returns a
list of UTF8 encoded names.<br/><br/><ul class="itemize" id='itemize20849'
><li><code id='code20839'
>music-playlist-get</code>: returns the list of songs (UTF8 names) 
 of the current playlist.
</li>
<li><code id='code20841'
>music-playlist-add!</code>: adds an extra song (UTF8 name) at the end 
 of the playlist.
</li>
<li><code id='code20843'
>music-delete!</code>: removes the song number <code id='code20845'
><em id='it20844'
>int</em></code> from the playlist.
</li>
<li><code id='code20847'
>music-clear!</code>: erases the whole playlist.
</li>
</ul></td></tr>
</tbody></table><br/>
<table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody>
<tr><td><a name="g20853" class="mark"></a><a name="music-play" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody>
<tr><td id="tc20857" align="left" colspan="1"><strong id='bold20855'
>music-play</strong><em id='it20856'
> music [song]</em></td><td id="tc20858" align="right" colspan="1">Bigloo Multimedia procedure</td></tr>
</tbody></table>
<a name="g20862" class="mark"></a><a name="music-seek" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody>
<tr><td id="tc20866" align="left" colspan="1"><strong id='bold20864'
>music-seek</strong><em id='it20865'
> music time [song]</em></td><td id="tc20867" align="right" colspan="1">Bigloo Multimedia procedure</td></tr>
</tbody></table>
<a name="g20871" class="mark"></a><a name="music-stop" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody>
<tr><td id="tc20875" align="left" colspan="1"><strong id='bold20873'
>music-stop</strong><em id='it20874'
> music</em></td><td id="tc20876" align="right" colspan="1">Bigloo Multimedia procedure</td></tr>
</tbody></table>
<a name="g20880" class="mark"></a><a name="music-pause" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody>
<tr><td id="tc20884" align="left" colspan="1"><strong id='bold20882'
>music-pause</strong><em id='it20883'
> music</em></td><td id="tc20885" align="right" colspan="1">Bigloo Multimedia procedure</td></tr>
</tbody></table>
<a name="g20889" class="mark"></a><a name="music-next" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody>
<tr><td id="tc20893" align="left" colspan="1"><strong id='bold20891'
>music-next</strong><em id='it20892'
> music</em></td><td id="tc20894" align="right" colspan="1">Bigloo Multimedia procedure</td></tr>
</tbody></table>
<a name="g20898" class="mark"></a><a name="music-prev" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody>
<tr><td id="tc20902" align="left" colspan="1"><strong id='bold20900'
>music-prev</strong><em id='it20901'
> music</em></td><td id="tc20903" align="right" colspan="1">Bigloo Multimedia procedure</td></tr>
</tbody></table>
These functions changes the state of the music player. The function
<code id='code20906'
>music-seek</code> seeks the playback position to the position <code id='code20908'
><em id='it20907'
>time</em></code>, 
which is an integer denoting a number of seconds.
</td></tr>
</tbody></table><br/>
<table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody>
<tr><td><a name="g20912" class="mark"></a><a name="music-crossfade" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody>
<tr><td id="tc20916" align="left" colspan="1"><strong id='bold20914'
>music-crossfade</strong><em id='it20915'
> music int</em></td><td id="tc20917" align="right" colspan="1">Bigloo Multimedia procedure</td></tr>
</tbody></table>
<a name="g20921" class="mark"></a><a name="music-random-set!" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody>
<tr><td id="tc20925" align="left" colspan="1"><strong id='bold20923'
>music-random-set!</strong><em id='it20924'
> music bool</em></td><td id="tc20926" align="right" colspan="1">Bigloo Multimedia procedure</td></tr>
</tbody></table>
<a name="g20930" class="mark"></a><a name="music-repeat-set!" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody>
<tr><td id="tc20934" align="left" colspan="1"><strong id='bold20932'
>music-repeat-set!</strong><em id='it20933'
> music bool</em></td><td id="tc20935" align="right" colspan="1">Bigloo Multimedia procedure</td></tr>
</tbody></table>
These functions controls how songs playback should follow each other.
</td></tr>
</tbody></table><br/>
<table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody>
<tr><td><a name="g20941" class="mark"></a><a name="music-volume-get" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody>
<tr><td id="tc20945" align="left" colspan="1"><strong id='bold20943'
>music-volume-get</strong><em id='it20944'
> music</em></td><td id="tc20946" align="right" colspan="1">Bigloo Multimedia procedure</td></tr>
</tbody></table>
<a name="g20950" class="mark"></a><a name="music-volume-set!" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody>
<tr><td id="tc20954" align="left" colspan="1"><strong id='bold20952'
>music-volume-set!</strong><em id='it20953'
> music vol</em></td><td id="tc20955" align="right" colspan="1">Bigloo Multimedia procedure</td></tr>
</tbody></table>
Get and set the audio volume of a player. Some player use the native mixer
supported by the operating system some others use a software mixer unrelated
to the hardware.
</td></tr>
</tbody></table><br/>
<table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody>
<tr><td><a name="g20961" class="mark"></a><a name="music-status" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody>
<tr><td id="tc20965" align="left" colspan="1"><strong id='bold20963'
>music-status</strong><em id='it20964'
> music</em></td><td id="tc20966" align="right" colspan="1">Bigloo Multimedia procedure</td></tr>
</tbody></table>
<a name="g20970" class="mark"></a><a name="music-update-status!" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody>
<tr><td id="tc20974" align="left" colspan="1"><strong id='bold20972'
>music-update-status!</strong><em id='it20973'
> music status</em></td><td id="tc20975" align="right" colspan="1">Bigloo Multimedia procedure</td></tr>
</tbody></table>
The function <code id='code20978'
>music-status</code> returns an instance of the <code id='code20979'
>musicstatus</code>
class which denotes the state of the player. The function 
<code id='code20980'
>music-update-status!</code> updates this status.
</td></tr>
</tbody></table><br/>
<table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody>
<tr><td><a name="g20984" class="mark"></a><a name="music-song" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody>
<tr><td id="tc20988" align="left" colspan="1"><strong id='bold20986'
>music-song</strong><em id='it20987'
> music</em></td><td id="tc20989" align="right" colspan="1">Bigloo Multimedia procedure</td></tr>
</tbody></table>
<a name="g20993" class="mark"></a><a name="music-songpos" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody>
<tr><td id="tc20997" align="left" colspan="1"><strong id='bold20995'
>music-songpos</strong><em id='it20996'
> music</em></td><td id="tc20998" align="right" colspan="1">Bigloo Multimedia procedure</td></tr>
</tbody></table>
These two functions return the number of the song being played and the 
position in the song. These functions are somehow redundant with the
function <code id='code21001'
>music-status</code> because the status also contains information
about the playback song and playback position. However, for some players
getting the music song and the playback position is cheaper than getting
the whole player status.
</td></tr>
</tbody></table><br/>
<table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody>
<tr><td><a name="g21005" class="mark"></a><a name="music-meta" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody>
<tr><td id="tc21009" align="left" colspan="1"><strong id='bold21007'
>music-meta</strong><em id='it21008'
> music</em></td><td id="tc21010" align="right" colspan="1">Bigloo Multimedia procedure</td></tr>
</tbody></table>
Returns the metadata the current song.
</td></tr>
</tbody></table><br/>
<table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody>
<tr><td><a name="g21016" class="mark"></a><a name="music-reset-error!" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody>
<tr><td id="tc21020" align="left" colspan="1"><strong id='bold21018'
>music-reset-error!</strong><em id='it21019'
> music</em></td><td id="tc21021" align="right" colspan="1">Bigloo Multimedia procedure</td></tr>
</tbody></table>
Reset the previous errors detected by a player.
</td></tr>
</tbody></table><br/>
<table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody>
<tr><td><a name="g21027" class="mark"></a><a name="music-event-loop" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody>
<tr><td id="tc21031" align="left" colspan="1"><strong id='bold21029'
>music-event-loop</strong><em id='it21030'
> music [:onstate] [:onmeta] [:onerror] [:onvolume]</em></td><td id="tc21032" align="right" colspan="1">Bigloo Multimedia procedure</td></tr>
</tbody></table>

The function <code id='code21035'
>music-event-loop</code> enable event notifications when the state
of a player changes. The keyword arguments are:<br/><br/><ul class="itemize" id='itemize21046'
><li><code id='code21037'
>:onstate</code>, a function of one parameter. When the player state 
changes, this function is called with an instance of <code id='code21038'
>musicstatus</code> 
as actual parameter.
</li>
<li><code id='code21040'
>:onmeta</code>, a function of two parameters. This function is
called when a metadata is detected in the music currently played.
</li>
<li><code id='code21042'
>:onerror</code>, a function of one parameter, invoked when an error
is detected.
</li>
<li><code id='code21044'
>:onvolume</code>, a function of one parameter, invoked when the volume
changes.
</li>
</ul>
</td></tr>
</tbody></table><br/><br/><br/></div>
<!-- Music Player Daemon -->
<a name="Music-Player-Daemon"></a>
<div class="subsection-atitle"><table width="100%"><tr><td bgcolor="#ffffff"><h3><font color="#8381de">19.2.4 Music Player Daemon</font>
</h3></td></tr></table>
</div><div class="subsection">
<a name="MPD" class="mark"></a>
Music Player Daemon (MPD in short) allows remote access for playing
music <a href="http://www.musicpd.org">http://www.musicpd.org</a>. MPD is designed for integrating a
computer into a stereo system that provides control for music playback
over a local network. The Bigloo class <code id='code21050'
>mpc</code> implements a <code id='code21051'
>mpd</code>
client. All Bigloo players can be access via the MPD protocol, using the<br/><br/>The following example shows how to access a MPlayer music player using the
MPD protocol with a simple Bigloo program:<br/><br/><center id='center21075'
><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody>
<tr><td bgcolor="#ffffcc"><pre class="prog" id='prog21073'
>(<font color="#1919af"><strong id='bold29752'
>module</strong></font> <font color="#1919af"><strong id='bold29754'
>mpd</strong></font>
   (<font color="#1919af"><strong id='bold29756'
>library</strong></font> <font color="#1919af"><strong id='bold29758'
>multimedia</strong></font> pthread)
   (main main))
   
(<font color="#6959cf"><strong id='bold29760'
>define</strong></font> (<font color="#6959cf"><strong id='bold29762'
>main</strong></font> argv)
   (<strong id='bold29764'
>let</strong> ((db (<strong id='bold29765'
>instantiate</strong><font color="#00cf00"><strong id='bold29766'
>::mpd-database</strong></font>
		(directories (cdr argv))))
	 (serv (make-server-socket 6600))
	 (music (<strong id='bold29768'
>instantiate</strong><font color="#00cf00"><strong id='bold29769'
>::mplayer</strong></font>)))
      (<strong id='bold29771'
>let</strong> loop ()
	 (<font color="#ad4386"><strong id='bold29772'
>thread-start!</strong></font> (make-mpd-connection-thread music db sock))
	 (loop))))<br/><br/>(<font color="#6959cf"><strong id='bold29774'
>define</strong></font> (<font color="#6959cf"><strong id='bold29776'
>make-mpd-connection-thread</strong></font> music db sock)
   (<strong id='bold29778'
>instantiate</strong><font color="#00cf00"><strong id='bold29779'
>::pthread</strong></font>
      (body (<strong id='bold29781'
>lambda</strong> ()
	       (<strong id='bold29782'
>let</strong> ((pi (socket-input sock))
		     (po (socket-output sock)))
		  (input-timeout-set! pi 10000)
		  (output-timeout-set! po 10000)
		  (<font color="red"><strong id='bold29783'
>unwind-protect</strong></font>
		     (mpd music pi po db)
		     (socket-close sock)))))))
</pre>
</td></tr>
</tbody></table></center>

<table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody>
<tr><td><a name="g21077" class="mark"></a><a name="mpd" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody>
<tr><td id="tc21081" align="left" colspan="1"><strong id='bold21079'
>mpd</strong><em id='it21080'
> music input-port output-port database [:log]</em></td><td id="tc21082" align="right" colspan="1">Bigloo Multimedia procedure</td></tr>
</tbody></table>
The function <code id='code21085'
>mpd</code> implements a MPD server. It reads commands from the
<code id='code21087'
><em id='it21086'
>input-port</em></code> and write results to <code id='code21089'
><em id='it21088'
>output-port</em></code>. The argument
<code id='code21091'
><em id='it21090'
>database</em></code>, an instance of the <code id='code21092'
>mpd-database</code> class, describes the
music material that can be delivered by this player.<br/><br/></td></tr>
</tbody></table><br/>
<table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody>
<tr><td><a name="g21097" class="mark"></a><a name="mpd-database" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody>
<tr><td id="tc21101" align="left" colspan="1"><strong id='bold21099'
>mpd-database</strong><em id='it21100'
></em></td><td id="tc21102" align="right" colspan="1">Bigloo Multimedia class</td></tr>
</tbody></table>
<center id='center21109'
><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody>
<tr><td bgcolor="#ffffcc"><pre class="prog" id='prog21107'
>(<strong id='bold29785'
>class</strong> mpd-database
   (directories<font color="#00cf00"><strong id='bold29786'
>::pair-nil</strong></font> read-only)
</pre>
</td></tr>
</tbody></table></center>

The field <code id='code21110'
>directories</code> contains the list of the directories that contains
music files.
</td></tr>
</tbody></table><br/><br/><br/><br/><br/><br/><br/> 

</div>
</div><br>
</div></td>
</tr></table><div class="skribe-ending">
<hr> 
<p class="ending" id='paragraph29793'
><font size="-1">
This <span class="sc">Html</span> page has been produced by 
<a href="http://www.inria.fr/mimosa/fp/Skribe" class="http">Skribe</a>.
<br/>
Last update <em id='it29791'
>Tue Jun  2 11:43:27 2009</em>.</font></p></div>
</body>
</html>