Module Name: src Committed By: nat Date: Mon Mar 27 23:25:24 UTC 2017
Modified Files: src/sys/dev: audio.c Log Message: Use play/record gain from last open. Fixes jumping volume when opening /dev/sound then /dev/audio. To generate a diff of this commit: cvs rdiff -u -r1.317 -r1.318 src/sys/dev/audio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/audio.c diff -u src/sys/dev/audio.c:1.317 src/sys/dev/audio.c:1.318 --- src/sys/dev/audio.c:1.317 Tue Mar 21 07:04:29 2017 +++ src/sys/dev/audio.c Mon Mar 27 23:25:24 2017 @@ -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 <nathanialsl...@yahoo.com.au> @@ -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 @@ audio_open(dev_t dev, struct audio_softc 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 @@ audio_open(dev_t dev, struct audio_softc */ 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); }