CVS commit: src/usr.bin/aiomixer

2023-06-29 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Thu Jun 29 19:06:54 UTC 2023

Modified Files:
src/usr.bin/aiomixer: aiomixer.1 app.h draw.c main.c

Log Message:
aiomixer(1): Support the informal NO_COLOR standard.

When the NO_COLOR environment variable is set, no ANSI colours will
be displayed.

https://no-color.org/


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/aiomixer/aiomixer.1 \
src/usr.bin/aiomixer/app.h
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/aiomixer/draw.c
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/aiomixer/main.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/aiomixer

2023-06-29 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Thu Jun 29 19:06:54 UTC 2023

Modified Files:
src/usr.bin/aiomixer: aiomixer.1 app.h draw.c main.c

Log Message:
aiomixer(1): Support the informal NO_COLOR standard.

When the NO_COLOR environment variable is set, no ANSI colours will
be displayed.

https://no-color.org/


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/aiomixer/aiomixer.1 \
src/usr.bin/aiomixer/app.h
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/aiomixer/draw.c
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/aiomixer/main.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/aiomixer/aiomixer.1
diff -u src/usr.bin/aiomixer/aiomixer.1:1.1 src/usr.bin/aiomixer/aiomixer.1:1.2
--- src/usr.bin/aiomixer/aiomixer.1:1.1	Fri May  7 16:29:24 2021
+++ src/usr.bin/aiomixer/aiomixer.1	Thu Jun 29 19:06:54 2023
@@ -1,4 +1,4 @@
-.\" $NetBSD: aiomixer.1,v 1.1 2021/05/07 16:29:24 nia Exp $
+.\" $NetBSD: aiomixer.1,v 1.2 2023/06/29 19:06:54 nia Exp $
 .\"
 .\" Copyright (c) 2021 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd April 4, 2019
+.Dd July 29, 2023
 .Dt AIOMIXER 1
 .Os
 .Sh NAME
@@ -67,6 +67,11 @@ Used to specify an alternative mixer dev
 .It Fl u
 Used to unlock channels on start up.
 .El
+.Pp
+.Nm
+honours the informal standard
+.Dv NO_COLOR .
+When it is set in the environment, no colour will be used.
 .Sh FILES
 .Bl -tag -width /dev/mixer[0-3] -compact
 .It Pa /dev/mixer
@@ -81,7 +86,7 @@ The first version (only available in pkg
 properly, among other bugs.
 .Sh AUTHORS
 .Nm
-was written by 
+was written by
 .An Nia Alarie
 .Aq n...@netbsd.org .
 .Sh BUGS
Index: src/usr.bin/aiomixer/app.h
diff -u src/usr.bin/aiomixer/app.h:1.1 src/usr.bin/aiomixer/app.h:1.2
--- src/usr.bin/aiomixer/app.h:1.1	Fri May  7 16:29:24 2021
+++ src/usr.bin/aiomixer/app.h	Thu Jun 29 19:06:54 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: app.h,v 1.1 2021/05/07 16:29:24 nia Exp $ */
+/* $NetBSD: app.h,v 1.2 2023/06/29 19:06:54 nia Exp $ */
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -70,6 +70,7 @@ struct aiomixer {
 	bool widgets_resized;
 	WINDOW *header;
 	WINDOW *classbar;
+	bool use_colour;
 };
 
 #define COLOR_CONTROL_SELECTED	1

Index: src/usr.bin/aiomixer/draw.c
diff -u src/usr.bin/aiomixer/draw.c:1.9 src/usr.bin/aiomixer/draw.c:1.10
--- src/usr.bin/aiomixer/draw.c:1.9	Thu Jul 15 07:03:14 2021
+++ src/usr.bin/aiomixer/draw.c	Thu Jun 29 19:06:54 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: draw.c,v 1.9 2021/07/15 07:03:14 nia Exp $ */
+/* $NetBSD: draw.c,v 1.10 2023/06/29 19:06:54 nia Exp $ */
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -37,10 +37,10 @@
 #include "draw.h"
 
 static int get_enum_color(const char *);
-static void draw_enum(struct aiomixer_control *, int, bool);
-static void draw_set(struct aiomixer_control *, int);
+static void draw_enum(struct aiomixer_control *, int, bool, bool);
+static void draw_set(struct aiomixer_control *, int, bool);
 static void draw_levels(struct aiomixer_control *,
-const struct mixer_level *, bool, bool);
+const struct mixer_level *, bool, bool, bool);
 
 void
 draw_mixer_select(unsigned int num_mixers, unsigned int selected_mixer)
@@ -103,14 +103,14 @@ draw_control(struct aiomixer *aio,
 
 	switch (value.type) {
 	case AUDIO_MIXER_ENUM:
-		draw_enum(control, value.un.ord, selected);
+		draw_enum(control, value.un.ord, selected, aio->use_colour);
 		break;
 	case AUDIO_MIXER_SET:
-		draw_set(control, value.un.mask);
+		draw_set(control, value.un.mask, aio->use_colour);
 		break;
 	case AUDIO_MIXER_VALUE:
 		draw_levels(control, &value.un.value,
-		aio->channels_unlocked, selected);
+		aio->channels_unlocked, selected, aio->use_colour);
 		break;
 	}
 
