Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/audio AUDIO_SETINFO: fix a bug that the gain and the...
details: https://anonhg.NetBSD.org/src/rev/f0e3f8f5783f
branches: trunk
changeset: 984740:f0e3f8f5783f
user: isaki <isaki%NetBSD.org@localhost>
date: Wed Jul 21 06:14:58 2021 +0000
description:
AUDIO_SETINFO: fix a bug that the gain and the balance could not be set
at the same time. Fix PR kern/56308.
diffstat:
sys/dev/audio/audio.c | 69 ++++++++++++++++++++------------------------------
1 files changed, 28 insertions(+), 41 deletions(-)
diffs (104 lines):
diff -r 4329bb604b58 -r f0e3f8f5783f sys/dev/audio/audio.c
--- a/sys/dev/audio/audio.c Tue Jul 20 19:44:36 2021 +0000
+++ b/sys/dev/audio/audio.c Wed Jul 21 06:14:58 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: audio.c,v 1.104 2021/06/08 09:46:04 riastradh Exp $ */
+/* $NetBSD: audio.c,v 1.105 2021/07/21 06:14:58 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.104 2021/06/08 09:46:04 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.105 2021/07/21 06:14:58 isaki Exp $");
#ifdef _KERNEL_OPT
#include "audio.h"
@@ -7418,59 +7418,46 @@
}
}
- /* Backup play.{gain,balance} */
+ /* play.{gain,balance} */
if (SPECIFIED(newpi->gain) || SPECIFIED_CH(newpi->balance)) {
au_get_gain(sc, &sc->sc_outports, &pgain, &pbalance);
if (oldai) {
oldpi->gain = pgain;
oldpi->balance = pbalance;
}
- }
- /* Backup record.{gain,balance} */
+
+ if (SPECIFIED(newpi->gain))
+ pgain = newpi->gain;
+ if (SPECIFIED_CH(newpi->balance))
+ pbalance = newpi->balance;
+ error = au_set_gain(sc, &sc->sc_outports, pgain, pbalance);
+ if (error) {
+ audio_printf(sc,
+ "setting play.gain=%d/balance=%d failed: "
+ "errno=%d\n",
+ pgain, pbalance, error);
+ goto abort;
+ }
+ }
+
+ /* record.{gain,balance} */
if (SPECIFIED(newri->gain) || SPECIFIED_CH(newri->balance)) {
au_get_gain(sc, &sc->sc_inports, &rgain, &rbalance);
if (oldai) {
oldri->gain = rgain;
oldri->balance = rbalance;
}
- }
- if (SPECIFIED(newpi->gain)) {
- error = au_set_gain(sc, &sc->sc_outports,
- newpi->gain, pbalance);
- if (error) {
- audio_printf(sc,
- "setting play.gain=%d failed: errno=%d\n",
- newpi->gain, error);
- goto abort;
- }
- }
- if (SPECIFIED(newri->gain)) {
- error = au_set_gain(sc, &sc->sc_inports,
- newri->gain, rbalance);
+
+ if (SPECIFIED(newri->gain))
+ rgain = newri->gain;
+ if (SPECIFIED_CH(newri->balance))
+ rbalance = newri->balance;
+ error = au_set_gain(sc, &sc->sc_inports, rgain, rbalance);
if (error) {
audio_printf(sc,
- "setting record.gain=%d failed: errno=%d\n",
- newri->gain, error);
- goto abort;
- }
- }
- if (SPECIFIED_CH(newpi->balance)) {
- error = au_set_gain(sc, &sc->sc_outports,
- pgain, newpi->balance);
- if (error) {
- audio_printf(sc,
- "setting play.balance=%d failed: errno=%d\n",
- newpi->balance, error);
- goto abort;
- }
- }
- if (SPECIFIED_CH(newri->balance)) {
- error = au_set_gain(sc, &sc->sc_inports,
- rgain, newri->balance);
- if (error) {
- audio_printf(sc,
- "setting record.balance=%d failed: errno=%d\n",
- newri->balance, error);
+ "setting record.gain=%d/balance=%d failed: "
+ "errno=%d\n",
+ rgain, rbalance, error);
goto abort;
}
}
Home |
Main Index |
Thread Index |
Old Index