git: c3c6a6c7825c - main - snd_uaudio: drop the default monitor level to 10%

From: Kyle Evans <kevans_at_FreeBSD.org>
Date: Wed, 02 Sep 2026 03:54:35 UTC
The branch main has been updated by kevans:

URL: https://cgit.FreeBSD.org/src/commit/?id=c3c6a6c7825ccc744afddba692820296f72ea53f

commit c3c6a6c7825ccc744afddba692820296f72ea53f
Author:     Kyle Evans <kevans@FreeBSD.org>
AuthorDate: 2026-08-26 14:34:47 +0000
Commit:     Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2026-09-02 03:54:17 +0000

    snd_uaudio: drop the default monitor level to 10%
    
    As noted in the comment, some headsets with a hardware sidetone are
    incredibly sensitive and emit immediate feedback upon attach with the
    current system-wide default of 75%.  Drop it down just for snd_uaudio(4)
    to avoid incredibly unpleasant surprises.
    
    MFC after:      3 days
    Reviewed by:    christos
    Differential Revision:  https://reviews.freebsd.org/D59199
---
 sys/dev/sound/usb/uaudio.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/sys/dev/sound/usb/uaudio.c b/sys/dev/sound/usb/uaudio.c
index 2e0f670ddc28..de2b9c467835 100644
--- a/sys/dev/sound/usb/uaudio.c
+++ b/sys/dev/sound/usb/uaudio.c
@@ -112,6 +112,13 @@ SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, default_channels, CTLFLAG_RWTUN,
 #define	UAUDIO_BUFFER_MS_MIN	1
 #define	UAUDIO_BUFFER_MS_MAX	8
 
+/*
+ * The default monitor level is high enough that headsets with a hardware
+ * sidetone may emit immediate feedback upon attach.  We'll lower the default
+ * just for snd_uaudio(4) to avoid breaking others.
+ */
+#define	UAUDIO_DEFAULT_MONITOR	10
+
 static int
 uaudio_buffer_ms_sysctl(SYSCTL_HANDLER_ARGS)
 {
@@ -1199,6 +1206,8 @@ uaudio_attach_sub(device_t dev, kobj_class_t mixer_class, kobj_class_t chan_clas
 	}
 	if (mixer_init(dev, mixer_class, sc))
 		goto detach;
+	mix_set(sc->sc_child[i].mixer_dev, SOUND_MIXER_MONITOR,
+	    UAUDIO_DEFAULT_MONITOR, UAUDIO_DEFAULT_MONITOR);
 	sc->sc_child[i].mixer_init = 1;
 
 	mixer_hwvol_init(dev);