Mercurial > hg > xemacs-beta
comparison src/linuxplay.c @ 129:e292c9648bb9 xemacs-20-1p3
Import from CVS: tag xemacs-20-1p3
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:28:38 +0200 |
parents | 9b50b4588a93 |
children | 538048ae2ab8 |
comparison
equal
deleted
inserted
replaced
128:13db4aa44a2e | 129:e292c9648bb9 |
---|---|
812 perror("SNDCTL_DSP_SYNC"); | 812 perror("SNDCTL_DSP_SYNC"); |
813 return(0); } | 813 return(0); } |
814 | 814 |
815 /* Initialize sound hardware with prefered parameters */ | 815 /* Initialize sound hardware with prefered parameters */ |
816 | 816 |
817 /* The PCSP driver does not support reading of the sampling rate via the | |
818 SOUND_PCM_READ_RATE ioctl; determine "the_speed" here */ | |
819 the_speed = speed; ioctl(audio_fd,SNDCTL_DSP_SPEED,&the_speed); | |
820 /* The PCSP driver does not support reading of the mono/stereo flag, thus | |
821 we assume, that failure to change this mode means we are in mono mode */ | |
822 if (((i = (the_stereo = tracks)-1),ioctl(audio_fd,SNDCTL_DSP_STEREO,&i)) < 0) | |
823 the_stereo = 1; | |
824 the_fmt = fmt; ioctl(audio_fd,SNDCTL_DSP_SETFMT,&the_fmt); | |
825 | |
826 /* If the sound hardware cannot support 16 bit format or requires a | 817 /* If the sound hardware cannot support 16 bit format or requires a |
827 different byte sex then try to drop to 8 bit format */ | 818 different byte sex then try to drop to 8 bit format */ |
828 the_fmt = AFMT_QUERY; ioctl(audio_fd,SNDCTL_DSP_SETFMT,&the_fmt); | 819 |
820 the_fmt = fmt; | |
821 if(ioctl(audio_fd,SNDCTL_DSP_SETFMT,&the_fmt) < 0) { | |
822 perror("SNDCTL_DSP_SETFMT"); | |
823 return(0); | |
824 } | |
825 | |
829 if (fmt != the_fmt) { | 826 if (fmt != the_fmt) { |
830 if (fmt == AFMT_S16_LE || fmt == AFMT_S16_BE) { | 827 if (fmt == AFMT_S16_LE || fmt == AFMT_S16_BE) { |
831 *sndcnv = fmt == AFMT_S16_BE ? sndcnv2byteBE : sndcnv2byteLE; | 828 *sndcnv = fmt == AFMT_S16_BE ? sndcnv2byteBE : sndcnv2byteLE; |
832 if (((i=fmt=AFMT_U8),ioctl(audio_fd,SNDCTL_DSP_SETFMT,&i)) < 0 || | 829 if (((i=fmt=AFMT_U8),ioctl(audio_fd,SNDCTL_DSP_SETFMT,&i)) < 0 || |
833 fmt != i || ioctl(audio_fd,SNDCTL_DSP_SETFMT,&the_fmt) < 0 || | 830 fmt != i || ioctl(audio_fd,SNDCTL_DSP_SETFMT,&the_fmt) < 0 || |
842 if (((i=fmt=AFMT_U8),ioctl(audio_fd,SNDCTL_DSP_SETFMT,&i)) < 0 || | 839 if (((i=fmt=AFMT_U8),ioctl(audio_fd,SNDCTL_DSP_SETFMT,&i)) < 0 || |
843 fmt != i || ioctl(audio_fd,SNDCTL_DSP_SETFMT,&the_fmt) < 0 || | 840 fmt != i || ioctl(audio_fd,SNDCTL_DSP_SETFMT,&the_fmt) < 0 || |
844 fmt != the_fmt) { | 841 fmt != the_fmt) { |
845 perror("SNDCTRL_DSP_SETFMT"); | 842 perror("SNDCTRL_DSP_SETFMT"); |
846 return(0); } } | 843 return(0); } } |
844 | |
845 /* The PCSP driver does not support reading of the sampling rate via the | |
846 SOUND_PCM_READ_RATE ioctl; determine "the_speed" here */ | |
847 the_speed = speed; ioctl(audio_fd,SNDCTL_DSP_SPEED,&the_speed); | |
848 /* The PCSP driver does not support reading of the mono/stereo flag, thus | |
849 we assume, that failure to change this mode means we are in mono mode */ | |
850 if (((i = (the_stereo = tracks)-1),ioctl(audio_fd,SNDCTL_DSP_STEREO,&i)) < 0) | |
851 the_stereo = 1; | |
847 | 852 |
848 /* Try to request stereo playback (if needed); if this cannot be supported | 853 /* Try to request stereo playback (if needed); if this cannot be supported |
849 by the hardware, then install conversion routines for mono playback */ | 854 by the hardware, then install conversion routines for mono playback */ |
850 | 855 |
851 /* This ioctl will fail if we use the PCSP driver; thus the value of | 856 /* This ioctl will fail if we use the PCSP driver; thus the value of |