Sophie

Sophie

distrib > Mandriva > 2010.1 > i586 > by-pkgid > 34546d63baef3ab2a7675f37737b66ab > files > 175

libalsa2-docs-1.0.23-2.1mdv2010.1.i586.rpm

<!-- This comment will put IE 6, 7 and 8 in quirks mode -->
<!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/xhtml;charset=UTF-8"/>
<title>ALSA project - the C library reference: RawMidi interface</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javaScript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body onload='searchBox.OnSelectItem(0);'>
<!-- Generated by Doxygen 1.6.3 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'Search');
--></script>
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li class="current"><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <img id="MSearchSelect" src="search/search.png"
             onmouseover="return searchBox.OnSearchSelectShow()"
             onmouseout="return searchBox.OnSearchSelectHide()"
             alt=""/>
        <input type="text" id="MSearchField" value="Search" accesskey="S"
             onfocus="searchBox.OnSearchFieldFocus(true)" 
             onblur="searchBox.OnSearchFieldFocus(false)" 
             onkeyup="searchBox.OnSearchFieldChange(event)"/>
        <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
        </div>
      </li>
    </ul>
  </div>
</div>
<div class="contents">


<h1><a class="anchor" id="rawmidi">RawMidi interface </a></h1><p>RawMidi Interface is designed to write or read raw (unchanged) MIDI data over the MIDI line without any timestamps defined in interface. MIDI stands Musical Instrument Digital Interface and more information about this standard can be found at <a href="http://www.midi.org.">http://www.midi.org.</a></p>
<h2><a class="anchor" id="rawmidi_general_overview">
General overview</a></h2>
<p>The rawmidi implementation uses ring buffers to store outgoing and incoming MIDI stream. The buffer size is tunable and drivers report underruns for incoming stream as well.</p>
<h2><a class="anchor" id="rawmidi_open">
Open handling</a></h2>
<p>RawMidi devices are opened exclusively for a selected direction. While more than one process may not open a given MIDI device in the same direction simultaneously, separate processes may open a single MIDI device in different directions (i.e. process one opens a MIDI device in write direction and process two opens the same device in read direction).</p>
<h3><a class="anchor" id="rawmidi_open_nonblock">
Nonblocking open (flag)</a></h3>
<p>Using <a class="el" href="group___raw_midi.html#ga31ee35659c82272382ccc3014c8a73f8">SND_RAWMIDI_NONBLOCK</a> flag for <a class="el" href="group___raw_midi.html#ga2ab783051deeb7eb37eb568b76448889" title="Opens a new connection to the RawMidi interface.">snd_rawmidi_open()</a> or <a class="el" href="group___raw_midi.html#gaa7e3daf5cf4dd36b2534d2f1d6309477" title="Opens a new connection to the RawMidi interface using local configuration.">snd_rawmidi_open_lconf()</a> instruct device driver to return the -EBUSY error when device is already occupied with another application. This flag also changes behaviour of <a class="el" href="group___raw_midi.html#ga0a30e482efec57f4ea74c533a0f9b134" title="write MIDI bytes to MIDI stream">snd_rawmidi_write()</a> and <a class="el" href="group___raw_midi.html#ga9b0952fc04facda83cdf1521325ca475" title="read MIDI bytes from MIDI stream">snd_rawmidi_read()</a> returning -EAGAIN when no more bytes can be processed.</p>
<p>Note: In opposite (default) behaviour, application is blocked until device resources are free.</p>
<h3><a class="anchor" id="rawmidi_open_append">
Append open (flag)</a></h3>
<p>Using <a class="el" href="group___raw_midi.html#ga7060640f32abcd337239bde2c8749d23">SND_RAWMIDI_APPEND</a> flag (output only) instruct device driver to append contents of written buffer - passed by <a class="el" href="group___raw_midi.html#ga0a30e482efec57f4ea74c533a0f9b134" title="write MIDI bytes to MIDI stream">snd_rawmidi_write()</a> - atomically to output ring buffer in the kernel space. This flag also means that device is not opened exclusively, so more applications can share given rawmidi device. Note that applications must send the whole MIDI message including the running status, because another writting application might break the MIDI message in the output buffer.</p>
<h3><a class="anchor" id="rawmidi_open_sync">
Sync open (flag)</a></h3>
<p>Using <a class="el" href="group___raw_midi.html#gab1a659b38e5174d790d5671739995894">SND_RAWMIDI_SYNC</a> flag (output only) assures that the contents of output buffer specified using <a class="el" href="group___raw_midi.html#ga0a30e482efec57f4ea74c533a0f9b134" title="write MIDI bytes to MIDI stream">snd_rawmidi_write()</a> is always drained before the function exits. This behaviour is same like 'snd_rawmidi_write() followed by <a class="el" href="group___raw_midi.html#gabfff7417ec957b7ee07882f91d73d7be" title="drain all bytes in the rawmidi I/O ring buffer">snd_rawmidi_drain()</a> immediately'.</p>
<h3><a class="anchor" id="rawmidi_io">
I/O handling</a></h3>
<p>There is only standard read/write access to device internal ring buffer. Use <a class="el" href="group___raw_midi.html#ga9b0952fc04facda83cdf1521325ca475" title="read MIDI bytes from MIDI stream">snd_rawmidi_read()</a> and <a class="el" href="group___raw_midi.html#ga0a30e482efec57f4ea74c533a0f9b134" title="write MIDI bytes to MIDI stream">snd_rawmidi_write()</a> functions to obtain / write MIDI bytes.</p>
<h3><a class="anchor" id="rawmidi_dev_names">
RawMidi naming conventions</a></h3>
<p>The ALSA library uses a generic string representation for names of devices. The devices might be virtual, physical or a mix of both. The generic string is passed to <a class="el" href="group___raw_midi.html#ga2ab783051deeb7eb37eb568b76448889">::snd_rawmidi_open()</a> or <a class="el" href="group___raw_midi.html#gaa7e3daf5cf4dd36b2534d2f1d6309477">::snd_rawmidi_open_lconf()</a>. It contains two parts: device name and arguments. Devices and arguments are described in configuration files. The usual place for default definitions is at /usr/share/alsa/alsa.conf.</p>
<h3><a class="anchor" id="rawmidi_dev_names_default">
rawmidi_dev_names_default</a></h3>
<p>The default device is equal to hw device. The defaults are used:</p>
<p>defaults.rawmidi.card 0 defaults.rawmidi.device 0 defaults.rawmidi.subdevice -1</p>
<p>These defaults can be freely overwritten in local configuration files.</p>
<p>Example:</p>
<div class="fragment"><pre class="fragment"><span class="keywordflow">default</span>
</pre></div><h3><a class="anchor" id="rawmidi_dev_names_hw">
HW device</a></h3>
<p>The hw device description uses the hw plugin. The three arguments (in order: CARD,DEV,SUBDEV) specify card number or identifier, device number and subdevice number (-1 means any).</p>
<p>Example:</p>
<div class="fragment"><pre class="fragment">hw
hw:0
hw:0,0
hw:supersonic,1
hw:soundwave,1,2
hw:DEV=1,CARD=soundwave,SUBDEV=2
</pre></div><h2><a class="anchor" id="rawmidi_examples">
Examples</a></h2>
<p>The full featured examples with cross-links:</p>
<dl class="user"><dt><b>Simple input/output test program</b></dt><dd><a class="el" href="/home/qateam/rpm/BUILD/alsa-lib-1.0.23/src/rawmidi/rawmidi.c.html#example_test_rawmidi">example code</a> </dd></dl>
<dl class="user"><dt><b></b></dt><dd>This example shows open and read/write rawmidi operations.</dd></dl>
<h2><a class="anchor" id="rawmidi_virt">
Virtual RawMidi interface</a></h2>
<p>The "virtual" plugin creates a virtual RawMidi instance on the ALSA sequencer, which can be accessed through the connection of the sequencer ports. There is no connection established as default.</p>
<p>For creating a virtual RawMidi instance, pass "virtual" as its name at creation.</p>
<p>Example: </p>
<div class="fragment"><pre class="fragment"><a class="code" href="group___raw_midi.html#ga2ab783051deeb7eb37eb568b76448889" title="Opens a new connection to the RawMidi interface.">snd_rawmidi_open</a>(&amp;read_handle, &amp;write_handle, <span class="stringliteral">&quot;virtual&quot;</span>, 0);
</pre></div> </div>
<!--- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&nbsp;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&nbsp;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&nbsp;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&nbsp;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&nbsp;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&nbsp;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&nbsp;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&nbsp;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&nbsp;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<hr class="footer"/><address style="text-align: right;"><small>Generated on Sat Nov 20 07:42:24 2010 for ALSA project - the C library reference by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>