[Python-checkins] CVS: python/dist/src/Modules linuxaudiodev.c,2.14,2.15

Guido van Rossum gvanrossum@users.sourceforge.net
2001年12月08日 09:13:47 -0800


Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv6304
Modified Files:
	linuxaudiodev.c 
Log Message:
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.
Index: linuxaudiodev.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/linuxaudiodev.c,v
retrieving revision 2.14
retrieving revision 2.15
diff -C2 -d -r2.14 -r2.15
*** linuxaudiodev.c	2001年04月02日 17:59:02	2.14
--- linuxaudiodev.c	2001年12月08日 17:13:45	2.15
***************
*** 259,271 ****
 }
 
- 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)
--- 259,262 ----
***************
*** 292,295 ****
--- 283,294 ----
 if (ioctl(self->x_fd, SNDCTL_DSP_SETFMT, 
 	 &audio_types[n].a_fmt) == -1) {
+ 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;

AltStyle によって変換されたページ (->オリジナル) /