On Fri, 2011-06-17 at 12:15 +0100, Colin Guthrie wrote: > 'Twas brillig, and Colin Guthrie at 20/05/11 09:50 did gyre and gimble: > > Hello, > > > > 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 > > patches). > > > > 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 > > asymmetry) > > > > 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: > > http://colin.guthr.ie/git/pulseaudio/log/?h=master-source-volume > > git://colin.guthr.ie/pulseaudio (master-source-volume branch) > > > > For convenience of testing you can also use this patch to pavucontrol: > > http://colin.guthr.ie/git/pavucontrol/log/?h=master-source-volumes > > Any further comments on this or can I merge? Sorry -- I actually did try the code again but missed you on IRC, then went out of circulation for a few days. I'll add fixes for the passthrough and echo-cancel bits after you merge, they should be pretty small. I tested with multiple parec streams and it all looks good. I did notice something weird though -- with gnome-sound-recorder (which uses pulsesrc), adjusting the stream volume made the client whose volume I adjusted get only noise. Not sure what's happening there, and haven't had a chance to dig in yet. Other than this obviously being a problem for pulsesrc, would be nice to figure this out so we know if other clients also need fixing. Cheers, Arun