Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / src / nas,5.n2.os.2 / lib / python / html / python / lib / module-ossaudiodev.html
CommitLineData
86530b38
AT
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<html>
3<head>
4<link rel="STYLESHEET" href="lib.css" type='text/css' />
5<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
6<link rel='start' href='../index.html' title='Python Documentation Index' />
7<link rel="first" href="lib.html" title='Python Library Reference' />
8<link rel='contents' href='contents.html' title="Contents" />
9<link rel='index' href='genindex.html' title='Index' />
10<link rel='last' href='about.html' title='About this document...' />
11<link rel='help' href='about.html' title='About this document...' />
12<link rel="prev" href="module-sndhdr.html" />
13<link rel="parent" href="mmedia.html" />
14<link rel="next" href="ossaudio-device-objects.html" />
15<meta name='aesop' content='information' />
16<title>14.11 ossaudiodev -- Access to OSS-compatible audio devices</title>
17</head>
18<body>
19<DIV CLASS="navigation">
20<div id='top-navigation-panel' xml:id='top-navigation-panel'>
21<table align="center" width="100%" cellpadding="0" cellspacing="2">
22<tr>
23<td class='online-navigation'><a rel="prev" title="14.10 sndhdr "
24 href="module-sndhdr.html"><img src='../icons/previous.png'
25 border='0' height='32' alt='Previous Page' width='32' /></A></td>
26<td class='online-navigation'><a rel="parent" title="14. Multimedia Services"
27 href="mmedia.html"><img src='../icons/up.png'
28 border='0' height='32' alt='Up One Level' width='32' /></A></td>
29<td class='online-navigation'><a rel="next" title="14.11.1 Audio Device Objects"
30 href="ossaudio-device-objects.html"><img src='../icons/next.png'
31 border='0' height='32' alt='Next Page' width='32' /></A></td>
32<td align="center" width="100%">Python Library Reference</td>
33<td class='online-navigation'><a rel="contents" title="Table of Contents"
34 href="contents.html"><img src='../icons/contents.png'
35 border='0' height='32' alt='Contents' width='32' /></A></td>
36<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
37 border='0' height='32' alt='Module Index' width='32' /></a></td>
38<td class='online-navigation'><a rel="index" title="Index"
39 href="genindex.html"><img src='../icons/index.png'
40 border='0' height='32' alt='Index' width='32' /></A></td>
41</tr></table>
42<div class='online-navigation'>
43<b class="navlabel">Previous:</b>
44<a class="sectref" rel="prev" href="module-sndhdr.html">14.10 sndhdr </A>
45<b class="navlabel">Up:</b>
46<a class="sectref" rel="parent" href="mmedia.html">14. Multimedia Services</A>
47<b class="navlabel">Next:</b>
48<a class="sectref" rel="next" href="ossaudio-device-objects.html">14.11.1 Audio Device Objects</A>
49</div>
50<hr /></div>
51</DIV>
52<!--End of Navigation Panel-->
53
54<H1><A NAME="SECTION00161100000000000000000">
5514.11 <tt class="module">ossaudiodev</tt> --
56 Access to OSS-compatible audio devices</A>
57</H1>
58
59<P>
60<A NAME="module-ossaudiodev"></A>
61<p class="availability">Availability: <span
62 class="platform">Linux, FreeBSD</span>.</p>
63
64<P>
65
66<span class="versionnote">New in version 2.3.</span>
67
68<P>
69This module allows you to access the OSS (Open Sound System) audio
70interface. OSS is available for a wide range of open-source and
71commercial Unices, and is the standard audio interface for Linux and
72recent versions of FreeBSD.
73
74<P>
75<div class="seealso">
76 <p class="heading">See Also:</p>
77
78<dl compact="compact" class="seetitle">
79 <dt><em class="citetitle"><a href="http://www.opensound.com/pguide/oss.pdf"
80 >Open Sound System Programmer's Guide</a></em></dt>
81 <dd>the official
82 documentation for the OSS C API</dd>
83 </dl>
84<div class="seetext"><p>The module defines a large number of constants supplied by
85 the OSS device driver; see <code>&lt;sys/soundcard.h&gt;</code> on either
86 Linux or FreeBSD for a listing .</p></div>
87</div>
88
89<P>
90<tt class="module">ossaudiodev</tt> defines the following variables and functions:
91
92<P>
93<dl><dt><b><span class="typelabel">exception</span>&nbsp;<tt id='l2h-4770' xml:id='l2h-4770' class="exception">OSSAudioError</tt></b></dt>
94<dd>
95This exception is raised on certain errors. The argument is a string
96describing what went wrong.
97
98<P>
99(If <tt class="module">ossaudiodev</tt> receives an error from a system call such as
100<tt class="cfunction">open()</tt>, <tt class="cfunction">write()</tt>, or <tt class="cfunction">ioctl()</tt>, it
101raises <tt class="exception">IOError</tt>. Errors detected directly by
102<tt class="module">ossaudiodev</tt> result in <tt class="exception">OSSAudioError</tt>.)
103
104<P>
105(For backwards compatibility, the exception class is also available as
106<code>ossaudiodev.error</code>.)
107</dd></dl>
108
109<P>
110<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
111 <td><nobr><b><tt id='l2h-4771' xml:id='l2h-4771' class="function">open</tt></b>(</nobr></td>
112 <td><var></var><big>[</big><var>device, </var><big>]</big><var>mode</var>)</td></tr></table></dt>
113<dd>
114Open an audio device and return an OSS audio device object. This
115object supports many file-like methods, such as <tt class="method">read()</tt>,
116<tt class="method">write()</tt>, and <tt class="method">fileno()</tt> (although there are subtle
117differences between conventional Unix read/write semantics and those of
118OSS audio devices). It also supports a number of audio-specific
119methods; see below for the complete list of methods.
120
121<P>
122<var>device</var> is the audio device filename to use. If it is not
123specified, this module first looks in the environment variable
124<a class="envvar" id='l2h-4773' xml:id='l2h-4773'>AUDIODEV</a> for a device to use. If not found, it falls back to
125<span class="file">/dev/dsp</span>.
126
127<P>
128<var>mode</var> is one of <code>'r'</code> for read-only (record) access,
129<code>'w'</code> for write-only (playback) access and <code>'rw'</code> for both.
130Since many sound cards only allow one process to have the recorder or
131player open at a time, it is a good idea to open the device only for the
132activity needed. Further, some sound cards are half-duplex: they can be
133opened for reading or writing, but not both at once.
134
135<P>
136Note the unusual calling syntax: the <em>first</em> argument is optional,
137and the second is required. This is a historical artifact for
138compatibility with the older <tt class="module">linuxaudiodev</tt> module which
139<tt class="module">ossaudiodev</tt> supersedes. </dl>
140
141<P>
142<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
143 <td><nobr><b><tt id='l2h-4772' xml:id='l2h-4772' class="function">openmixer</tt></b>(</nobr></td>
144 <td><var></var><big>[</big><var>device</var><big>]</big><var></var>)</td></tr></table></dt>
145<dd>
146Open a mixer device and return an OSS mixer device object.
147<var>device</var> is the mixer device filename to use. If it is
148not specified, this module first looks in the environment variable
149<a class="envvar" id='l2h-4774' xml:id='l2h-4774'>MIXERDEV</a> for a device to use. If not found, it falls back to
150<span class="file">/dev/mixer</span>.
151
152<P>
153</dl>
154
155<P>
156
157<p><br /></p><hr class='online-navigation' />
158<div class='online-navigation'>
159<!--Table of Child-Links-->
160<A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></a>
161
162<UL CLASS="ChildLinks">
163<LI><A href="ossaudio-device-objects.html">14.11.1 Audio Device Objects</a>
164<LI><A href="mixer-device-objects.html">14.11.2 Mixer Device Objects</a>
165</ul>
166<!--End of Table of Child-Links-->
167</div>
168
169<DIV CLASS="navigation">
170<div class='online-navigation'>
171<p></p><hr />
172<table align="center" width="100%" cellpadding="0" cellspacing="2">
173<tr>
174<td class='online-navigation'><a rel="prev" title="14.10 sndhdr "
175 href="module-sndhdr.html"><img src='../icons/previous.png'
176 border='0' height='32' alt='Previous Page' width='32' /></A></td>
177<td class='online-navigation'><a rel="parent" title="14. Multimedia Services"
178 href="mmedia.html"><img src='../icons/up.png'
179 border='0' height='32' alt='Up One Level' width='32' /></A></td>
180<td class='online-navigation'><a rel="next" title="14.11.1 Audio Device Objects"
181 href="ossaudio-device-objects.html"><img src='../icons/next.png'
182 border='0' height='32' alt='Next Page' width='32' /></A></td>
183<td align="center" width="100%">Python Library Reference</td>
184<td class='online-navigation'><a rel="contents" title="Table of Contents"
185 href="contents.html"><img src='../icons/contents.png'
186 border='0' height='32' alt='Contents' width='32' /></A></td>
187<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
188 border='0' height='32' alt='Module Index' width='32' /></a></td>
189<td class='online-navigation'><a rel="index" title="Index"
190 href="genindex.html"><img src='../icons/index.png'
191 border='0' height='32' alt='Index' width='32' /></A></td>
192</tr></table>
193<div class='online-navigation'>
194<b class="navlabel">Previous:</b>
195<a class="sectref" rel="prev" href="module-sndhdr.html">14.10 sndhdr </A>
196<b class="navlabel">Up:</b>
197<a class="sectref" rel="parent" href="mmedia.html">14. Multimedia Services</A>
198<b class="navlabel">Next:</b>
199<a class="sectref" rel="next" href="ossaudio-device-objects.html">14.11.1 Audio Device Objects</A>
200</div>
201</div>
202<hr />
203<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
204</DIV>
205<!--End of Navigation Panel-->
206<ADDRESS>
207See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
208</ADDRESS>
209</BODY>
210</HTML>