Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > media > updates > by-pkgid > 18785641029f14f23cccc82925607ace > files > 115

libalsa2-docs-0.9.0-0.14rc7.1mdk.ppc.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>RawMidi interface</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.2.18 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="modules.html">Modules</a> &nbsp; <a class="qindex" href="annotated.html">Data Structures</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Data Fields</a> &nbsp; <a class="qindex" href="globals.html">Globals</a> &nbsp; <a class="qindex" href="pages.html">Related Pages</a> &nbsp; <a class="qindex" href="examples.html">Examples</a> &nbsp; </center>
<hr><h1><a name="rawmidi">RawMidi interface</a>
</h1>
<p>

<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 name="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 name="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 name="rawmidi_open_nonblock">Nonblocking open (flag)</a>
</h3>
<p>
Using <a class="el" href="group___raw_midi.html#a60">SND_RAWMIDI_NONBLOCK</a> flag for <a class="el" href="group___raw_midi.html#a6">snd_rawmidi_open()</a> or <a class="el" href="group___raw_midi.html#a7">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#a53">snd_rawmidi_write()</a> and <a class="el" href="group___raw_midi.html#a54">snd_rawmidi_read()</a> returning -EAGAIN when no more bytes can be processed.
<p>
Note: In opposite (default) behaviour, application is blocked until device resources are free.
<p>
<h3><a name="rawmidi_open_append">Append open (flag)</a>
</h3>
<p>
Using <a class="el" href="group___raw_midi.html#a59">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#a53">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.
<p>
<h3><a name="rawmidi_open_sync">Sync open (flag)</a>
</h3>
<p>
Using <a class="el" href="group___raw_midi.html#a61">SND_RAWMIDI_SYNC</a> flag (output only) assures that the contents of output buffer specified using <a class="el" href="group___raw_midi.html#a53">snd_rawmidi_write()</a> is always drained before the function exits. This behaviour is same like '<a class="el" href="group___raw_midi.html#a53">snd_rawmidi_write()</a> followed by <a class="el" href="group___raw_midi.html#a51">snd_rawmidi_drain()</a> immediately'.
<p>
<h3><a name="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#a54">snd_rawmidi_read()</a> and <a class="el" href="group___raw_midi.html#a53">snd_rawmidi_write()</a> functions to obtain / write MIDI bytes.
<p>
<h3><a name="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#a6">snd_rawmidi_open()</a> or <a class="el" href="group___raw_midi.html#a7">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 name="rawmidi_dev_names_default"></a>
</h3>
<p>
The default device is equal to hw device. The defaults are used:
<p>
defaults.rawmidi.card 0 defaults.rawmidi.device 0 defaults.rawmidi.subdevice -1
<p>
These defaults can be freely overwritten in local configuration files.
<p>
Example:
<p>
<div class="fragment"><pre><span class="keywordflow">default</span>
</pre></div>
<p>
<h3><a name="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>
Example:
<p>
<div class="fragment"><pre>hw
hw:0
hw:0,0
hw:supersonic,1
hw:soundwave,1,2
hw:DEV=1,CARD=soundwave,SUBDEV=2
</pre></div>
<p>
<h2><a name="rawmidi_examples">Examples</a>
</h2>
<p>
The full featured examples with cross-links:<dl compact><dt><b>Simple input/output test program</b></dt><dd>
<a class="el" href="_2test_2rawmidi_8c-example.html#example_test_rawmidi">example code</a> 
<p>
This example shows open and read/write rawmidi operations.</dl><hr><address style="align: right;"><small>Generated on Wed Apr 2 16:06:36 2003 for ALSA project - the C library reference by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 
width=110 height=53></a>1.2.18 </small></address>
</body>
</html>