All of lore.kernel.org
 help / color / mirror / Atom feed
* Hotplug plugin
@ 2007-12-31 14:18 Erik Slagter
  2007-12-31 14:42 ` Lennart Poettering
  0 siblings, 1 reply; 5+ messages in thread
From: Erik Slagter @ 2007-12-31 14:18 UTC (permalink / raw)
  To: alsa-devel


[-- Attachment #1.1: Type: text/plain, Size: 2383 bytes --]

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)

[-- Attachment #1.2: S/MIME Cryptographic Signature --]
[-- Type: application/x-pkcs7-signature, Size: 3315 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Hotplug plugin
  2007-12-31 14:18 Hotplug plugin Erik Slagter
@ 2007-12-31 14:42 ` Lennart Poettering
  2008-01-01 11:29   ` Erik Slagter
  2008-01-01 18:26   ` [alsa-devel] " Erik Slagter
  0 siblings, 2 replies; 5+ messages in thread
From: Lennart Poettering @ 2007-12-31 14:42 UTC (permalink / raw)
  To: Erik Slagter; +Cc: alsa-devel

On Mon, 31.12.07 15:18, Erik Slagter (erik@slagter.name) wrote:

>  - pulseaudio, using hal-detection and "combined" device: doesn't work
> because a removed device is never reinserted into the combined
> device;

Of course it is. Just install PA 0.9.7 or newer.

Lennart

-- 
Lennart Poettering                        Red Hat, Inc.
lennart [at] poettering [dot] net         ICQ# 11060553
http://0pointer.net/lennart/           GnuPG 0x1A015CC4

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Hotplug plugin
  2007-12-31 14:42 ` Lennart Poettering
@ 2008-01-01 11:29   ` Erik Slagter
  2008-01-01 18:26   ` [alsa-devel] " Erik Slagter
  1 sibling, 0 replies; 5+ messages in thread
From: Erik Slagter @ 2008-01-01 11:29 UTC (permalink / raw)
  To: alsa-devel


[-- Attachment #1.1: Type: text/plain, Size: 1114 bytes --]

Lennart Poettering wrote:
>>  - pulseaudio, using hal-detection and "combined" device: doesn't work
>> because a removed device is never reinserted into the combined
>> device;
> Of course it is. Just install PA 0.9.7 or newer.

I have pulseaudio 0.9.7 actually installed (F8, from package
pulseaudio-0.9.7-0.17.svn20071017.fc8.x86_64) and I didn't get it to
work like you describe. I will try again if you say it should work like
this.

BTW there is one thing that puzzles me with pulseaudio, I have enabled
the "create a sink that covers all devices" (or something similar)
option, but I never see the sink. It looks like this would be the
functionality I am searching for.

I have a slight clue why it doesn't work ;-) I am running the pulseaudio
daemon system-wide (the concept of a sound daemon per user login repels
me), so the gui tools (which run with my uid) probably don't have the
access rights to change the config files. That's actually good. At
least, if I could set all parameters by editing the config files. But I
can't find the config file option for the "create an all devices device"
function.

[-- Attachment #1.2: S/MIME Cryptographic Signature --]
[-- Type: application/x-pkcs7-signature, Size: 3315 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [alsa-devel] Hotplug plugin
  2007-12-31 14:42 ` Lennart Poettering
  2008-01-01 11:29   ` Erik Slagter
@ 2008-01-01 18:26   ` Erik Slagter
  2008-01-12 23:57     ` Lennart Poettering
  1 sibling, 1 reply; 5+ messages in thread
From: Erik Slagter @ 2008-01-01 18:26 UTC (permalink / raw)
  To: alsa-devel, alsa-user, Lennart Poettering


[-- Attachment #1.1: Type: text/plain, Size: 1924 bytes --]

Lennart Poettering wrote:

>>  - pulseaudio, using hal-detection and "combined" device: doesn't work
>> because a removed device is never reinserted into the combined
>> device;
> 
> Of course it is. Just install PA 0.9.7 or newer.

Nope, really.

The relevant config file sections (using pa 0.9.7):

***

load-module module-hal-detect
load-module module-combine sink_name=all
-> master=alsa_output.pci_8086_27d8_alsa_playback_0
-> slaves=alsa_output.usb_device_8bb_2704_noserial_if0_alsa_playback_0
-> adjust_time=5 resample_method=src-sinc-best-quality

 - or -

load-module module-detect
load-module module-combine sink_name=all master=alsa_output.hw_0
-> slaves=alsa_output.hw_1 adjust_time=10
-> resample_method=src-sinc-best-quality

 - or -

load-module module-alsa-sink device=hw:0 format=s16 rate=44100
-> channels=2 sink_name=alc883 channel_map=left,right
load-module module-alsa-sink device=hw:1 format=s16 rate=44100
-> channels=2 sink_name=jvc channel_map=left,right
load-module module-combine sink_name=all master=alc883 slaves=jvc
-> adjust_time=10 resample_method=src-sinc-best-quality

***

-> is line continuation

These combinations all yield the same result: at startup I have an "all"
sink that combines both devices, and does that pretty well, I must say.
But as soon as the USB device is removed, it is removed from the
combined "all" sink. Then when the USB device is reinserted, it gets
detected (module-hal-detect) or not (module-detect, static config).
Using module-hal-detect the reinserted just sits there, it isn't added
to the combined sink. Using the other methods, it's not even detected
that the USB device is back...

The only solution I can think of, is a udev script that casts some magic
spells towards pulse when the USB device is inserted or removed... But
then I could skip pulse altogether, because mpd has an option to
activate and deactivate selected outputs at runtime, as well.

[-- Attachment #1.2: S/MIME Cryptographic Signature --]
[-- Type: application/x-pkcs7-signature, Size: 3315 bytes --]

[-- Attachment #2: Type: text/plain, Size: 228 bytes --]

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

[-- Attachment #3: Type: text/plain, Size: 158 bytes --]

_______________________________________________
Alsa-user mailing list
Alsa-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-user

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Hotplug plugin
  2008-01-01 18:26   ` [alsa-devel] " Erik Slagter
