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

Skip to content

Commit fb1b5a1

Browse files
committed
Rewrite the description of setparameters() so it actually reflects the
code (which has also been recently overhauled, so that it can be documented without embarassment). 'error' has been renamed to 'OSSAudioError'. Minor wordsmithing.
1 parent 29a1def commit fb1b5a1

1 file changed

Lines changed: 33 additions & 13 deletions

File tree

Doc/lib/libossaudiodev.tex

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,17 @@ \section{\module{ossaudiodev} ---
4949

5050
\module{ossaudiodev} defines the following variables and functions:
5151

52-
\begin{excdesc}{error}
52+
\begin{excdesc}{OSSAudioError}
5353
This exception is raised on certain errors. The argument is a string
5454
describing what went wrong.
5555

5656
(If \module{ossaudiodev} receives an error from a system call such as
5757
\cfunction{open()}, \cfunction{write()}, or \cfunction{ioctl()}, it
5858
raises \exception{IOError}. Errors detected directly by
59-
\module{ossaudiodev} result in \exception{ossaudiodev.error}.)
59+
\module{ossaudiodev} result in \exception{OSSAudioError}.)
60+
61+
(For backwards compatibility, the exception class is also available as
62+
\code{ossaudiodev.error}.)
6063
\end{excdesc}
6164

6265
\begin{funcdesc}{open}{\optional{device, }mode}
@@ -201,8 +204,8 @@ \subsection{Audio Device Objects \label{ossaudio-device-objects}}
201204
\constant{AFMT_QUERY}.
202205
\end{methoddesc}
203206

204-
\begin{methoddesc}[audio device]{channels}{num_channels}
205-
Set the number of output channels to \var{num_channels}. A value of 1
207+
\begin{methoddesc}[audio device]{channels}{nchannels}
208+
Set the number of output channels to \var{nchannels}. A value of 1
206209
indicates monophonic sound, 2 stereophonic. Some devices may have more
207210
than 2 channels, and some high-end devices may not support mono.
208211
Returns the number of channels the device was set to.
@@ -241,16 +244,33 @@ \subsection{Audio Device Objects \label{ossaudio-device-objects}}
241244
user input, or before doing disk I/O.
242245
\end{methoddesc}
243246

244-
Convenience methods
247+
The following convenience methods combine several ioctls, or one ioctl
248+
and some simple calculations.
249+
250+
\begin{methoddesc}[audio device]{setparameters}
251+
{format, nchannels, samplerate \optional{, strict=False}}
245252

246-
\begin{methoddesc}[audio device]{setparameters}{samplerate,num_channels,format,emulate}
247-
Initialise the sound device in one method. \var{samplerate},
248-
\var{channels} and \var{format} should be as specified in the
249-
\method{speed()}, \method{channels()} and \method{setfmt()}
250-
methods. If \var{emulate} is true, attempt to find the closest matching
251-
format instead, otherwise raise ValueError if the device does not
252-
support the format. The default is to raise ValueError on unsupported
253-
formats.
253+
Set the key audio sampling parameters---sample format, number of
254+
channels, and sampling rate---in one method call. \var{format},
255+
\var{nchannels}, and \var{samplerate} should be as specified in the
256+
\method{setfmt()}, \method{channels()}, and \method{speed()}
257+
methods. If \var{strict} is true, \method{setparameters()} checks to
258+
see if each parameter was actually set to the requested value, and
259+
raises \exception{OSSAudioError} if not. Returns a tuple (\var{format},
260+
\var{nchannels}, \var{samplerate}) indicating the parameter values that
261+
were actually set by the device driver (i.e., the same as the return
262+
valus of \method{setfmt()}, \method{channels()}, and \method{speed()}).
263+
264+
For example,
265+
\begin{verbatim}
266+
(fmt, channels, rate) = dsp.setparameters(fmt, channels, rate)
267+
\end{verbatim}
268+
is equivalent to
269+
\begin{verbatim}
270+
fmt = dsp.setfmt(fmt)
271+
channels = dsp.channels(channels)
272+
rate = dsp.rate(channels)
273+
\end{verbatim}
254274
\end{methoddesc}
255275

256276
\begin{methoddesc}[audio device]{bufsize}{}

0 commit comments

Comments
 (0)