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)

Reply via email to