@ 2008-01-12 23:57     ` Lennart Poettering
  0 siblings, 0 replies; 5+ messages in thread
From: Lennart Poettering @ 2008-01-12 23:57 UTC (permalink / raw)
  To: Erik Slagter; +Cc: alsa-user, alsa-devel

On Tue, 01.01.08 19:26, Erik Slagter (erik@slagter.name) wrote:

> load-module module-alsa-sink device=hw:0 format=s16 rate=44100
> -> channels=2 sink_name=alc883 channel_map=left,right
> load-module module-alsa-sink device=hw:1 format=s16 rate=44100
> -> channels=2 sink_name=jvc channel_map=left,right
> load-module module-combine sink_name=all master=alc883 slaves=jvc
> -> adjust_time=10 resample_method=src-sinc-best-quality
> 
> ***
> 
> -> is line continuation
> 
> These combinations all yield the same result: at startup I have an "all"
> sink that combines both devices, and does that pretty well, I must say.
> But as soon as the USB device is removed, it is removed from the
> combined "all" sink. Then when the USB device is reinserted, it gets
> detected (module-hal-detect) or not (module-detect, static config).
> Using module-hal-detect the reinserted just sits there, it isn't added
> to the combined sink. Using the other methods, it's not even detected
> that the USB device is back...

Hmm, if that doesn't work with module-hal-detect, then please provide
me with a full output of pulseaudio -vv when this happens. However,
the ALSA ML is probably not the right place to discuss this. Please
post this in the PA ML.

> The only solution I can think of, is a udev script that casts some magic
> spells towards pulse when the USB device is inserted or removed... But
> then I could skip pulse altogether, because mpd has an option to
> activate and deactivate selected outputs at runtime, as well.

No. If module-hal-detect finds the device, but module-combine doesn't
then this is some real problem we need to debug. 

Lennart

-- 
Lennart Poettering                        Red Hat, Inc.
lennart [at] poettering [dot] net         ICQ# 11060553
http://0pointer.net/lennart/           GnuPG 0x1A015CC4

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-01-12 23:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-31 14:18 Hotplug plugin Erik Slagter
2007-12-31 14:42 ` Lennart Poettering
2008-01-01 11:29   ` Erik Slagter
2008-01-01 18:26   ` [alsa-devel] " Erik Slagter
2008-01-12 23:57     ` Lennart Poettering

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.