Source-Changes-HG archive

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

[src/netbsd-9]: src/sys/dev/audio Pull up following revision(s) (requested by...



details:   https://anonhg.NetBSD.org/src/rev/8fc341eb6ee5
branches:  netbsd-9
changeset: 1002338:8fc341eb6ee5
user:      snj <snj%NetBSD.org@localhost>
date:      Wed Jul 28 14:59:02 2021 +0000

description:
Pull up following revision(s) (requested by isaki in ticket #1325):
        sys/dev/audio/audio.c: revision 1.105
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 ba41831f4008 -r 8fc341eb6ee5 sys/dev/audio/audio.c
--- a/sys/dev/audio/audio.c     Wed Jul 28 14:56:35 2021 +0000
+++ b/sys/dev/audio/audio.c     Wed Jul 28 14:59:02 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: audio.c,v 1.28.2.22 2021/05/05 17:01:41 martin Exp $   */
+/*     $NetBSD: audio.c,v 1.28.2.23 2021/07/28 14:59:02 snj Exp $      */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -138,7 +138,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.28.2.22 2021/05/05 17:01:41 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.28.2.23 2021/07/28 14:59:02 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -7381,59 +7381,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