Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/audio Improve the blocksize notation.



details:   https://anonhg.NetBSD.org/src/rev/b599984d49e9
branches:  trunk
changeset: 1009271:b599984d49e9
user:      isaki <isaki%NetBSD.org@localhost>
date:      Sun Apr 19 03:52:22 2020 +0000

description:
Improve the blocksize notation.
The blocksize is expressed in bytes, and the millisecond notation
is supplementary information to make it easier to understand.

diffstat:

 sys/dev/audio/audio.c |  17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diffs (57 lines):

diff -r d28e2f09f9a7 -r b599984d49e9 sys/dev/audio/audio.c
--- a/sys/dev/audio/audio.c     Sun Apr 19 03:12:35 2020 +0000
+++ b/sys/dev/audio/audio.c     Sun Apr 19 03:52:22 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: audio.c,v 1.66 2020/04/17 07:48:35 isaki Exp $ */
+/*     $NetBSD: audio.c,v 1.67 2020/04/19 03:52:22 isaki Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -138,7 +138,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.66 2020/04/17 07:48:35 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.67 2020/04/19 03:52:22 isaki Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -4788,6 +4788,7 @@
        const audio_format2_t *hwfmt, const audio_filter_reg_t *reg)
 {
        char codecbuf[64];
+       char blkdmsbuf[8];
        audio_trackmixer_t *mixer;
        void (*softint_handler)(void *);
        int len;
@@ -4796,6 +4797,7 @@
        size_t bufsize;
        int hwblks;
        int blkms;
+       int blkdms;
        int error;
 
        KASSERT(hwfmt != NULL);
@@ -4975,13 +4977,20 @@
                    mixer->hwbuf.fmt.precision);
        }
        blkms = mixer->blktime_n * 1000 / mixer->blktime_d;
-       aprint_normal_dev(sc->sc_dev, "%s:%d%s %dch %dHz, blk %dms for %s\n",
+       blkdms = (mixer->blktime_n * 10000 / mixer->blktime_d) % 10;
+       blkdmsbuf[0] = '\0';
+       if (blkdms != 0) {
+               snprintf(blkdmsbuf, sizeof(blkdmsbuf), ".%1d", blkdms);
+       }
+       aprint_normal_dev(sc->sc_dev,
+           "%s:%d%s %dch %dHz, blk %d bytes (%d%sms) for %s\n",
            audio_encoding_name(mixer->track_fmt.encoding),
            mixer->track_fmt.precision,
            codecbuf,
            mixer->track_fmt.channels,
            mixer->track_fmt.sample_rate,
-           blkms,
+           blksize,
+           blkms, blkdmsbuf,
            (mode == AUMODE_PLAY) ? "playback" : "recording");
 
        return 0;



Home | Main Index | Thread Index | Old Index