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)
Sun, Nov 17, 11:29 AM
Unknown Object (File)
Fri, Nov 15, 7:19 AM
Unknown Object (File)
Oct 11 2024, 1:11 AM
Unknown Object (File)
Oct 11 2024, 1:08 AM
Unknown Object (File)
Oct 11 2024, 1:08 AM
Unknown Object (File)
Oct 10 2024, 10:11 PM
Unknown Object (File)
Oct 3 2024, 10:09 AM
Unknown Object (File)
Oct 3 2024, 12:57 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 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