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
451a7669
Commit
451a7669
authored
May 26, 2003
by
Greg Ward
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More wordsmithing and cleanup.
parent
9592fe9a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
30 deletions
+27
-30
Doc/lib/libossaudiodev.tex
Doc/lib/libossaudiodev.tex
+27
-30
No files found.
Doc/lib/libossaudiodev.tex
View file @
451a7669
...
...
@@ -74,9 +74,9 @@ specified, this module first looks in the environment variable
\var
{
mode
}
is one of
\code
{
'r'
}
for read-only (record) access,
\code
{
'w'
}
for write-only (playback) access and
\code
{
'rw'
}
for both.
Since many soundcards only allow one process to have the recorder or
player open at a time it is a good idea to open the device only for the
activity needed. Further, some soundcards are half-duplex: they can be
Since many sound
cards only allow one process to have the recorder or
player open at a time
,
it is a good idea to open the device only for the
activity needed. Further, some sound
cards are half-duplex: they can be
opened for reading or writing, but not both at once.
Note the unusual calling syntax: the
\emph
{
first
}
argument is optional,
...
...
@@ -109,7 +109,7 @@ Alternately, you can use the \method{setparameters()} method to set all
three audio parameters at once. This is more convenient, but may not be
as flexible in all cases.
The audio device objects
are
returned by
\function
{
open()
}
define the
The audio device objects returned by
\function
{
open()
}
define the
following methods:
\begin{methoddesc}
[audio device]
{
close
}{}
...
...
@@ -138,24 +138,25 @@ mode, some data may not be written---see \method{writeall()}.
\end{methoddesc}
\begin{methoddesc}
[audio device]
{
writeall
}{
data
}
Write the entire Python string
\var
{
data
}
to the audio device
. If the
device is in blocking mode (the default), behaves identically to
\method
{
write()
}
; in non-blocking mode,
\method
{
writeall()
}
waits until the
audio device is able to accept data, writes as much data as it will
accept, and repeats until
\var
{
data
}
has been completely written. Has
no
return value, since the amount of data written is always equal to the
amount of data supplied.
Write the entire Python string
\var
{
data
}
to the audio device
: waits
until the audio device is able to accept data, writes as much data as it
will accept, and repeats until
\var
{
data
}
has been completely written.
If the device is in blocking mode (the default), this has the same
effect as
\method
{
write()
}
;
\method
{
writeall()
}
is only useful in
no
n-blocking mode. Has no return value, since the amount of data
written is always equal to the
amount of data supplied.
\end{methoddesc}
The following methods each map to exactly one
\function
{
ioctl()
}
system call. If the underlying
\function
{
ioctl()
}
fails, they all raise
\exception
{
IOError
}
.
\function
{
ioctl()
}
system call. The correspondence is obvious: for
example,
\method
{
setfmt()
}
corresponds to the
\code
{
SNDCTL
_
DSP
_
SETFMT
}
ioctl, and
\method
{
sync()
}
to
\code
{
SNDCTL
_
DSP
_
SYNC
}
(this can be useful
when consulting the OSS documentation). If the underlying
\function
{
ioctl()
}
fails, they all raise
\exception
{
IOError
}
.
\begin{methoddesc}
[audio device]
{
nonblock
}{}
Put the device into non-blocking mode. Once in non-blocking mode, there
is no way to return it to blocking mode.
Corresponds to the
\code
{
SNDCTL
_
DSP
_
NONBLOCK
}
ioctl.
\end{methoddesc}
\begin{methoddesc}
[audio device]
{
getfmts
}{}
...
...
@@ -189,23 +190,19 @@ soundcard. On a typical Linux system, these formats are:
Most systems support only a subset of these formats. Many devices only
support
\constant
{
AFMT
_
U8
}
; the most common format used today is
\constant
{
AFMT
_
S16
_
LE
}
.
Corresponds to the
\code
{
SNDCTL
_
DSP
_
GETFMTS
}
ioctl.
\end{methoddesc}
\begin{methoddesc}
[audio device]
{
setfmt
}{
format
}
Try to set the current audio format to
\var
{
format
}
---see
\method
{
getfmts()
}
for a list. Return the audio format that the device
\method
{
getfmts()
}
for a list. Return
s
the audio format that the device
was set to, which may not be the requested format. May also be used to
return the current audio format---do this by passing an ``audio format''
of
\constant
{
AFMT
_
QUERY
}
.
Corresponds to the
\code
{
SNDCTL
_
DSP
_
SETFMT
}
ioctl.
\end{methoddesc}
\begin{methoddesc}
[audio device]
{
channels
}{
num
_
channels
}
Set
s
the number of output channels to
\var
{
num
_
channels
}
. A value of 1
Set the number of output channels to
\var
{
num
_
channels
}
. A value of 1
indicates monophonic sound, 2 stereophonic. Some devices may have more
than 2 channels, and some high-end devices may not support mono.
Returns the number of channels the device was set to.
...
...
@@ -225,23 +222,23 @@ support arbitrary sampling rates. Common rates are:
\end{methoddesc}
\begin{methoddesc}
[audio device]
{
sync
}{}
Wait
s until the sound device has played every byte in its buffer and
returns. This also occurs when the sound device is closed. The OSS
documentation recommends simply closing and re-opening the device rather
than using
\method
{
sync()
}
.
Wait
until the sound device has played every byte in its buffer. (This
happens implicitly when the device is closed.) The OSS documentation
recommends closing and re-opening the device rather than using
\method
{
sync()
}
.
\end{methoddesc}
\begin{methoddesc}
[audio device]
{
reset
}{}
Immediately stop
s and playing or recording and returns
the device to a
Immediately stop
playing or recording and return
the device to a
state where it can accept commands. The OSS documentation recommends
closing and re-opening the device after calling
\method
{
reset()
}
.
\end{methoddesc}
\begin{methoddesc}
[audio device]
{
post
}{}
T
o be used like a lightweight
\method
{
sync()
}
, the
\method
{
post()
}
IOCTL informs the audio device that there is a likely to be a pause in
the audio output---i.e., after playing a spot sound effect, before
waiting for
user input, or before doing disk I/O.
T
ell the driver that there is likely to be a pause in the output, making
it possible for the device to handle the pause more intelligently. You
might use this after playing a spot sound effect, before waiting for
user input, or before doing disk I/O.
\end{methoddesc}
Convenience methods
...
...
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