[pulseaudio-discuss] The volume control ways in PulseAudio

Tanu Kaskinen tanuk at iki.fi
Sat Jul 18 04:04:29 UTC 2020


On Fri, 2020-07-17 at 17:15 +0800, Aaron Chou wrote:
> Thanks for your email!
> 
> On Fri, Jul 17, 2020 at 4:20 PM Tanu Kaskinen <tanuk at iki.fi> wrote:
> 
> > On Fri, 2020-07-17 at 10:57 +0800, Aaron Chou wrote:
> > > Hi, all:
> > > 
> > > I am the newer about PulseAudio.
> > > When I have some time to learn it, I found that there are two ways in
> > > volume control, which is software control and hardware control.
> > > I can not understand these two ways.
> > > The software way means the volume data will not be sent to the hardware?
> > > It is unbelievable.
> > 
> > Software volume means that PulseAudio modifies the signal to be softer
> > or louder. Hardware volume means that PulseAudio sends the signal
> > unmodified and tells the hardware to the modification, which requires
> > that the hardware provides an interface for controlling the volume (I'm
> > currently using a USB sound card that doesn't provide such interface).
> > 
> em...
> I also have an appearance with a USB sound card, and something else is
> abnormal.
> Such as the volume is set to 0, but it also can play music when the system
> reboot or power off.
> So I doubt that the volume is not be set to hardware through PulseAudio.
> 
> Can I have the following flow chart:
> 
> app->pulseaudio(software control)->alsa lib->alsa driver

If you mean that can you forcibly disable hardware volume, the answer
is no, there's currently no such option.

> BTW:
> Do you know how the USB sound driver receives the volume data from
> PulseAudio?
> The ioctl? or other else? I can not determine.

PulseAudio calls snd_mixer_selem_set_playback_volume() in alsa-lib. I
don't know what that function does internally, you can look at its
implementation yourself.

-- 
Tanu

https://www.patreon.com/tanuk
https://liberapay.com/tanuk



More information about the pulseaudio-discuss mailing list