[alsa-devel] Alsa: Get Playback Volume fails if set by outside source

Ashwin Chandra Ashwin.Chandra at corel.com
Fri May 16 03:34:03 CEST 2008


I am having an issue with the Alsa mixer. Currenty I have a function
that gets the volume via snd_mixer_selem_get_playback_volume. This
function works fine to get the last-set volume if my application is
setting the volume. However if I change the volume using an outside
source, such as alsamixer or gnome-volume-control and then I run the
above function, the old volume that my application had set last is


Now I edited amixer's source code to put a while(1) around the same
functions (the snd_mixer_selem_get_playback_volume), and it too does not
get the correct volume if set from an outside source. Alsamixer on the
other hand seems to work find, but I am not quite sure how they do it. I
thought maybe I had to reinitialize the alsa interface (ie.
snd_mixer_close...and then open, attach, register, etc), but it doesn't
seem that alsamixer does that. 


Does anyone have any suggestions about what I can do to get the correct
volume if set by an outside source??



More information about the Alsa-devel mailing list