uaudio_set_params:

Use slinear16_to_mulaw_le() if ULAW recording is requested and the device
supports neither signed 8bit nor unsigned 8bit and supports 16bit.
This commit is contained in:
kent 2002-02-10 06:37:45 +00:00
parent 29b73c4025
commit 4653bffb03
1 changed files with 24 additions and 22 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: uaudio.c,v 1.44 2001/11/13 06:24:54 lukem Exp $ */
/* $NetBSD: uaudio.c,v 1.45 2002/02/10 06:37:45 kent Exp $ */
/*
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -44,7 +44,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.44 2001/11/13 06:24:54 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.45 2002/02/10 06:37:45 kent Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -2201,13 +2201,9 @@ uaudio_set_params(void *addr, int setmode, int usemode,
}
break;
case AUDIO_ENCODING_ULAW:
if (!(flags & HAS_MULAW)) {
if (mode == AUMODE_PLAY &&
(flags & HAS_16)) {
swcode = mulaw_to_slinear16_le;
factor = 2;
enc = AUDIO_ENCODING_SLINEAR_LE;
} else if (flags & HAS_8U) {
if (flags & HAS_MULAW)
break;
if (flags & HAS_8U) {
if (mode == AUMODE_PLAY)
swcode = mulaw_to_ulinear8;
else
@ -2219,9 +2215,15 @@ uaudio_set_params(void *addr, int setmode, int usemode,
else
swcode = slinear8_to_mulaw;
enc = AUDIO_ENCODING_SLINEAR_LE;
} else if (flags & HAS_16) {
if (mode == AUMODE_PLAY)
swcode = mulaw_to_slinear16_le;
else
swcode = slinear16_to_mulaw_le;
factor = 2;
enc = AUDIO_ENCODING_SLINEAR_LE;
} else
return (EINVAL);
}
break;
case AUDIO_ENCODING_ALAW:
if (!(flags & HAS_ALAW)) {