Multiple sound cards in ALSA: Force default

I put a post on my own blog and copied it here. Please comment if there’s anything wrong with it :slight_smile:

I recently purchased a Logitech Quickcam C270 and I must say I am very happy with it. The video quality is very impressive (720p!!) with Skype under Windows 7 and very good at normal SD resolutions in OpenSUSE 11.3.

One of the problems I have in OpenSUSE 11.3 was the build in microphone of the web-cam. ALSA was auto detecting the sound cards at start-up and it caused some sound problems. Particularly Flash in Firefox. The sound would not always work. Blacklisting the snd_usb_audio driver would fix my sound problem in Flash but it would, of course, mean that I can’t use the web-cam’s microphone in Skype.

There had to be a better way of doing this. After some digging in the unofficial Alsa Wiki I found a little information on Alsa’s handling of multiple sound cards. You can force a card to be the default and even specify the order in which you want to use it if you have more than 2, although I can’t imagine why you would have more than 2!
The secret is adding a option in your modprobe.d folder. In OpenSUSE 11.3 it’s called 99-local.conf and resides in /etc/modprobe.d/

First find out what the driver modules are for your sound card. I type

lsmod 

in a terminal and looked for snd modules. My 2 cards used snd_ctxfi (Creative X-FI Xtreme Gamer) and snd_usb_audio (My webcam).

Then using your text editor of choice as root (I used nano) add the following to /etc/modprobe.d/99-local.conf:

options snd slots=(card 1 driver),(card 2 driver)

So in my case the final line looked like this:

options snd slots=snd_ctxfi,snd_usb_audio

Now Alsa picks my XFi as default, Flash is happy AND I can still use my webcam for Skype! Have a look at the unofficial ALSA wiki for more information.

So, I might go into YaST / Hardware / Sound and make sure my primary audio device was “0”. I think you could have others there, even configured and perhaps do not need to blacklist them as long as your primary one is set as device “0”. This is true in openSUSE 11.3, not so much in 11.2 unless you installed alsa and Yast from the /head repositories. I do have a script file that can be used in checking out sound issues here:

S.T.A.R.T. - SuSE Terminal Audio Reporting Tool

You can create and run the START script and then get back with any results you have for us to see (or hear about).

Thank You,

Thanks for the reply, James, but unless I manually add my cards in YAST the sound configuration is blank. I had to manually add both my cards. 1 as Creative Labs X FI and one a USB audio Generic. Put my X Fi as card 0 and it indeed works if you ignore the errors thrown up by phonon. Told it to forget the cards it said it lost and it seems to work fine as well.

But this is Linux and there is always another way to do things :wink:

I added the below comment to my blog post so everyone can benifit :slight_smile: