Sophie

Sophie

distrib > Mageia > 5 > i586 > media > core-release > by-pkgid > 406d9b580cc28afca9442eab7324087d > files > 208

libalsa2-docs-1.0.28-1.mga5.noarch.rpm

<!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"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.7"/>
<title>ALSA project - the C library reference: RawMidi interface</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">ALSA project - the C library reference
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.7 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li class="current"><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;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">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.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)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </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">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark">&#160;</span>Pages</a></div>

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

</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">RawMidi interface </div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><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>
<h1><a class="anchor" id="rawmidi_general_overview"></a>
General overview</h1>
<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>
<h1><a class="anchor" id="rawmidi_open"></a>
Open handling</h1>
<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>
<h2><a class="anchor" id="rawmidi_open_nonblock"></a>
Nonblocking open (flag)</h2>
<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>
<h2><a class="anchor" id="rawmidi_open_append"></a>
Append open (flag)</h2>
<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 writing application might break the MIDI message in the output buffer.</p>
<h2><a class="anchor" id="rawmidi_open_sync"></a>
Sync open (flag)</h2>
<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 '<a class="el" href="group___raw_midi.html#ga0a30e482efec57f4ea74c533a0f9b134" title="write MIDI bytes to MIDI stream ">snd_rawmidi_write()</a> 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>
<h2><a class="anchor" id="rawmidi_io"></a>
I/O handling</h2>
<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>
<h2><a class="anchor" id="rawmidi_dev_names"></a>
RawMidi naming conventions</h2>
<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>
<h2><a class="anchor" id="rawmidi_dev_names_default"></a>
rawmidi_dev_names_default</h2>
<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"><div class="line"><span class="keywordflow">default</span></div>
</div><!-- fragment --><h2><a class="anchor" id="rawmidi_dev_names_hw"></a>
HW device</h2>
<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"><div class="line">hw</div>
<div class="line">hw:0</div>
<div class="line">hw:0,0</div>
<div class="line">hw:supersonic,1</div>
<div class="line">hw:soundwave,1,2</div>
<div class="line">hw:DEV=1,CARD=soundwave,SUBDEV=2</div>
</div><!-- fragment --><h1><a class="anchor" id="rawmidi_examples"></a>
Examples</h1>
<p>The full featured examples with cross-links:</p>
<dl class="section user"><dt>Simple input/output test program</dt><dd><a class="el" href="/home/iurt/rpmbuild/BUILD/alsa-lib-1.0.28/src/rawmidi/rawmidi.c.html#example_test_rawmidi">example code</a> </dd></dl>
<dl class="section user"><dt></dt><dd>This example shows open and read/write rawmidi operations.</dd></dl>
<h1><a class="anchor" id="rawmidi_virt"></a>
Virtual RawMidi interface</h1>
<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"><div class="line"><a class="code" href="group___raw_midi.html#ga2ab783051deeb7eb37eb568b76448889">snd_rawmidi_open</a>(&amp;read_handle, &amp;write_handle, <span class="stringliteral">&quot;virtual&quot;</span>, 0);</div>
</div><!-- fragment --> </div></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Wed Jun 18 2014 05:47:49 for ALSA project - the C library reference by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.7
</small></address>
</body>
</html>