yambar/doc/yambar-modules-alsa.5.scd
Daniel Eklöf 6c10eb2153
module/alsa: use channel’s dB range instead of raw volume, if available
For channels that have a defined dB range, use that instead of the raw
volume range when calculating the volume percent.

Also use the same logic as alsamixer when calculating the percent from
the dB values: assume a linear scale if the dB range is “small
enough”, and otherwise normalize it against a logarithmic scale.

With this, yambar’s “percent” value matches alsamixer’s exactly.

The ‘volume’ tag remains unchanged - it always reflects the raw volume
values.

Instead, we add a new tag ‘dB’, that reflects the dB values.

Closes #202
2022-06-21 19:49:06 +02:00

70 lines
1.3 KiB
Markdown

yambar-modules-alsa(5)
# NAME
alsa - Monitors an alsa soundcard for volume and mute/unmute changes
# TAGS
[[ *Name*
:[ *Type*
:[ *Description*
| online
: bool
: True when the ALSA device has successfully been opened
| dB
: range
: Volume level (in dB), with min and max as start and end range
values.
| volume
: range
: Volume level (raw), with min and max as start and end range values
| percent
: range
: Volume level, as a percentage. This value is based on the *dB* tag
if available, otherwise the *volume* tag.
| muted
: bool
: True if muted, otherwise false
# CONFIGURATION
[[ *Name*
:[ *Type*
:[ *Req*
:[ *Description*
| card
: string
: yes
: The soundcard name. *default* might work.
| mixer
: string
: yes
: Mixer channel to monitor. _Master_ might work.
| volume
: string
: no
: The name of the channel to use as source for the volume level
(default: first available channel, usually "Front Left").
| muted
: string
: no
: The name of the channel to use as source for the muted state
(default: first available channel, usually "Front Left").
# EXAMPLES
```
bar:
left:
- alsa:
card: hw:PCH
mixer: Master
content: {string: {text: "{volume}"}}
```
# SEE ALSO
*yambar-modules*(5), *yambar-particles*(5), *yambar-tags*(5), *yambar-decorations*(5)