On Sun, Aug 12, 2012 at 12:41:24AM +0200, Tom Gundersen wrote:
On Sun, Aug 12, 2012 at 12:31 AM, Fons Adriaensen <fons@linuxaudio.org> wrote:
First, PA has no visibility on whatever internal volume control an app provides. It just doesn't know about it. All it gets is the output from the app.
This is not correct. If the app has proper PA support (such as all KDE apps, and probably all gnome apps), then PA does the app specific mixing, not the app itself.
That doesn't stop the app from having its own internal volume control that PA doesn't know about.
Moreover, if only one app is playing sound then PA does no mixing at all, but passes it all directly to ALSA (and sets ALSA's controls of course).
If that is true it is completely wrong from the start. Because that setup can't be maintained when a second app starts playing which can happen at any time. Suppose that first (single) app has its volume set to some low value, and PA uses the soundcard PCM gain control to achieve that as you claim it does. Now suddenly there's a second app which wants a higher level. The only way to achieve that is to raise the hardware gain - you can't compensate for a low setting there by sending a louder signal, it would just clip. So PA now has to adjust the hardware gain and at the same time start scaling down the output from the first app. It's impossible to do that in any acceptable way. Simple fact is that most soundcards, even if they have a 'mixer', can't mix PCM signals (i.e. signals from the software) - they can mix in a CD player, or an external mic input etc.). So for anything coming from the system there is just one path, which has two controls, the 'PCM' and the 'master'. The only way to correctly use them if there if there is software mixing is to set them once to their correct values (which may depend on what is connected externally), and them leave them alone and do the rest in software. And then we haven't even touched the matter of different sample rates.
Second, PA has no way to know how to correctly use the soundcard controls, or even to know what exactly they control and how they do it. On some cards the 'master' is digital scaling before the D/A converter. On some others it controls an analog gain stage after the converter. The correct way to use those is completely different.
If I understand correctly ALSA provides lots of meta-information about the controllers to PA. Before PA this meta information was ignored, and it is due to bugs in that that PA had a bad reputation in the beginning.
'A lot of meta-information' LOL. It will provide some usually meaningless and inconsistent names of controls, their min and max values, and if you're extremely lucky maybe some indication mapping control values to dB, which may or may not be correct (and if it isn't that's not ALSA's fault, it just crappy and undocumented harware). All of that is visible in alsamixer.
PA has heuristics to try to do the best it can with the information provided to it. Are you saying that an unqualified user is likely to get a better result than these heuristics?
Yes, absolutely. It may take the user some time to understand the quirks of his soundcard (such as that it's not capable of outputting full digital level without distortion, no matter how the controls are set, or even crappier shortcomings). But he will usually find a way to get things working. Which is impossible without hearing the result. Maybe PA has some magic powers to do that. Ciao, -- FA A world of exhaustive, reliable metadata would be an utopia. It's also a pipe-dream, founded on self-delusion, nerd hubris and hysterically inflated market opportunities. (Cory Doctorow)