You are not logged in.

#1 2009-08-01 15:42:28

cosma
Member
Registered: 2008-12-15
Posts: 10

ALSA and driving two sound cards..

Hello,

I have a notebook with two sound devices: the integrated one, and an external USB sound card (that I use as an input device for musical instruments and as headphone amp).

Now, is there a way to configure ALSA for "fast switch" between the two? I need to use my internal one when the notebook is away from its desk, and still quickly use the USB instead when available.

I've tried to configure PulseAudio but I found that is a complete mess to setup.. so I'd like to find a solution using only ALSA.
Any ideas?

Thank you very much!!!

Cosma

Offline

#2 2009-08-02 04:05:10

Themaister
Member
From: Trondheim, Norway
Registered: 2008-07-21
Posts: 652
Website

Re: ALSA and driving two sound cards..

The only way to do this I think is to make a script that changes /etc/asound.conf according to what main soundcard you want. It could be possible making a small daemon that constantly checks if your usb soundcard is plugged in or not, and switches the config immediately. I bet some files in the /sys dir would only be present when your USB card is connected, which you can use as a base for your script. It shouldn't be too hard, check the wiki on how to configure ALSA for each card. When you got that down, try to automize the change, if possible. It feels kinda hacky, but it feels kinda KISS too, not sure.

So, no, I don't you can configure ALSA directly to auto-switch. As far as I know, ALSA only respects /etc/asound.conf (or ~/.asoundrc if you will)

Last edited by Themaister (2009-08-02 04:06:56)

Offline

#3 2009-08-02 08:05:07

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: ALSA and driving two sound cards..

Fastest method would probably be to use xbindkeys to bind keystrokes to sed commands which operate on ~/.asoundrc, changing the definition of pcm "default".

Apps need a restart, to detect changes in ~/.asoundrc

Last edited by brebs (2009-08-02 08:06:02)

Offline

Board footer

Powered by FluxBB