[pulseaudio-discuss] [RFC] Source Output Volumes

Colin Guthrie gmane at colin.guthr.ie
Fri May 20 01:50:24 PDT 2011


As some of you know I've been working on restoring a little more
symmetry to our API to allow the adjustment of source output (capture
stream) volumes.

In the past, when stream volumes were added to sink inputs, it was
thought that this feature wouldn't be overly useful for capture streams
and while this argument still holds true, there is one feature that has
since been added to PA that would make it useful - flat volumes.

Flat volumes allow for multiple streams to be connected to the same
device and when they differ in stream volume, the maximum one is chosen
and the h/w is set to that, with the difference in volume between the
streams applied in software. This in theory allows for optimum power
efficiency where the software stays out of the loop whenever possible.

With flat volumes, adding per-stream volumes to capture streams makes sense.

It does also simplify client code when they want to adjust their own
volumes, they don't have to implement their own asymmetry to deal with ours.

So I am proud to announce my work to try and achieve this. There are no
doubt still bugs, so a thorough review is very much appreciated.

I will not post patches to the list (unless screamed for) as some of
them are necessarily rather large (+400 and +2k lines in the biggest

Most of the code is mirrored from the sink or sink input side. There is
a lot of scope to cut down on code duplication but for the purposes of
getting this out there I'll leave that for after the next release.

In some cases, applying the patch and comparing e.g. sink.c with
source.c is a better way of reviewing the changes (while there are still
several differences it isn't too hard to compare them).

I originally added support for synchronised streams for recording but
then realised that this makes little sense practically and removed it
again. I did the removal in a separate commit as it may be easier to
compare the sink vs. source files before this patch to cut down on

Known niggles;
There are still some strange things with volumes. The flat volume stuff
doesn't seem to work perfectly as when adjusting a recording stream
volume down from NORM, the h/w volume does not drop... only when the
hardware volume has been moved down to 0 and back to NORM does flat
volume stuff work seem to work properly.

I think there are still a few niggles with volume setting generally (for
outputs too) as I still have a problem reported earlier that the initial
volume of things is disconnected to the h/w state and while PA thinks
it's got 100% it's actually not... I still need to look at that properly.

So without further ado, here is the branch for review:
git://colin.guthr.ie/pulseaudio (master-source-volume branch)

For convenience of testing you can also use this patch to pavucontrol:

Have fun!



Colin Guthrie

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mageia Contributor [http://www.mageia.org/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]

More information about the pulseaudio-discuss mailing list