git: c712a039e44d - stable/15 - snd_uaudio: drop the default monitor level to 10%

From: Christos Margiolis <christos_at_FreeBSD.org>
Date: Sun, 18 Oct 2026 08:13:19 UTC
The branch stable/15 has been updated by christos:

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

commit c712a039e44d5a70467c9cb3de184e277694b791
Author:     Kyle Evans <kevans@FreeBSD.org>
AuthorDate: 2026-08-26 14:34:47 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2026-10-18 08:10:07 +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
    
    (cherry picked from commit c3c6a6c7825ccc744afddba692820296f72ea53f)
---
 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 e1b394115ac2..b8f8636fa1ae 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);