Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev Allow 24 and 32bit linear audio.
details: https://anonhg.NetBSD.org/src/rev/916df84df778
branches: trunk
changeset: 514481:916df84df778
user: is <is%NetBSD.org@localhost>
date: Mon Sep 03 18:51:43 2001 +0000
description:
Allow 24 and 32bit linear audio.
Actually, the silence filler can do any multiple of 8 bits now, but I didn't
allow the parameter check to accept more than 32 bit to avoid confusion
of drivers that fail to check the parameters themselves thoroughly.
This should be changed later.
diffstat:
sys/dev/audio.c | 40 ++++++++++++++++++++++++----------------
1 files changed, 24 insertions(+), 16 deletions(-)
diffs (73 lines):
diff -r 9fa281871b11 -r 916df84df778 sys/dev/audio.c
--- a/sys/dev/audio.c Mon Sep 03 18:42:49 2001 +0000
+++ b/sys/dev/audio.c Mon Sep 03 18:51:43 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: audio.c,v 1.137 2001/06/03 23:52:51 jhawk Exp $ */
+/* $NetBSD: audio.c,v 1.138 2001/09/03 18:51:43 is Exp $ */
/*
* Copyright (c) 1991-1993 Regents of the University of California.
@@ -1379,19 +1379,14 @@
case AUDIO_ENCODING_ADPCM: /* is this right XXX */
case AUDIO_ENCODING_SLINEAR_LE:
case AUDIO_ENCODING_SLINEAR_BE:
- auzero0 = 0;/* fortunately this works for both 8 and 16 bits */
+ auzero0 = 0;/* fortunately this works for any number of bits */
break;
case AUDIO_ENCODING_ULINEAR_LE:
case AUDIO_ENCODING_ULINEAR_BE:
- if (params->precision == 16) {
- nfill = 2;
- if (params->encoding == AUDIO_ENCODING_ULINEAR_LE) {
- auzero0 = 0;
- auzero1 = 0x80;
- } else {
- auzero0 = 0x80;
- auzero1 = 0;
- }
+ if (params->precision > 8) {
+ nfill = (params->precision + NBBY - 1)/ NBBY;
+ auzero0 = 0x80;
+ auzero1 = 0;
} else
auzero0 = 0x80;
break;
@@ -1403,12 +1398,23 @@
if (nfill == 1) {
while (--n >= 0)
*p++ = auzero0; /* XXX memset */
- } else /* nfill must be 2 */ {
- while (n > 1) {
+ } else /* nfill must no longer be 2 */ {
+ if (params->encoding == AUDIO_ENCODING_ULINEAR_LE) {
+ int k = nfill;
+ while (--k > 0)
+ *p++ = auzero1;
+ n -= nfill - 1;
+ }
+ while (n >= nfill) {
+ int k;
*p++ = auzero0;
- *p++ = auzero1;
- n -= 2;
+ while (--k > 0)
+ *p++ = auzero1;
+
+ n -= nfill;
}
+ if (n-- > 0) /* XXX must be 1 - DIAGNOSTIC check? */
+ *p++ = auzero0;
}
}
@@ -2231,7 +2237,9 @@
case AUDIO_ENCODING_SLINEAR_BE:
case AUDIO_ENCODING_ULINEAR_LE:
case AUDIO_ENCODING_ULINEAR_BE:
- if (p->precision != 8 && p->precision != 16)
+ /* XXX is: our zero-fill can handle any multiple of 8 */
+ if (p->precision != 8 && p->precision != 16 &&
+ p->precision != 24 && p->precision != 32)
return (EINVAL);
break;
case AUDIO_ENCODING_MPEG_L1_STREAM:
Home |
Main Index |
Thread Index |
Old Index