You are not logged in.
Pages: 1
Hi!
I'm using arch on a laptop and I'd like to know what solutions people have found for switching the default alsa sound card based on what is plugged in.
I'd like for applications to, by default:
1) Use my USB sound card if that's available (even if HDMI is plugged in),
2) else, use my HDMI sound card if that's available,
3) else, fall back to my laptop's built-in card
Typically, I have the laptop hooked up to the USB sound card when I'm at my desk, otherwise when I've taken it somewhere it's not hooked up to anythring. I found a udev rule here which handles this situation pretty well. (I recently found a sorta nasty case this doesn't handle though: I hibernated my laptop while the USB was plugged, then unhibernated the next day after unplugging, and a few apps gave me a headache trying to figure out why they were still looking for the USB card. =P Realized it, plugged and unplugged the USB cable, and all was fine.)
Tried searching the forum but the few threads I found about this are unsolved. I'm hoping I'm just overlooking something.
Is the only way to do this to write a similar udev rule for HDMI plug/unplug, or has someone developed a more elegent method? Is there a solution for the case when you unplug something while the computer's off? Do I need to make a script that reorganizes sound card priority how I want it, then run that script every time an hdmi or usb is plugged/unplugged as well as when the system is de-hibernated?
What do other more newbie-friendly distros (Ubuntu and such) do to handle this? Is this why people use pulseaudio and such?
Thanks!
Last edited by nonis (2014-11-04 00:29:25)
Offline
Maybe this would be better off in the hardware section?
Offline
You have a highly specific usecase which I doubt many have the same requirements as you have, hence no responses. That said, that's one of the main reasons why I use "pulseaudio and such", as it makes stuff like this incredibly easy. I don't know how well it would fare in a complex setup as yours however, the most I have is an USB audio headset and an internal card, I don't use HDMI nor suspend at all. The cascading from USB -> HDMI -> internal should be doable easily enough, no idea how it fares if you unplug something while suspended though. Whats fairly easy, if the automated way fails, is to just shove everything onto a corresponding sink (e.g. gnome volume control modifies the stream db and shoves all open and opening streams to the device which you set in it, similar could probably be done with a script) read http://www.freedesktop.org/wiki/Softwar … ultDevice/ for the concept pulse has of default streams/sinks.
Ultimately you have to find something that works for you and your setup and stick with that.
Offline
I guess I didn't see the cascading soundcards issue as such a highly specific case. Ignoring the suspend/hibernate issue, I figured laptops are pretty ubiquitous and people have a need to plug them into projectors or secondary monitors or docking stations quite often, so I was hoping there was a pretty simple way of handling that. I'll look into a setup using pulseaudio or jack. Thanks for the response! [=
Offline
Pages: 1