Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 451a766

Browse files
committed
More wordsmithing and cleanup.
1 parent 9592fe9 commit 451a766

1 file changed

Lines changed: 27 additions & 30 deletions

File tree

Doc/lib/libossaudiodev.tex

Lines changed: 27 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ \section{\module{ossaudiodev} ---
7474

7575
\var{mode} is one of \code{'r'} for read-only (record) access,
7676
\code{'w'} for write-only (playback) access and \code{'rw'} for both.
77-
Since many soundcards only allow one process to have the recorder or
78-
player open at a time it is a good idea to open the device only for the
79-
activity needed. Further, some soundcards are half-duplex: they can be
77+
Since many sound cards only allow one process to have the recorder or
78+
player open at a time, it is a good idea to open the device only for the
79+
activity needed. Further, some sound cards are half-duplex: they can be
8080
opened for reading or writing, but not both at once.
8181

8282
Note the unusual calling syntax: the \emph{first} argument is optional,
@@ -109,7 +109,7 @@ \subsection{Audio Device Objects \label{ossaudio-device-objects}}
109109
three audio parameters at once. This is more convenient, but may not be
110110
as flexible in all cases.
111111

112-
The audio device objects are returned by \function{open()} define the
112+
The audio device objects returned by \function{open()} define the
113113
following methods:
114114

115115
\begin{methoddesc}[audio device]{close}{}
@@ -138,24 +138,25 @@ \subsection{Audio Device Objects \label{ossaudio-device-objects}}
138138
\end{methoddesc}
139139

140140
\begin{methoddesc}[audio device]{writeall}{data}
141-
Write the entire Python string \var{data} to the audio device. If the
142-
device is in blocking mode (the default), behaves identically to
143-
\method{write()}; in non-blocking mode, \method{writeall()} waits until the
144-
audio device is able to accept data, writes as much data as it will
145-
accept, and repeats until \var{data} has been completely written. Has
146-
no return value, since the amount of data written is always equal to the
147-
amount of data supplied.
141+
Write the entire Python string \var{data} to the audio device: waits
142+
until the audio device is able to accept data, writes as much data as it
143+
will accept, and repeats until \var{data} has been completely written.
144+
If the device is in blocking mode (the default), this has the same
145+
effect as \method{write()}; \method{writeall()} is only useful in
146+
non-blocking mode. Has no return value, since the amount of data
147+
written is always equal to the amount of data supplied.
148148
\end{methoddesc}
149149

150150
The following methods each map to exactly one
151-
\function{ioctl()} system call. If the underlying \function{ioctl()}
152-
fails, they all raise \exception{IOError}.
151+
\function{ioctl()} system call. The correspondence is obvious: for
152+
example, \method{setfmt()} corresponds to the \code{SNDCTL_DSP_SETFMT}
153+
ioctl, and \method{sync()} to \code{SNDCTL_DSP_SYNC} (this can be useful
154+
when consulting the OSS documentation). If the underlying
155+
\function{ioctl()} fails, they all raise \exception{IOError}.
153156

154157
\begin{methoddesc}[audio device]{nonblock}{}
155158
Put the device into non-blocking mode. Once in non-blocking mode, there
156159
is no way to return it to blocking mode.
157-
158-
Corresponds to the \code{SNDCTL_DSP_NONBLOCK} ioctl.
159160
\end{methoddesc}
160161

161162
\begin{methoddesc}[audio device]{getfmts}{}
@@ -189,23 +190,19 @@ \subsection{Audio Device Objects \label{ossaudio-device-objects}}
189190
Most systems support only a subset of these formats. Many devices only
190191
support \constant{AFMT_U8}; the most common format used today is
191192
\constant{AFMT_S16_LE}.
192-
193-
Corresponds to the \code{SNDCTL_DSP_GETFMTS} ioctl.
194193
\end{methoddesc}
195194

196195
\begin{methoddesc}[audio device]{setfmt}{format}
197196
Try to set the current audio format to \var{format}---see
198-
\method{getfmts()} for a list. Return the audio format that the device
197+
\method{getfmts()} for a list. Returns the audio format that the device
199198
was set to, which may not be the requested format. May also be used to
200199
return the current audio format---do this by passing an ``audio format''
201200
of
202201
\constant{AFMT_QUERY}.
203-
204-
Corresponds to the \code{SNDCTL_DSP_SETFMT} ioctl.
205202
\end{methoddesc}
206203

207204
\begin{methoddesc}[audio device]{channels}{num_channels}
208-
Sets the number of output channels to \var{num_channels}. A value of 1
205+
Set the number of output channels to \var{num_channels}. A value of 1
209206
indicates monophonic sound, 2 stereophonic. Some devices may have more
210207
than 2 channels, and some high-end devices may not support mono.
211208
Returns the number of channels the device was set to.
@@ -225,23 +222,23 @@ \subsection{Audio Device Objects \label{ossaudio-device-objects}}
225222
\end{methoddesc}
226223

227224
\begin{methoddesc}[audio device]{sync}{}
228-
Waits until the sound device has played every byte in its buffer and
229-
returns. This also occurs when the sound device is closed. The OSS
230-
documentation recommends simply closing and re-opening the device rather
231-
than using \method{sync()}.
225+
Wait until the sound device has played every byte in its buffer. (This
226+
happens implicitly when the device is closed.) The OSS documentation
227+
recommends closing and re-opening the device rather than using
228+
\method{sync()}.
232229
\end{methoddesc}
233230

234231
\begin{methoddesc}[audio device]{reset}{}
235-
Immediately stops and playing or recording and returns the device to a
232+
Immediately stop playing or recording and return the device to a
236233
state where it can accept commands. The OSS documentation recommends
237234
closing and re-opening the device after calling \method{reset()}.
238235
\end{methoddesc}
239236

240237
\begin{methoddesc}[audio device]{post}{}
241-
To be used like a lightweight \method{sync()}, the \method{post()}
242-
IOCTL informs the audio device that there is a likely to be a pause in
243-
the audio output---i.e., after playing a spot sound effect, before
244-
waiting for user input, or before doing disk I/O.
238+
Tell the driver that there is likely to be a pause in the output, making
239+
it possible for the device to handle the pause more intelligently. You
240+
might use this after playing a spot sound effect, before waiting for
241+
user input, or before doing disk I/O.
245242
\end{methoddesc}
246243

247244
Convenience methods

0 commit comments

Comments
 (0)