Page MenuHomeFreeBSD

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

Authored by christos on Jul 10 2021, 11:07 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Apr 18, 3:48 PM
Unknown Object (File)
Feb 15 2024, 7:30 AM
Unknown Object (File)
Feb 12 2024, 2:44 PM
Unknown Object (File)
Feb 7 2024, 7:30 PM
Unknown Object (File)
Dec 22 2023, 10:21 PM
Unknown Object (File)
Dec 19 2023, 8:24 AM
Unknown Object (File)
Dec 10 2023, 2:31 PM
Unknown Object (File)
Nov 27 2023, 2:12 PM
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 Skipped
Unit
Tests Skipped

Event Timeline

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

Can you explain what the += is doing?

Possibly you want:

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

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

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
368

Have you checked if this function needs any serialization?

779

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

791

Ditto.

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

Have you checked if this function needs any serialization?

368

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