Source-Changes-HG archive

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

[src/trunk]: src/sys/dev Add a null_filter to help with the audio autoconfig ...



details:   https://anonhg.NetBSD.org/src/rev/4e43f3fef2ba
branches:  trunk
changeset: 825674:4e43f3fef2ba
user:      nat <nat%NetBSD.org@localhost>
date:      Thu Jul 27 23:39:37 2017 +0000

description:
Add a null_filter to help with the audio autoconfig of pmax.

Tested by flxd@.

diffstat:

 sys/dev/auconv.c    |  22 ++++++++++++++++++++--
 sys/dev/auconv.h    |   3 ++-
 sys/dev/ic/am7930.c |  11 +++++++++--
 3 files changed, 31 insertions(+), 5 deletions(-)

diffs (116 lines):

diff -r a5a94225ed24 -r 4e43f3fef2ba sys/dev/auconv.c
--- a/sys/dev/auconv.c  Thu Jul 27 18:27:19 2017 +0000
+++ b/sys/dev/auconv.c  Thu Jul 27 23:39:37 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: auconv.c,v 1.28 2017/06/22 02:09:37 christos Exp $     */
+/*     $NetBSD: auconv.c,v 1.29 2017/07/27 23:39:37 nat Exp $  */
 
 /*
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: auconv.c,v 1.28 2017/06/22 02:09:37 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auconv.c,v 1.29 2017/07/27 23:39:37 nat Exp $");
 
 #include <sys/types.h>
 #include <sys/audioio.h>
@@ -456,6 +456,24 @@
        return 0;
 }
 
+DEFINE_FILTER(null_filter)
+{
+       stream_filter_t *this;
+       int m, err;
+
+       this = (stream_filter_t *)self;
+       max_used = (max_used + 1) & ~1; /* round up to even */
+       if ((err = this->prev->fetch_to(sc, this->prev, this->src, max_used)))
+               return err;
+       m = (dst->end - dst->start) & ~1;
+       m = min(m, max_used);
+       FILTER_LOOP_PROLOGUE(this->src, 1, dst, 1, m) {
+               *d = *s;
+       } FILTER_LOOP_EPILOGUE(this->src, dst);
+       
+       return 0;
+}
+
 DEFINE_FILTER(swap_bytes_change_sign16)
 {
        stream_filter_t *this;
diff -r a5a94225ed24 -r 4e43f3fef2ba sys/dev/auconv.h
--- a/sys/dev/auconv.h  Thu Jul 27 18:27:19 2017 +0000
+++ b/sys/dev/auconv.h  Thu Jul 27 23:39:37 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: auconv.h,v 1.18 2017/06/20 13:51:54 nat Exp $  */
+/*     $NetBSD: auconv.h,v 1.19 2017/07/27 23:39:37 nat Exp $  */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -82,6 +82,7 @@
 extern stream_filter_factory_t linear8_8_to_linear24;
 extern stream_filter_factory_t linear8_8_to_linear16;
 extern stream_filter_factory_t linear8_8_to_linear8;
+extern stream_filter_factory_t null_filter;
 
 #define linear16_to_linear8 linear16_16_to_linear8
 #define linear8_to_linear16 linear8_8_to_linear16
diff -r a5a94225ed24 -r 4e43f3fef2ba sys/dev/ic/am7930.c
--- a/sys/dev/ic/am7930.c       Thu Jul 27 18:27:19 2017 +0000
+++ b/sys/dev/ic/am7930.c       Thu Jul 27 23:39:37 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: am7930.c,v 1.55 2017/06/25 09:40:17 nat Exp $  */
+/*     $NetBSD: am7930.c,v 1.56 2017/07/27 23:39:37 nat Exp $  */
 
 /*
  * Copyright (c) 1995 Rolf Grossmann
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: am7930.c,v 1.55 2017/06/25 09:40:17 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: am7930.c,v 1.56 2017/07/27 23:39:37 nat Exp $");
 
 #include "audio.h"
 #if NAUDIO > 0
@@ -137,6 +137,7 @@
 #define NGER (sizeof(ger_coeff) / sizeof(ger_coeff[0]))
 };
 
+extern stream_filter_factory_t null_filter;
 
 /*
  * Reset chip and set boot-time softc defaults.
@@ -239,11 +240,14 @@
                if (sc->sc_glue->output_conv != NULL) {
                        hw = *p;
                        hw.encoding = AUDIO_ENCODING_NONE;
+                       hw.precision = 8;
+                       pfil->append(pfil, null_filter, &hw);
                        hw.precision *= sc->sc_glue->factor;
                        pfil->append(pfil, sc->sc_glue->output_conv, &hw);
                }
                if (p->encoding == AUDIO_ENCODING_SLINEAR) {
                        hw = *p;
+                       hw.precision = 8;
                        hw.encoding = AUDIO_ENCODING_ULAW;
                        pfil->append(pfil, linear8_to_mulaw, &hw);
                }
@@ -260,11 +264,14 @@
                if (sc->sc_glue->input_conv != NULL) {
                        hw = *r;
                        hw.encoding = AUDIO_ENCODING_NONE;
+                       hw.precision = 8;
+                       pfil->append(pfil, null_filter, &hw);
                        hw.precision *= sc->sc_glue->factor;
                        pfil->append(rfil, sc->sc_glue->input_conv, &hw);
                }
                if (r->encoding == AUDIO_ENCODING_SLINEAR) {
                        hw = *r;
+                       hw.precision = 8;
                        hw.encoding = AUDIO_ENCODING_ULAW;
                        rfil->append(rfil, mulaw_to_linear8, &hw);
                }



Home | Main Index | Thread Index | Old Index