[alsa-devel] amixer sset volume: Left/Right race
Eric Rannaud
eric.rannaud at gmail.com
Wed Nov 29 05:42:49 CET 2017
In my ~/.xbindkeysrc I have
"amixer set Master 1000+"
XF86AudioRaiseVolume
"amixer set Master 1000-"
XF86AudioLowerVolume
When I hold the "volume up" key on my keyboard, the left and right
channel volumes quickly get out of sync.
This is reproducible with this shell loop:
for i in $(seq 20); do amixer sset Master 1000+ & done
But not with this loop:
for i in $(seq 20); do amixer sset Master 1000+; done
It appears that xbindkeys invokes multiple amixer concurrently, like
the first shell loop, and that amixer/ALSA is somehow setting the
channel volumes one at a time, presumably in an unprotected
read-modify-update critical section. I'm not familiar with how this
works, and where the blame might lay.
However, pamixer
(https://github.com/cdemoulins/pamixer/blob/master/pulseaudio.cc) uses
/usr/include/pulse/pulseaudio.h and
pa_context_set_sink_volume_by_index() directly and does not have this
problem.
for i in $(seq 20); do pamixer --increase 1 & done
Thanks.
P.S. The "Bug Tracker" link on the left of
http://alsa-project.org/main/index.php/Main_Page is broken.
More information about the Alsa-devel
mailing list