Re: Muting only affects audio that is playing

"Sean C. Farley" <[email protected]>
Newsgroups gmane.os.freebsd.devel.multimedia
Message-ID <[email protected]>
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
-- 
[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.