[alsa-devel] [Alsa-user] Master volume control
clemens at ladisch.de
Thu Mar 14 16:10:12 CET 2013
Paul D. DeRocco wrote:
>> snd_ctl_elem_value_set_interface(value, SND_CTL_ELEM_IFACE_MIXER);
>> snd_ctl_elem_value_set_name(value, "Master Playback Volume");
>> snd_ctl_elem_value_set_integer(value, 0, 42);
>> CHECK(snd_ctl_elem_write(ctl, value));
> Well, I finally got a chance to try this. It "works", but the
> snd_ctl_elem_write call takes a couple of milliseconds (that's around a
> million instructions on my Atom), and it apparently spends this time in
> kernel state, because it causes my sound thread to underrun, so it's not
I'd guess that some driver uses a busy loop for writing the codec
Which drivers are you using for your sound hardware?
> If I use alsamixer, I don't have this problem; I can manipulate the master
> volume smoothly while I'm playing my synth app. So I went through the
> source, and found that it's using snd_mixer_selem_set_playback_volume.
Ultimately, this is a wrapper for the snd_ctl_* functions.
More information about the Alsa-devel