diff options
author | Jason Wright <jason@cvs.openbsd.org> | 2002-09-10 05:43:32 +0000 |
---|---|---|
committer | Jason Wright <jason@cvs.openbsd.org> | 2002-09-10 05:43:32 +0000 |
commit | 2eb72d7420b2707efd725661e2e06ca175a07709 (patch) | |
tree | 7c2776b33500a62d01cc780b224b9e08a1a25f2d /sys/dev/sbus/cs4231.c | |
parent | bfab122be99452c82f796d9746028be0572a3c62 (diff) |
Set encodings correctly.
Diffstat (limited to 'sys/dev/sbus/cs4231.c')
-rw-r--r-- | sys/dev/sbus/cs4231.c | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/sys/dev/sbus/cs4231.c b/sys/dev/sbus/cs4231.c index d6c6c35378a..6987f989132 100644 --- a/sys/dev/sbus/cs4231.c +++ b/sys/dev/sbus/cs4231.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cs4231.c,v 1.13 2002/09/09 20:25:17 jason Exp $ */ +/* $OpenBSD: cs4231.c,v 1.14 2002/09/10 05:43:31 jason Exp $ */ /* * Copyright (c) 1999 Jason L. Wright (jason@thought.net) @@ -603,9 +603,13 @@ cs4231_set_params(addr, setmode, usemode, p, r) bits = FMT_ALAW >> 5; break; case AUDIO_ENCODING_SLINEAR_LE: - if (p->precision != 16) + if (p->precision == 8) { + bits = FMT_PCM8 >> 5; + pswcode = rswcode = change_sign8; + } else if (p->precision == 16) + bits = FMT_TWOS_COMP >> 5; + else return (EINVAL); - bits = FMT_TWOS_COMP >> 5; break; case AUDIO_ENCODING_ULINEAR: if (p->precision != 8) @@ -613,30 +617,37 @@ cs4231_set_params(addr, setmode, usemode, p, r) bits = FMT_PCM8 >> 5; break; case AUDIO_ENCODING_SLINEAR_BE: - if (p->precision != 16) + if (p->precision == 8) { + bits = FMT_PCM8 >> 5; + pswcode = rswcode = change_sign8; + } else if (p->precision == 16) + bits = FMT_TWOS_COMP_BE >> 5; + else return (EINVAL); - bits = FMT_TWOS_COMP_BE >> 5; break; case AUDIO_ENCODING_SLINEAR: - /* emulate with ulinear8 conversion */ if (p->precision != 8) return (EINVAL); bits = FMT_PCM8 >> 5; pswcode = rswcode = change_sign8; break; case AUDIO_ENCODING_ULINEAR_LE: - /* emulate with slinear_le16 conversion */ - if (p->precision != 16) + if (p->precision == 8) + bits = FMT_PCM8 >> 5; + else if (p->precision == 16) { + bits = FMT_TWOS_COMP >> 5; + pswcode = rswcode = change_sign16_le; + } else return (EINVAL); - bits = FMT_TWOS_COMP >> 5; - pswcode = rswcode = change_sign16; break; case AUDIO_ENCODING_ULINEAR_BE: - /* emulate with slinear_be16 conversion */ - if (p->precision != 16) + if (p->precision == 8) + bits = FMT_PCM8 >> 5; + else if (p->precision == 16) { + bits = FMT_TWOS_COMP_BE >> 5; + pswcode = rswcode = change_sign16_be; + } else return (EINVAL); - bits = FMT_TWOS_COMP_BE >> 5; - pswcode = rswcode = change_sign16; break; case AUDIO_ENCODING_ADPCM: if (p->precision != 8) |