[GSoC'21 Weekly Update #2] Sound mixer improvements
Christos Margiolis
christos at freebsd.org
Mon Jun 21 11:11:14 UTC 2021
Hello,
This is the last week's progress report.
mixer(3):
- Even though the OSS API works with volume values from 0 to 100, the
caller now uses normalized 32-bit float values which get converted
by the library before calling the appropriate ioctl.
- Implemented functions for getting and setting the default audio card.
- Started using some of the OSSv4 API's ioctls. Since a few of them are
missing on FreeBSD, I'm probably going to be updating the OSS kernel
drivers in /usr/src/sys/dev/sound/.
mixer(8):
- Got rid of the old implementation almost completely.
- We're now using 32-bit floats here as well.
- Added a few new options (their letters or behavior might change
in the future):
* -a for printing information for _all_ mixers available in the
system (e.g /dev/mixer0.../dev/mixerN)
* -d for setting the default audio card. The argument is the
_number_ of the audio card we want to set as the default
(e.g 0 for pcm0).
* -o for printing the mixer information in a format suitable for
scripts like /etc/rc.d/mixer. It's a replacement for the old -s
and -S options.
* -r for modifying a recording source. It's simply a different
implementation of the old mixer(8)'s `{+|-|^|=}rec rdev`
interface but it's easier to parse.
* -s for printing _only_ the recording source(s) in a mixer.
- Made the program's output similar to `pciconf -lv` since now we're
dealing with more information, and not just volume knobs. This might
change though, depending on how much we'll have to print.
- The output also includes information for the audio card associated
with the mixer, so /dev/sndstat is no longer needed to be checked.
Below is a sample output of my version of mixer(8).
The header has the mixer's audio card information, including the kernel
module. Then, the first column is the mixer device's name, the second
is the left and right volumes, the third is the panning and the last
columns have information about whether the device is a
playback/recording/recording-source device:
$ mixer_prog
pcm0:mixer: <Realtek ALC257 (Analog 2.0+HP/2.0)> on hdaa0 kld snd_hda (default)
vol = 0.80:0.80 +0.00 pbk
pcm = 1.00:1.00 +0.00 pbk
speaker = 1.00:1.00 +0.00 pbk
rec = 0.37:0.37 +0.00 pbk
ogain = 1.00:1.00 +0.00 pbk
monitor = 0.67:0.67 +0.00 rec src
The code is available on:
- GitHub: https://github.com/christosmarg/mixer
- Sourcehut: https://git.sr.ht/~crm/mixer
- My Git server: https://git.margiolis.net/mixer/files.html
The project's Wiki article can be found at:
- https://wiki.freebsd.org/SummerOfCode2021Projects/SoundMixerImprovements
--
Christos
More information about the soc-status
mailing list