You are not logged in.
Pages: 1
I have laptop with external sound card and I would like to use the external one when its connected and the internal one when its not.
What have I done
I made simple udev rule which switches the default sound card like this:
su - $USER -c 'asoundconf set-default-card DAC'Asoundconf is a simple python script which makes changes to local asoundconf
Problem with my solution
It works without issues when I'm not playing anything while connecting or disconnecting the card, but for example if I'm playing something on Spotify with the internal card and then connect the external one Spotify keeps on playing on my laptop speakers, but forgets the volume configurations. And if I'm playing something on the external card and then unplug it Spotify crashes.
What I want
Running programs to detect the sound card change automaticly
Alsa to remember volume configurations
Spotify to stop crashing when it loses the sound card
Last edited by oilgame (2013-12-29 03:40:15)
Offline
Running programs to detect the sound card change automatically
I think you'll need pulseaudio.
Offline
oilgame wrote:Running programs to detect the sound card change automatically
I think you'll need pulseaudio.
Thank you. I was hoping I could manage without a sound server.
Offline
I decided to install pulseaudio and now my problem is that I can't control pulseaudio without X.
paswitch alsa_output.usb-Burr-Brown_from_TI_USB_Audio_DAC-00-DAC.analog-stereoWorks beautifully in X, but when I run it via SSH from example I get:
pa_context_connect() failed: Connection refused
can't get pulseaudio context.EDIT: Managed to bypass the problem by running pulseaudio as system-wide instance.
Last edited by oilgame (2013-12-28 14:41:43)
Offline
Noticed that it isn't too smart to run pulseaudio as system-wide instance, what other options do I have?
Offline
to make it work over network, allow tcp connections... or copy over your pulse cookie file.
He hoped and prayed that there wasn't an afterlife. Then he realized there was a contradiction involved here and merely hoped that there wasn't an afterlife.
Douglas Adams
Offline
to make it work over network, allow tcp connections... or copy over your pulse cookie file.
So this should work out of the box, because I obviously have the pulse cookie file myself?
laasonen@t430s ~ % pactl stat | grep "alsa_output" | cut -d " " -f 3
alsa_output.usb-Burr-Brown_from_TI_USB_Audio_DAC-00-DAC.analog-stereo
alsa_output.pci-0000_00_1b.0.analog-stereo.monitor
laasonen@t430s ~ % sudo su - laasonen
laasonen@t430s ~ % pactl stat | grep "alsa_output" | cut -d " " -f 3
Connection failure: Connection refused
pa_context_connect() failed: Connection refused
laasonen@t430s ~ % ls -la .pulse-cookie
-rw------- 1 laasonen laasonen 256 Dec 18 03:32 .pulse-cookie
laasonen@t430s ~ %I managed to archive the behavior I was looking for by loading "module-switch-on-connect"-module in default.pa, but I really would like to know how to manage pulseaudio in automatized scripts.
Last edited by oilgame (2013-12-29 13:18:15)
Offline
Pages: 1