Source-Changes-HG archive

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

[src/trunk]: src/sys/dev Support recording conversions that change the sample...



details:   https://anonhg.NetBSD.org/src/rev/2b7ec48c5b5c
branches:  trunk
changeset: 485593:2b7ec48c5b5c
user:      augustss <augustss%NetBSD.org@localhost>
date:      Tue May 02 00:00:00 2000 +0000

description:
Support recording conversions that change the sample size.  PR 10029, from Gregory McGarry.

diffstat:

 sys/dev/audio.c |  16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diffs (37 lines):

diff -r 7ce214086418 -r 2b7ec48c5b5c sys/dev/audio.c
--- a/sys/dev/audio.c   Mon May 01 23:12:20 2000 +0000
+++ b/sys/dev/audio.c   Tue May 02 00:00:00 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: audio.c,v 1.124 2000/05/01 17:10:40 augustss Exp $     */
+/*     $NetBSD: audio.c,v 1.125 2000/05/02 00:00:00 augustss Exp $     */
 
 /*
  * Copyright (c) 1991-1993 Regents of the University of California.
@@ -1266,13 +1266,27 @@
                if (n < cc)
                        cc = n; /* don't read beyond end of buffer */
                
+               if (sc->sc_rparams.factor != 1) {
+                       /* Compensate for software coding expansion factor. */
+                       n /= sc->sc_rparams.factor;
+                       cc /= sc->sc_rparams.factor;
+               }
+ 
                if (uio->uio_resid < cc)
                        cc = uio->uio_resid; /* and no more than we want */
 
                if (sc->sc_rparams.sw_code)
                        sc->sc_rparams.sw_code(sc->hw_hdl, outp, cc);
+
                DPRINTFN(1,("audio_read: outp=%p, cc=%d\n", outp, cc));
+               n = uio->uio_resid;
                error = uiomove(outp, cc, uio);
+               cc = n - uio->uio_resid; /* number of bytes actually moved */
+               if (sc->sc_rparams.factor != 1) {
+                       /* Adjust count with expansion. */
+                       cc *= sc->sc_rparams.factor;
+               }
+
                used -= cc;
                outp += cc;
                if (outp >= cb->end)



Home | Main Index | Thread Index | Old Index