Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 1 Mar 2026 11:33:50 -0500 (EST)
From:      "Sean C. Farley" <scf@FreeBSD.org>
To:        Christos Margiolis <christos@FreeBSD.org>
Cc:        freebsd-multimedia@FreeBSD.org
Subject:   Re: Muting only affects audio that is playing
Message-ID:  <b7b842ee-b4c9-0409-271b-9de37ef80d39@FreeBSD.org>
In-Reply-To: <DGOXUYADHO11.72ZT82BI4R9E@FreeBSD.org>
References:  <8028333b-f7c1-7992-1016-4194623fce38@FreeBSD.org> <DEUKE1MYMQJY.JDSTZX83BW19@FreeBSD.org> <598a46dd-3abc-2a72-3f58-a9ca16ab3bb0@FreeBSD.org> <DFE9SJR00WMV.6STGABH2CYSU@FreeBSD.org> <33aa299e-2fef-6920-ba56-4307b3b34f8e@FreeBSD.org> <DFICY1MMK3A4.YSKTYH83NUY4@FreeBSD.org> <33ac0089-04d0-1cdf-d9ec-e9eba0be9b72@FreeBSD.org> <DGOXUYADHO11.72ZT82BI4R9E@FreeBSD.org>

index | next in thread | previous in thread | raw e-mail

On Thu, 26 Feb 2026, Christos Margiolis wrote:

> Hello Sean,
>
> On Wed Feb 25, 2026 at 4:07 AM CET, Sean C. Farley wrote:
>> Now, this only fixes what I hear regarding vol.mute.  pcm.mute still 
>> exhibits the problem but would have to be fixed elsewhere, probably 
>> within the channel code.
>>
>> A commit message/description of it:
>>
>> -------------------
>>
>> sound: enforce MASTER volume mute during playback
>>
>> MASTER mute (vol.mute) works while audio is playing.  However, if a
>> stream is stopped and restarted (PCMTRIG_STOP -> PCMTRIG_START), the
>> audio will resume even though the mixer shows the MASTER volume as
>> muted.  Other streams that are already playing remain silent.  New
>> streams may also start playing audio regardless of the MASTER mute
>> state.
>>
>> The volume feeder now considers the MASTER mute when determining whether
>> a channel should be muted.  This ensures MASTER mute is consistently
>> enforced for all streams and removes the dependency on trigger-driven
>> state propagation.
>>
>> Tested with Creative Labs CA0132 card.
>>
>> -------------------
>>
>> I am also attaching a patch for dsp.c to use chn_getmute_matrix()
>> instead of CHN_GETMUTE(), but it is cosmetic.
>>
>> Sean
>
> The patches seem reasonable, feel free to submit them for review on 
> Phabricator.

Review created:  https://reviews.freebsd.org/D55605

This does not include the patch for switching from CHN_GETMUTE() to 
chn_getmute_matrix() as it was not part of the fix for muting.  I am not 
sure if the intention was to originally use a function or macro since 
both exist.

> That being said, the issue still sounds rather strange to me, 
> especially given that I cannot reproduce this. Even though I 
> understand your analysis and it does make sense, I don't fully 
> understand exactly how this happens. The volume/muting mechanism seems 
> a bit complicated currently, because we still support the legacy mixer 
> interface of OSS (mixer.c). We keep volumes/mutes in mixer.c which 
> correspond to the OSS devices (vol, pcm, monitor, ...), but we also 
> keep volumes/mutes in channel.c, which get used by feeder_volume.
>
> I will look more into how to modernize and clean this up. For now I 
> think your patches will suffice to address this issue.

When you are unable to reproduce it, are you using the snd_hda driver or 
a different card under that driver?

After spending a long time in the sound code, I fully agree with you 
just from what I saw (and barely understood) about the complexity there. 
The volume/mute mechanism being scattered certainly made it harder to 
debug.

Thank you for looking at it.

Sean
-- 
scf@FreeBSD.org


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?b7b842ee-b4c9-0409-271b-9de37ef80d39>