Mod Archive Forums

Music Production => MilkyTracker => Tracking => MilkyTracker Community => Topic started by: devnotnull on July 23, 2007, 22:54:50

Title: Making SDL with ALSA use a specific soundcard when multiple available
Post by: devnotnull on July 23, 2007, 22:54:50
For those that have more than one soundcard, SDL compiled with ALSA, and picks the wrong one, there is an env var "AUDIODEV" that can be set to the appropiate device.

Code: [Select]
export AUDIODEV=hw:1,0
Title: Re: Making SDL with ALSA use a specific soundcard when multiple available
Post by: raina on July 24, 2007, 01:01:52
Nice to know. Do you also have a cure for *buntu seemingly randomly selecting the "default" audio device on each boot?
Title: Re: Making SDL with ALSA use a specific soundcard when multiple available
Post by: devnotnull on July 24, 2007, 14:24:20
Not sure what you mean, hw:0 and hw:1 swap places randomly on each reboot ?
or just default is sometimes hw:0 and sometimes hw:1 ?

The link from IRC: http://www.stchman.com/mult_sound.html
Title: Re: Making SDL with ALSA use a specific soundcard when multiple available
Post by: segoh on July 25, 2007, 10:13:43
Do you also have a cure for *buntu seemingly randomly selecting the "default" audio device on each boot?

You can set a fixed index for each alsa device in your modprobe configurations in the /etc/modprobe.d directory (that's at least the path in Debian, see man modprobe for more information). The "default" device is normally set to hw:0.

Example: You want your Creative Soundblaster Live (snd-emu10k1) on index 0 (hw:0), your external Terractec Aureon USB (snd-usb-audio) on index 1 and the virtual MIDI device (snd-virmidi) on index 2.

Create a file /etc/modprobe.d/myalsasettings (or something like that) and insert the following:
Code: [Select]
options snd-emu10k1 index=0
options snd-usb-audio index=1 pid=0x0028
options snd-virmidi index=2

Reload the corresponding modules with rmmod/modprobe or just reboot and your done.

To check if your cards got the right index you could use aplay -l or cat /proc/asound/cards.

You can get the product ID for your USB device with lsusb:
Code: [Select]
$ lsusb | grep -i terratec
Bus 003 Device 004: ID 0ccd:0028 TerraTec Electronic GmbH