Hi,
I spent a bit of time today on an ALSA-level sound mixing solution, i.e. this bug:
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=130593
Basically my solution was to allocate the IPC keys at the start of the X session, and generate an ALSA config file on login which uses those keys. This avoids issues with possible IPC key collisions and is more secure. There's a little program alsa-launch which does this. It monitors your X connection and destroys the IPC keys and such when you log out.
I had to patch alsa-lib to let it read a config from a file specified an environment variable. alsa-launch is part of alsa-utils now. I'm sure some people will complain this makes alsa-utils dependent on X; I guess we'll need an alsa-utils-x11 package.
Also, I needed to add alsa-launch to the X startup; however there was no programmatic way to do this in the current xinitrc setup. So I refactored the X init scripts so that packages can drop a file in /etc/X11/xinit/xinitrc.d/ which adds to the DESKTOP_SERVICES environment variable. I then modified the dbus package to use this new variable.
All the new packages are here: http://people.redhat.com/walters/alsa/
These are based off the new ALSA 1.0.7 packages I uploaded to rawhide today.
I'd like to get feedback on this and see how well it works for people; I've just done some light tests with ogg123, rhythmbox, and xmms. Particularly interesting is recording and complex ALSA applications. Oh, and multiple sound cards.
If there are no objections I'd like to feed this all into rawhide in a few days after it's gotten a bit of testing here and see how things go. Hopefully for FC4 the idea of configuring applications for different sound output backends will totally disappear.
Longer term of course I'd like to not have to generate an ALSA config file in /tmp; this kind of thing just makes sense inside the alsa-lib code itself. But this was just a quick one-day hack to see how well asym could work as the default.
Comments appreciated.
Colin Walters (walters@redhat.com) said:
Longer term of course I'd like to not have to generate an ALSA config file in /tmp; this kind of thing just makes sense inside the alsa-lib code itself.
Why /tmp instead of $HOME? (In fact, why doesn't alsa-lib by default read configs out of $HOME to override /etc anyway?)
Bill
On Thu, 2005-01-06 at 23:22 -0500, Bill Nottingham wrote:
Colin Walters (walters@redhat.com) said:
Longer term of course I'd like to not have to generate an ALSA config file in /tmp; this kind of thing just makes sense inside the alsa-lib code itself.
Why /tmp instead of $HOME? (In fact, why doesn't alsa-lib by default read configs out of $HOME to override /etc anyway?)
NFS home dirs.
On Thu, 06 Jan 2005 22:55:59 -0500, Colin Walters wrote:
I had to patch alsa-lib to let it read a config from a file specified an environment variable.
Maybe we could set the environment variable to the IPC key itself then use something like:
pcm.dmix { @args [ SLAVE FORMAT RATE ] @args.SLAVE { type string default "hw:0,0" } @args.FORMAT { type string default S16_LE } @args.RATE { type integer default 48000 } type dmix ipc_key { @func getenv vars [ ALSA_DMIX_IPC_KEY ] default { 12345678 } } ipc_key_add_uid no slave { pcm $SLAVE format $FORMAT rate $RATE } }
pcm.!default { type plug slave "pcm.dmix" }
which is a slightly modified version of the default ALSA config file. Then there'd be no need to generate config files or patch alsalib.
And yes, I know, possibly ALSA should not provide a mini API in its config file but well that's an argument for upstream :) We have it, might as well use it ...
thanks -mike
On Fri, 2005-01-07 at 13:26 +0000, Mike Hearn wrote:
On Thu, 06 Jan 2005 22:55:59 -0500, Colin Walters wrote:
I had to patch alsa-lib to let it read a config from a file specified an environment variable.
Maybe we could set the environment variable to the IPC key itself then use something like:
Good idea. I hacked this up a bit to fix some bugs and add a few more default buffer size bits, and uploaded it and alsa-launch to rawhide.
Once this patch goes in: https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=144554 alsa-launch will run and asym should be transparently enabled.
On Sat, 08 Jan 2005 01:30:57 -0500, Colin Walters wrote:
Good idea. I hacked this up a bit to fix some bugs and add a few more default buffer size bits, and uploaded it and alsa-launch to rawhide.
Cool. If this works out it'd be nice to get alsa-launch upstream and have some document on the ALSA wiki explaining how other distribution vendors can set this up.
thanks -mike
desktop@lists.fedoraproject.org