Source-Changes-HG archive

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

[src/trunk]: src/sys/dev Use play/record gain from last open. Fixes jumping ...



details:   https://anonhg.NetBSD.org/src/rev/1a9259388cd0
branches:  trunk
changeset: 822606:1a9259388cd0
user:      nat <nat%NetBSD.org@localhost>
date:      Mon Mar 27 23:25:24 2017 +0000

description:
Use play/record gain from last open.  Fixes jumping volume when opening
/dev/sound then /dev/audio.

diffstat:

 sys/dev/audio.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (36 lines):

diff -r 8a0319b40ad8 -r 1a9259388cd0 sys/dev/audio.c
--- a/sys/dev/audio.c   Mon Mar 27 21:34:32 2017 +0000
+++ b/sys/dev/audio.c   Mon Mar 27 23:25:24 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: audio.c,v 1.317 2017/03/21 07:04:29 nat Exp $  */
+/*     $NetBSD: audio.c,v 1.318 2017/03/27 23:25:24 nat Exp $  */
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss <nathanialsloss%yahoo.com.au@localhost>
@@ -148,7 +148,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.317 2017/03/21 07:04:29 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.318 2017/03/27 23:25:24 nat Exp $");
 
 #include "audio.h"
 #if NAUDIO > 0
@@ -2074,6 +2074,7 @@
        const struct audio_hw_if *hw;
        struct virtual_channel *vc;
        struct audio_chan *chan;
+       struct audio_info info;
 
        KASSERT(mutex_owned(sc->sc_lock));
 
@@ -2190,6 +2191,9 @@
         */
        error = audio_set_defaults(sc, mode, vc);
        if (!error && ISDEVSOUND(dev) && sc->sc_aivalid == true) {
+               error = audiogetinfo(sc, &info, 0, vc);
+               sc->sc_ai.play.gain = info.play.gain;
+               sc->sc_ai.record.gain = info.record.gain;
                sc->sc_ai.mode = mode;
                error = audiosetinfo(sc, &sc->sc_ai, true, vc);
        }



Home | Main Index | Thread Index | Old Index