Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
4d7c1f16
Commit
4d7c1f16
authored
May 05, 2004
by
Greg Ward
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SF #814606: merge from release23-maint branch: clarify/cleanup
mixer docs; trim \platform{}, add \versionadded{}.
parent
6d87695b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
25 deletions
+27
-25
Doc/lib/libossaudiodev.tex
Doc/lib/libossaudiodev.tex
+27
-25
No files found.
Doc/lib/libossaudiodev.tex
View file @
4d7c1f16
...
...
@@ -2,9 +2,11 @@
Access to OSS-compatible audio devices
}
\declaremodule
{
builtin
}{
ossaudiodev
}
\platform
{
Linux, FreeBSD
, maybe other Unix-like systems
}
\platform
{
Linux, FreeBSD
}
\modulesynopsis
{
Access to OSS-compatible audio devices.
}
\versionadded
{
2.3
}
This module allows you to access the OSS (Open Sound System) audio
interface. OSS is available for a wide range of open-source and
commercial Unices, and is the standard audio interface for Linux and
...
...
@@ -289,7 +291,7 @@ buffer to be played without blocking.
\subsection
{
Mixer Device Objects
\label
{
mixer-device-objects
}}
File-like interface
The mixer object provides two file-like methods:
\begin{methoddesc}
[mixer device]
{
close
}{}
This method closes the open mixer device file. Any further attempts to
...
...
@@ -300,38 +302,38 @@ use the mixer after this file is closed will raise an IOError.
Returns the file handle number of the open mixer device file.
\end{methoddesc}
Mixer interface
The remaining methods are specific to audio mixing:
\begin{methoddesc}
[mixer device]
{
controls
}{}
This method returns a bitmask specifying the available mixer controls
(``Control'' being a specific mixable ``channel'', such as
\constant
{
SOUND
_
MIXER
_
PCM
}
or
\constant
{
SOUND
_
MIXER
_
SYNTH
}
). This
bitmask indicates a subset of all available mixer c
hanne
ls---the
bitmask indicates a subset of all available mixer c
ontro
ls---the
\constant
{
SOUND
_
MIXER
_
*
}
constants defined at module level. To determine if,
for example, the current mixer object supports a PCM mixer, use the
following Python code:
\begin{verbatim}
mixer=ossaudiodev.openmixer()
if mixer.c
hanne
ls()
&
(1 << ossaudiodev.SOUND
_
MIXER
_
PCM):
# PCM is supported
<code>
if mixer.c
ontro
ls()
&
(1 << ossaudiodev.SOUND
_
MIXER
_
PCM):
# PCM is supported
... code ...
\end{verbatim}
For most purposes, the
\constant
{
SOUND
_
MIXER
_
VOLUME
}
(
M
aster volume) and
\constant
{
SOUND
_
MIXER
_
PCM
}
c
hanne
ls should suffice---but code that uses the
mixer should be flexible when it comes to choosing
sound channe
ls. On
For most purposes, the
\constant
{
SOUND
_
MIXER
_
VOLUME
}
(
m
aster volume) and
\constant
{
SOUND
_
MIXER
_
PCM
}
c
ontro
ls should suffice---but code that uses the
mixer should be flexible when it comes to choosing
mixer contro
ls. On
the Gravis Ultrasound, for example,
\constant
{
SOUND
_
MIXER
_
VOLUME
}
does not
exist.
\end{methoddesc}
\begin{methoddesc}
[mixer device]
{
stereocontrols
}{}
Returns a bitmask indicating stereo mixer c
hanne
ls. If a bit is set,
the corresponding c
hannel is stereo; if it is unset, the channe
l is
Returns a bitmask indicating stereo mixer c
ontro
ls. If a bit is set,
the corresponding c
ontrol is stereo; if it is unset, the contro
l is
either monophonic or not supported by the mixer (use in combination with
\method
{
c
hanne
ls()
}
to determine which).
\method
{
c
ontro
ls()
}
to determine which).
See the code example for the
\method
{
c
hanne
ls()
}
function for an example
See the code example for the
\method
{
c
ontro
ls()
}
function for an example
of getting data from a bitmask.
\end{methoddesc}
...
...
@@ -341,30 +343,30 @@ record. See the code example for \method{controls()} for an example of
reading from a bitmask.
\end{methoddesc}
\begin{methoddesc}
[mixer device]
{
get
}{
c
hanne
l
}
Returns the volume of a given mixer c
hanne
l. The returned volume is a
\begin{methoddesc}
[mixer device]
{
get
}{
c
ontro
l
}
Returns the volume of a given mixer c
ontro
l. The returned volume is a
2-tuple
\code
{
(left
_
volume,right
_
volume)
}
. Volumes are specified as
numbers from 0 (silent) to 100 (full volume). If the c
hanne
l is
monophonic, a 2-tuple is still returned, but both
channel
volumes are
numbers from 0 (silent) to 100 (full volume). If the c
ontro
l is
monophonic, a 2-tuple is still returned, but both volumes are
the same.
If an unknown channel is specified,
\exception
{
error
}
is raised.
Raises
\exception
{
OSSAudioError
}
if an invalid control was is specified,
or
\exception
{
IOError
}
if an unsupported control is specified.
\end{methoddesc}
\begin{methoddesc}
[mixer device]
{
set
}{
c
hanne
l, (left, right)
}
Sets the volume for a given mixer c
hanne
l to
\code
{
(left,right)
}
.
\begin{methoddesc}
[mixer device]
{
set
}{
c
ontro
l, (left, right)
}
Sets the volume for a given mixer c
ontro
l to
\code
{
(left,right)
}
.
\code
{
left
}
and
\code
{
right
}
must be ints and between 0 (silent) and 100
(full volume). On success, the new volume is returned as a 2-tuple.
Note that this may not be exactly the same as the volume specified,
because of the limited resolution of some soundcard's mixers.
Raises
\exception
{
IOError
}
if an invalid mixer channel was specified;
\exception
{
TypeError
}
if the argument format was incorrect, and
\exception
{
error
}
if the specified volumes were out-of-range.
Raises
\exception
{
OSSAudioError
}
if an invalid mixer control was
specified, or if the specified volumes were out-of-range.
\end{methoddesc}
\begin{methoddesc}
[mixer device]
{
get
_
recsrc
}{}
This method returns a bitmask indicating which c
hannel or channels
are
This method returns a bitmask indicating which c
ontrol(s)
are
currently being used as a recording source.
\end{methoddesc}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment