Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/aiomixer aiomixer: try to make sure the first pane i...



details:   https://anonhg.NetBSD.org/src/rev/886a3cd3767d
branches:  trunk
changeset: 1021104:886a3cd3767d
user:      nia <nia%NetBSD.org@localhost>
date:      Sat May 08 13:03:40 2021 +0000

description:
aiomixer: try to make sure the first pane is always "outputs"

In QEMU with an ac97 audio device, "inputs" is the first pane,
which is significantly less important especially when you don't
have input in QEMU most of the time.

diffstat:

 usr.bin/aiomixer/parse.c |  20 +++++++++++++++++++-
 1 files changed, 19 insertions(+), 1 deletions(-)

diffs (48 lines):

diff -r aac630097f68 -r 886a3cd3767d usr.bin/aiomixer/parse.c
--- a/usr.bin/aiomixer/parse.c  Sat May 08 12:53:15 2021 +0000
+++ b/usr.bin/aiomixer/parse.c  Sat May 08 13:03:40 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.2 2021/05/08 12:53:15 nia Exp $ */
+/* $NetBSD: parse.c,v 1.3 2021/05/08 13:03:40 nia Exp $ */
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -36,6 +36,7 @@
 
 static struct aiomixer_class *get_class(struct aiomixer *, int);
 static int compare_control(const void *, const void *);
+static int compare_class(const void *, const void *);
 
 static struct aiomixer_class *
 get_class(struct aiomixer *aio, int class)
@@ -68,6 +69,20 @@
        return 0;
 }
 
+static int
+compare_class(const void *pa, const void *pb)
+{
+       const struct aiomixer_class *a = (const struct aiomixer_class *)pa;
+       const struct aiomixer_class *b = (const struct aiomixer_class *)pb;
+
+       if (strcmp(a->name, AudioCoutputs) == 0)
+               return -1;
+       if (strcmp(b->name, AudioCoutputs) == 0)
+               return 1;
+
+       return strcmp(a->name, b->name);
+}
+
 int
 aiomixer_parse(struct aiomixer *aio)
 {
@@ -106,6 +121,9 @@
                control = &class->controls[class->numcontrols++];
                control->info = info;
        }
+       qsort(aio->classes, aio->numclasses,
+           sizeof(struct aiomixer_class),
+           compare_class);
        for (i = 0; i < aio->numclasses; ++i) {
                class = &aio->classes[i];
                qsort(class->controls, class->numcontrols,



Home | Main Index | Thread Index | Old Index