Are you using #freebsd and would like to have an OSS mixer in #polybar?
Well I've just wrote an attempt at this:
https://github.com/polybar/polybar/compare/master...mazhe:polybar:module-oss.patch
The patch does apply to the current port version. Config is a bit like the alsa module:
[module/oss]
type = internal/oss
device = /dev/mixer
mixer = vol
format-volume = <ramp-volume> <label-volume>
label-muted = X muted
ramp-volume-0 = .
ramp-volume-1 = ..
ramp-volume-2 = ...
The thing I'm not sure is that maybe I should reopen /dev/mixer in case of switch?
@mazhe I shared the link with Christos who's done the recent FreeBSD OSS work, and he mentioned:
- kernel muting is available
- we have mixer(3) available
@emaste Ah! I should have a look at kernel muting, mixer(3) is tempting, but that'd mean dropping the portability -- which might not be that important given openbsd would target sndio and I'm not sure if netbsd supports OSS...
@mazhe For a kernel multing reference can look at mixer_set_mute()
...
switch (opt) {
case MIX_MUTE:
m->mutemask |= (1 << m->dev->devno);
break;
case MIX_UNMUTE:
m->mutemask &= ~(1 << m->dev->devno);
break;
case MIX_TOGGLEMUTE:
m->mutemask ^= (1 << m->dev->devno);
break;
default:
errno = EINVAL;
return (-1);
}
if (ioctl(m->fd, SOUND_MIXER_WRITE_MUTE, &m->mutemask) < 0)
return (-1);
if (ioctl(m->fd, SOUND_MIXER_READ_MUTE, &m->mutemask) < 0)
return (-1);