I have a USB headset which I occasionally plug into my laptop. When I do so, I have to put the following in ~/.asoundrc
to get it to work:
defaults.ctl.card 1
defaults.pcm.card 1
defaults.timer.card 1
This causes a couple of problems. Firstly, any running programs which are using ALSA continue to use the laptop's internal sound card. Secondly, if I remove the USB headset, I have to edit ~/.asoundrc
again, and restart applications using sound.
So this is really a two-part question:
- How can I configure ALSA so that it allows me to state 'use sound device 1 if available, else use sound device 0'?
- How can I configure ALSA to move output from one device to another if one of the devices disappears (or a preferred device appears)?