@@ -159,7 +159,8 @@ get_enum_color(const char *name)
 }
 
 static void
-draw_enum(struct aiomixer_control *control, int ord, bool selected)
+draw_enum(struct aiomixer_control *control, int ord,
+bool selected, bool colour)
 {
 	struct audio_mixer_enum *e;
 	int color = COLOR_ENUM_MISC;
@@ -175,7 +176,7 @@ draw_enum(struct aiomixer_control *contr
 		}
 		waddch(control->widgetpad, '[');
 		if (ord == e->member[i].ord) {
-			if (has_colors()) {
+			if (colour) {
 color = get_enum_color(e->member[i].label.name);
 wattron(control->widgetpad,
 	COLOR_PAIR(color));
@@ -185,7 +186,7 @@ draw_enum(struct aiomixer_control *contr
 		}
 		wprintw(control->widgetpad, "%s", e->member[i].label.name);
 		if (ord == control->info.un.e.member[i].ord) {
-			if (has_colors()) {
+			if (colour) {
 wattroff(control->widgetpad,
 	COLOR_PAIR(color));
 			}
@@ -204,19 +205,19 @@ draw_enum(struct aiomixer_control *contr
 }
 
 static void
-draw_set(struct aiomixer_control *control, int m

CVS commit: src/usr.bin/aiomixer

2023-07-01 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Sat Jul  1 10:47:12 UTC 2023

Modified Files:
src/usr.bin/aiomixer: aiomixer.1

Log Message:
Use ENVIRONMENT section


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/aiomixer/aiomixer.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/aiomixer

2023-07-01 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Sat Jul  1 10:47:12 UTC 2023

Modified Files:
src/usr.bin/aiomixer: aiomixer.1

Log Message:
Use ENVIRONMENT section


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/aiomixer/aiomixer.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/aiomixer/aiomixer.1
diff -u src/usr.bin/aiomixer/aiomixer.1:1.2 src/usr.bin/aiomixer/aiomixer.1:1.3
--- src/usr.bin/aiomixer/aiomixer.1:1.2	Thu Jun 29 19:06:54 2023
+++ src/usr.bin/aiomixer/aiomixer.1	Sat Jul  1 10:47:12 2023
@@ -1,4 +1,4 @@
-.\" $NetBSD: aiomixer.1,v 1.2 2023/06/29 19:06:54 nia Exp $
+.\" $NetBSD: aiomixer.1,v 1.3 2023/07/01 10:47:12 nia Exp $
 .\"
 .\" Copyright (c) 2021 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd July 29, 2023
+.Dd July 1, 2023
 .Dt AIOMIXER 1
 .Os
 .Sh NAME
@@ -67,7 +67,7 @@ Used to specify an alternative mixer dev
 .It Fl u
 Used to unlock channels on start up.
 .El
-.Pp
+.Sh ENVIRONMENT
 .Nm
 honours the informal standard
 .Dv NO_COLOR .



CVS commit: src/usr.bin/aiomixer

2024-05-20 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Mon May 20 22:21:45 UTC 2024

Modified Files:
src/usr.bin/aiomixer: main.c

Log Message:
aiomixer(1): Fix setting volume on sb(4) emulated in QEMU.

The driver does not return a "delta", assume it's 16.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/aiomixer/main.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/aiomixer/main.c
diff -u src/usr.bin/aiomixer/main.c:1.5 src/usr.bin/aiomixer/main.c:1.6
--- src/usr.bin/aiomixer/main.c:1.5	Thu Jun 29 19:06:54 2023
+++ src/usr.bin/aiomixer/main.c	Mon May 20 22:21:45 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.5 2023/06/29 19:06:54 nia Exp $ */
+/* $NetBSD: main.c,v 1.6 2024/05/20 22:21:45 nia Exp $ */
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -149,7 +149,12 @@ slide_control(struct aiomixer *aio,
 
 	switch (info->type) {
 	case AUDIO_MIXER_VALUE:
-		delta = right ? info->un.v.delta : -info->un.v.delta;
+		if (info->un.v.delta != 0) {
+			delta = right ? info->un.v.delta : -info->un.v.delta;
+		} else {
+			/* delta is 0 in qemu with sb(4) */
+			delta = right ? 16 : -16;
+		}
 		/*
 		 * work around strange problem where the level can be
 		 * increased but not decreased, seen with uaudio(4)



CVS commit: src/usr.bin/aiomixer

2024-05-20 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Mon May 20 22:21:45 UTC 2024

Modified Files:
src/usr.bin/aiomixer: main.c

Log Message:
aiomixer(1): Fix setting volume on sb(4) emulated in QEMU.

The driver does not return a "delta", assume it's 16.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/aiomixer/main.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.