diff options
author | Guido van Rossum <guido@python.org> | 2001-12-08 17:13:45 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2001-12-08 17:13:45 (GMT) |
commit | 7745218c051706336e4adab4d33863dde2a38d6c (patch) | |
tree | cffc027741f30db8a32f792fae6744601fe0ed98 | |
parent | b931bf3c55613a58cf403f7e7b04a5c69cfd0763 (diff) | |
download | cpython-7745218c051706336e4adab4d33863dde2a38d6c.zip cpython-7745218c051706336e4adab4d33863dde2a38d6c.tar.gz cpython-7745218c051706336e4adab4d33863dde2a38d6c.tar.bz2 |
SF patch #489989 (Charles G Waldman) linuxaudiodev.c - fix initialization
The OSS Programmer's Reference (www.4front-tech.com)
states:
*Setting Sampling Parameters
There are three parameters which affect the sound
quality (and therefore memory and bandwidth
requirements) of sampled audio data. These are:
** sample format (sometimes called number of bits)
** number of channels (mono or stereo), and
** sampling rate (speed)
NOTE:
It is important to always set these parameters in the
above order. Setting sampling rate before the number
of channels doesn't work with all devices.
-rw-r--r-- | Modules/linuxaudiodev.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/Modules/linuxaudiodev.c b/Modules/linuxaudiodev.c index 37ad5ff..e0f144b 100644 --- a/Modules/linuxaudiodev.c +++ b/Modules/linuxaudiodev.c @@ -258,15 +258,6 @@ lad_setparameters(lad_t *self, PyObject *args) return NULL; } - if (ioctl(self->x_fd, SNDCTL_DSP_SPEED, &rate) == -1) { - PyErr_SetFromErrno(LinuxAudioError); - return NULL; - } - if (ioctl(self->x_fd, SNDCTL_DSP_CHANNELS, &nchannels) == -1) { - PyErr_SetFromErrno(LinuxAudioError); - return NULL; - } - for (n = 0; n < n_audio_types; n++) if (fmt == audio_types[n].a_fmt) break; @@ -294,6 +285,14 @@ lad_setparameters(lad_t *self, PyObject *args) PyErr_SetFromErrno(LinuxAudioError); return NULL; } + if (ioctl(self->x_fd, SNDCTL_DSP_CHANNELS, &nchannels) == -1) { + PyErr_SetFromErrno(LinuxAudioError); + return NULL; + } + if (ioctl(self->x_fd, SNDCTL_DSP_SPEED, &rate) == -1) { + PyErr_SetFromErrno(LinuxAudioError); + return NULL; + } Py_INCREF(Py_None); return Py_None; |