This is the route to hell
So I would like to take a few minutes to talk about audio routing in PulseAudio. This is a oft misunderstood topic and it does sometimes seem like black magic and/or broken but, as always, it's pretty simple when you look at it properly. That's not to say it's sensible (I have a several reservations about the current way of working), but the first step to improving something is understanding it, so I'll try to explain here and then say what I think is needed to improve it. This is a rather complex and in depth post, so if this kind of stuff doesn't float your boat, it's a good candidate to skip :p
Mix it some more
OK, so this is really just an update on my earlier post about KMix PulseAudio integration.
I've spent quite a lot of time refining the initial support I added a few weeks back. What follows is a brief summary of the changes/improvements/bugfixes.
Mix it up
Hot on the heels of my Phonon PulseAudio integration, here is another set of patches for kdemultimedia that adds PulseAudio support to KMix \o/
Quick screenie before a more detailed description:
PulseAudio Phonon Support now in KDE trunk and heading towards 4.4
I've very pleased to announce that my work on Phonon to integrate support for PulseAudio has now been committed to trunk and will form part of KDE 4.4 \o/
There were a few teething problems due to some last minute merges I did (which I clearly didn't test properly - my bad) and which I then went on to mis-interpret which led me to commit two rather silly things in phonon (a revert and then a revert of that revert!). What can I say... I need more caffeine obviously!
Mandriva 2010.0 is out!!
I'm very pleased to say that Mandriva 2010 is now out! Checkout What's New! Also see the Release Notes and Errata.
Myself and the rest of the Mandriva Developers and Contributors have put in a lot of work this time round. I'm pretty happy with the PulseAudio->Phonon integration work I did for KDE which builds on our previous approaches which were not quite as functional (although did at least hide potential configuration problems from users unlike on some distros! (for which the usual "solution" was a urpme/yum remove/apt-remove pulseaudio rather than actually finding the real cause!)
Anyway, anyone looking for a change or wanting to see what other distros have to offer, I really encourage you to take it for a spin!
So how does the KDE PulseAudio support work anyway?
So I think it's probably worth me writing up just exactly how the PulseAudio support in KDE's Phonon library actually works and why using it will give you some nice extra features!
Update on KDE+PulseAudio
Just a small note to update on the progress.
The Test button now selects the right device. The way of achieving this is a little convoluted, but it seems to work well. We now generate a UUID for every phonon stream and push this into the PulseAudio stream proplist via an environment variable. We then look for all the streams in pulse and match up our UUID such that we can match up the pulse stream index to our phonon stream. We can then use this to move the stream to the appropriate device. Due to the async nature of PulseAudio, phonon sometimes requests the move before the stream is actually setup, so we have to queue up the move requests and process them when a stream appears. This approach also has the effect of causing the specific sink to be saved in module-stream-restore database, but this shouldn't matter in practice as phonon will always move it, so if the priority list changes, then we will always set the right device one way or the other even if the whole rigmarole could be avoided. But like I say, the practical outcome is fine, so let's just leave that for now.
The category is also passed through to PulseAudio now, so the the only thing that is not handled is when PulseAudio disconnects/restarts. Thankfully this is now getting less and less often as stability improves
KDE + PulseAudio != Sucks
So I've been spending altogether far too much time on getting this stuff working, but it's finally in a state where it no longer sucks.
For several releases we (Mandriva) have been patching KDE's phonon support to hide all the real devices if PulseAudio is used because the GUI really makes no sense (PulseAudio handles all the routing for us). This is an acceptable solution but it's far from ideal.
So with the latest set of three patches (one for pulseaudio, one for phonon and the final one for kdebase4-runtime) I now have a fully working system (albeit with some caveats!).
What’s cooking in the Pulse Pot
While I've done a bit of pavucontrol hacking, the most interesting stuff is happening in pulse itself, specifically in relation to better KDE support...

