mirror of
https://github.com/python/cpython.git
synced 2025-07-23 03:05:38 +00:00
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.
This commit is contained in:
parent
b931bf3c55
commit
7745218c05
1 changed files with 8 additions and 9 deletions
|
@ -258,15 +258,6 @@ lad_setparameters(lad_t *self, PyObject *args)
|
||||||
return NULL;
|
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++)
|
for (n = 0; n < n_audio_types; n++)
|
||||||
if (fmt == audio_types[n].a_fmt)
|
if (fmt == audio_types[n].a_fmt)
|
||||||
break;
|
break;
|
||||||
|
@ -294,6 +285,14 @@ lad_setparameters(lad_t *self, PyObject *args)
|
||||||
PyErr_SetFromErrno(LinuxAudioError);
|
PyErr_SetFromErrno(LinuxAudioError);
|
||||||
return NULL;
|
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);
|
Py_INCREF(Py_None);
|
||||||
return Py_None;
|
return Py_None;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue