Page MenuHomeFreeBSD

sound(4): mixer: implement (un)muting
ClosedPublic

Authored by christos on Jul 10 2021, 11:07 AM.
Tags
None
Referenced Files
F82035217: D31130.id92528.diff
Wed, Apr 24, 8:38 PM
Unknown Object (File)
Sun, Apr 21, 9:22 PM
Unknown Object (File)
Sun, Apr 21, 9:22 PM
Unknown Object (File)
Sun, Apr 21, 9:22 PM
Unknown Object (File)
Sun, Apr 21, 9:22 PM
Unknown Object (File)
Sun, Apr 21, 9:22 PM
Unknown Object (File)
Thu, Apr 18, 3:48 PM
Unknown Object (File)
Feb 15 2024, 7:30 AM
Subscribers

Details

Summary

Re-implemented the SOUND_MIXER_WRITE_MUTE and SOUND_MIXER_READ_MUTE
ioctls. These two ioctls were not part of the current version of OSS and were considered
obsolete. However, their behaviour is not the same as their old one, so this implementation
is not backwards compatible.

Older OSS versions had the MUTE ioctls take/return an integer with a value of 0 or 1,
which meant that the _whole_ mixer is unmuted or muted respectively. In my
implementation, the ioctl takes/returns a bitmask that tells us which devices are muted.
This allows us to (un)mute only the devices we want, instead of the whole mixer. The
bitmask works the same way as in DEVMASK, RECMASK and RECSRC.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

christos created this revision.
sys/dev/sound/pcm/mixer.c
382

Can you explain what the += is doing?

Possibly you want:

if (mixer_set(mixer, i, v))
ret = XXX;

sys/dev/sound/pcm/mixer.c
382

Can you explain what the += is doing?

It collects the return values of mixer_set. Without any errors they should
all be zero, so we'll return a non-zero value only in case of an error. I did it so
we go through all devices and not return from mixer_setmute the first
time mixer_set fails.

Possibly you want:

if (mixer_set(mixer, i, v))
ret = XXX;

That's a good idea as well.

sys/dev/sound/pcm/mixer.c
357

Have you checked if this function needs any serialization?

751

The mixer object is allocated using M_ZERO, so you can remove this "= 0" I think.

762

Ditto.

christos added inline comments.
sys/dev/sound/pcm/mixer.c
357

Have you checked if this function needs any serialization?

357

Have you checked if this function needs any serialization?

Not really. Can you elaborate more on this?

christos marked an inline comment as not done.Jul 11 2021, 12:24 PM
This revision is now accepted and ready to land.Jul 21 2021, 8:38 AM