[pulseaudio-discuss] Automatic selection of an audio sink depending on value of ENV variable

Leszek Koltunski leszek at koltunski.pl
Tue Oct 20 08:20:49 PDT 2009


> As the others already pointed out, the X11 props stuff is what you
> want.
> 
> Try something along these lines:
> 
> $ pax11publish -D :0 -O foobar -e
> $ pax11publish -D :1 -O waldo -e
> 
> Where foobar and waldo are the two logical PA sink names to use.

First, a clarification: I was wrong saying that my TV is "1.0" - turns
out I am running one X server and 2 X screens, "0.0" and "0.1".

******************************************************************************************

So here's what I've tried:


leszek# pacmd list-sinks | grep name | grep output
	name: <alsa_output.pci-0000_00_07.0.analog-stereo>
	name: <alsa_output.pci-0000_01_06.0.analog-stereo>

leszek# pax11publish -D ":0.0" -O
alsa_output.pci-0000_01_06.0.analog-stereo -e

leszek# xprop -root | grep PULSE      ## on monitor "0.0"
PULSE_COOKIE(STRING) =
"3ac2381a17c704d94ef0edb1b8fdf289ff003587b59a45d6ae3aa0f3c1586032192d180896ffb9412193d7531ea1cdddd869e53c3c3ffb9c2c5fcd0dd036baccdac959992a599fa398823fb35d61a07fd17466e095cc00ffa22c9c14ff9d982ee368c6c16c24014b150bbed5facac7b37c35507b4fb73d9d0bd2efe22bbd4f86a7de42d8d105c8900ecc3462f0dece7d1a6b845275b095a301112544f1409ab3beb84989bc5ae19459b57c3415275334b849824659c9696e6c797d46be53d0957831569fa9a535713a8a1f216cfa7aeb6d6faa35f4b9a7fed5f4fc21dfb47ca9514f26fd118f09836e5c2308be49254189d967c20d258a65cd1fc2d4aa2f2652"
PULSE_SINK(STRING) = "alsa_output.pci-0000_01_06.0.analog-stereo"
PULSE_SERVER(STRING) = "leszek-desktop"
PULSE_SESSION_ID(STRING) =
"571eae318b6377f95367e6524abdec09-1256048477.493671-985655645"

Not I try to play something from 0.0 - it gets played to the correct
( i.e. alsa_output.pci-0000_01_06.0.analog-stereo ) soundcard.

Now I try 

leszek# pax11publish -D ":0.0" -O
alsa_output.pci-0000_00_07.0.analog-stereo -e

and I try playing something - it correctly gets played to
alsa_output.pci-0000_00_07.0.analog-stereo. So far, so good.

Now the final test: lets match the soundcard with the X screen:

leszek# pax11publish -D ":0.0" -O
alsa_output.pci-0000_01_06.0.analog-stereo -e
leszek# pax11publish -D ":0.1" -O
alsa_output.pci-0000_00_07.0.analog-stereo -e

leszek# xprop -root | grep PULSE      ## on monitor "0.0"
PULSE_COOKIE(STRING) =
"3ac2381a17c704d94ef0edb1b8fdf289ff003587b59a45d6ae3aa0f3c1586032192d180896ffb9412193d7531ea1cdddd869e53c3c3ffb9c2c5fcd0dd036baccdac959992a599fa398823fb35d61a07fd17466e095cc00ffa22c9c14ff9d982ee368c6c16c24014b150bbed5facac7b37c35507b4fb73d9d0bd2efe22bbd4f86a7de42d8d105c8900ecc3462f0dece7d1a6b845275b095a301112544f1409ab3beb84989bc5ae19459b57c3415275334b849824659c9696e6c797d46be53d0957831569fa9a535713a8a1f216cfa7aeb6d6faa35f4b9a7fed5f4fc21dfb47ca9514f26fd118f09836e5c2308be49254189d967c20d258a65cd1fc2d4aa2f2652"
PULSE_SINK(STRING) = "alsa_output.pci-0000_00_07.0.analog-stereo"
PULSE_SERVER(STRING) = "leszek-desktop"
PULSE_SESSION_ID(STRING) =
"571eae318b6377f95367e6524abdec09-1256048477.493671-985655645"

leszek# xprop -root | grep PULSE      ## on TV "0.1"
(nothing)

and the sound always gets played to the TV's soundcard
( alsa_output.pci-0000_00_07.0.analog-stereo ), no matter if I fire up
my SoundApp from TV or monitor.

************************************************************************************

Seems to me that 'pax11publish' disregards the screen number given in
its -D parameter and only pays attantion to the X server number. 
for every N, pax11publish -D ":0.N" overwrites the X11 properties of
"0.0".

What am I missing here? 




More information about the pulseaudio-discuss mailing list