--- xa_audio.c.orig Mon Mar 23 18:54:59 1998 +++ xa_audio.c Sun Apr 26 12:04:40 1998 @@ -4508,31 +4508,53 @@ a_info.blocksize = 1024; ioctl(devAudio, AUDIO_SETINFO, &a_info); AUDIO_INITINFO(&a_info); - -#ifndef AUDIO_ENCODING_SLINEAR - a_info.play.encoding = AUDIO_ENCODING_PCM16; -#else - /* NetBSD-1.3 */ - a_info.play.encoding = AUDIO_ENCODING_SLINEAR; /* Signed, nativeorder */ -#endif - ioctl(devAudio, AUDIO_SETINFO, &a_info); - AUDIO_INITINFO(&a_info); a_info.mode = AUMODE_PLAY | AUMODE_PLAY_ALL; ioctl(devAudio, AUDIO_SETINFO, &a_info); +#ifdef AUDIO_ENCODING_SLINEAR + /* Use new encoding names */ AUDIO_INITINFO(&a_info); + a_info.play.encoding = AUDIO_ENCODING_SLINEAR; a_info.play.precision = 16; + if (ioctl(devAudio, AUDIO_SETINFO, &a_info) < 0) { + AUDIO_INITINFO(&a_info); + a_info.play.encoding = AUDIO_ENCODING_ULINEAR; + a_info.play.precision = 8; + ioctl(devAudio, AUDIO_SETINFO, &a_info); + } +#else + AUDIO_INITINFO(&a_info); + a_info.play.encoding = AUDIO_ENCODING_PCM16; + a_info.play.precision = 16; + if (ioctl(devAudio, AUDIO_SETINFO, &a_info) < 0) { + AUDIO_INITINFO(&a_info); + a_info.play.encoding = AUDIO_ENCODING_PCM; + a_info.play.precision = 8; + ioctl(devAudio, AUDIO_SETINFO, &a_info); + } +#endif + AUDIO_INITINFO(&a_info); + a_info.play.channels = /*2*/1; ioctl(devAudio, AUDIO_SETINFO, &a_info); AUDIO_INITINFO(&a_info); - a_info.play.sample_rate = 11025; + a_info.play.sample_rate = 22050; ioctl(devAudio, AUDIO_SETINFO, &a_info); ioctl(devAudio, AUDIO_GETINFO, &a_info); - xa_audio_hard_type = (a_info.play.precision==8)?XA_AUDIO_LINEAR_1M - :XA_AUDIO_SIGNED_2ML; + if (a_info.play.channels == 2) + if (a_info.play.precision == 8) + xa_audio_hard_type = XA_AUDIO_LINEAR_1S; + else + xa_audio_hard_type = XA_AUDIO_SIGNED_2SL; + else + if (a_info.play.precision == 8) + xa_audio_hard_type = XA_AUDIO_LINEAR_1M; + else + xa_audio_hard_type = XA_AUDIO_SIGNED_2ML; xa_audio_hard_freq = a_info.play.sample_rate; xa_audio_hard_buff = a_info.blocksize; - xa_audio_hard_bps = (a_info.play.precision==8)?1:2; - xa_audio_hard_chans = 1; + xa_audio_hard_bps = a_info.play.precision / 8; + xa_audio_hard_chans = a_info.play.channels; + Gen_Ulaw_2_Signed(); Gen_Signed_2_Ulaw();