[alsa-devel] Hotplug plugin

Erik Slagter erik at slagter.name
Mon Dec 31 15:18:11 CET 2007

Sorry for crossposting, but this is a problem I am not quite sure might
be solved by users or developers. Also I am not too lazy to do a little
development myself, if that appears to be necessary.

This is my setup:

- internal snd-hda soundcard connected to speakers in the bathroom
playing 24x7 music;
- jvc amplifier in living room with integrated USB sound device.

The USB sound device in the amplifier vanishes when the amplifier is
powered down.

So... this is my problem. I want to have 24x7 music on the internal
soundcard and on the amplifier. When the amplifier is switched off, no
audio should be send there (of course) but playback should resume as
soon as the amplifier is switched on and the USB device re-appears.

I created a "tee" construction using asound.conf which adresses both
soundcards, this works. At least... until the amplifer is switched off
and the USB device disappears. Then the sound playing application gets
an error and quits.

I tried these approaches for a solution:

 - pulseaudio, using hal-detection and "combined" device: doesn't work
because a removed device is never reinserted into the combined device;
 - alsa extplug: easy to create, no worries about the "slave" device,
you get it for free, but I abandoned the idea as there is probably no
way to recreate the slave pcm while the "owner" remains active.
 - alsa ioplug, attempt 1: there is probably no way to to address and
recreate the "slave" (which I open myself in the plugin using
snd_pcm_open) in such a way that it is completely transparent to the
application that it is talking to the "slave" (not a "real" alsa slave)
instead of the ioplug plugin
- alsa ioplug, attempt 2: I tried to make the callback functions of the
ioplug call the callbacks of the "slave" directly, but that probably
isn't going to work either (too much callbacks in the pcm struct that
have no equivalent in the ioplug struct)
- alsa ioplug, attempt 3: open and write to the hardware devices
directly. Abonded it as well because this cannot practically be done, as
you'd need parts copies of header files from the kernel and alsalib for
hidden data structures.

Anyone ideas to solve this in a neat way? (preferrably using an alsa
plugin; for the moment I am using a self-made external program that alsa
dumps it sound to (file plugin) and uses two alsa-player processes to
get the audio to the devices)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3315 bytes
Desc: S/MIME Cryptographic Signature
Url : http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20071231/5ec990d9/attachment.bin 

More information about the Alsa-devel mailing list