Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb uaudio_set_params:



details:   https://anonhg.NetBSD.org/src/rev/93b383398497
branches:  trunk
changeset: 521996:93b383398497
user:      kent <kent%NetBSD.org@localhost>
date:      Sun Feb 10 06:37:45 2002 +0000

description:
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.

diffstat:

 sys/dev/usb/uaudio.c |  46 ++++++++++++++++++++++++----------------------
 1 files changed, 24 insertions(+), 22 deletions(-)

diffs (68 lines):

diff -r fd0541b6c403 -r 93b383398497 sys/dev/usb/uaudio.c
--- a/sys/dev/usb/uaudio.c      Sun Feb 10 06:27:06 2002 +0000
+++ b/sys/dev/usb/uaudio.c      Sun Feb 10 06:37:45 2002 +0000
@@ -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,27 +2201,29 @@
                        }
                        break;
                case AUDIO_ENCODING_ULAW:
-                       if (!(flags & HAS_MULAW)) {
-                               if (mode == AUMODE_PLAY &&
-                                   (flags & HAS_16)) {
+                       if (flags & HAS_MULAW)
+                               break;
+                       if (flags & HAS_8U) {
+                               if (mode == AUMODE_PLAY)
+                                       swcode = mulaw_to_ulinear8;
+                               else
+                                       swcode = ulinear8_to_mulaw;
+                               enc = AUDIO_ENCODING_ULINEAR_LE;
+                       } else if (flags & HAS_8) {
+                               if (mode == AUMODE_PLAY)
+                                       swcode = mulaw_to_slinear8;
+                               else
+                                       swcode = slinear8_to_mulaw;
+                               enc = AUDIO_ENCODING_SLINEAR_LE;
+                       } else if (flags & HAS_16) {
+                               if (mode == AUMODE_PLAY)
                                        swcode = mulaw_to_slinear16_le;
-                                       factor = 2;
-                                       enc = AUDIO_ENCODING_SLINEAR_LE;
-                               } else if (flags & HAS_8U) {
-                                       if (mode == AUMODE_PLAY)
-                                               swcode = mulaw_to_ulinear8;
-                                       else
-                                               swcode = ulinear8_to_mulaw;
-                                       enc = AUDIO_ENCODING_ULINEAR_LE;
-                               } else if (flags & HAS_8) {
-                                       if (mode == AUMODE_PLAY)
-                                               swcode = mulaw_to_slinear8;
-                                       else
-                                               swcode = slinear8_to_mulaw;
-                                       enc = AUDIO_ENCODING_SLINEAR_LE;
-                               } else
-                                       return (EINVAL);
-                       }
+                               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)) {



Home | Main Index | Thread Index | Old Index