LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   Switching sound devices (http://www.linuxquestions.org/questions/slackware-14/switching-sound-devices-4175444110/)

narz 01-04-2013 04:05 AM

Switching sound devices
 
I feel silly asking this, but I have no idea what I'm doing.

I have a Logitech USB headset with it's own internal sound card. Is there a simple way of switching between my onboard sound card and my headset? I have yet to actually even figure out how to use my headset. I can't switch sound cards with xfce mixer or alsamixer by themselves.

I'm finding a lot of random documentation that's either old, leaning toward other distributions configurations or pulseaudio related stuff. I found this http://alsa.opensrc.org/MultipleCards, but I don't know what is useful to me in that documentation.

Anyone can give me a simple explanation of how I accomplish this?

Thank you!!

tuxbg 01-04-2013 04:17 AM

If you won't your USB headset to be primary sound device when system boot,then you have to create a file in /lib/modprobe with that content

options USB kernel module index=0
options other card module index=1

To view which module is used by system run that command lspci -vvv

Sorry for my english :)

This is mine i have a intel audio card and creative sound blaster,my creative card is a primary device

options snd-ctxfi index=0
options snd-hda-intel index=1

narz 01-04-2013 05:48 AM

Hi I'm looking to switch between the two in the same session. I'd rather not reboot my computer every time I want to use headphones. This is possible to do right?

narz 01-05-2013 06:02 PM

Ok update and I'm not sure if there's a better way to do this but I found a sample udev rule on an Arch blog that lets me accomplish this.

Code:

# Set USB headset as default sound card when plugged in
KERNEL=="pcmC[D0-9cp]*", ACTION=="add", PROGRAM="/bin/sh -c 'K=%k; K=$${K#pcmC}; K=$${K%%D*}; echo defaults.ctl.card $$K > /etc/asound.conf; echo defaults.pcm.card $$K >>/etc/asound.conf'"

# Restore default sound card when USB headset unplugged
KERNEL=="pcmC[D0-9cp]*", ACTION=="remove", PROGRAM="/bin/sh -c 'echo defaults.ctl.card 0 > /etc/asound.conf; echo defaults.pcm.card 0 >>/etc/asound.conf'"


Though it works, it seems a little quirky. As applications like Audacious will spit out a warning "snd_mixer_find_selem failed" when you use it with your headset.

john2 02-26-2013 11:37 AM

I don't know about alsa, but if you use PulseAudio Volume Control (package name pavucontrol), you can choose outputs on the Playback tab when a sound source is operating (dropdown on the right above the audio stream volume sliders).

ReaperX7 02-26-2013 10:16 PM

Slackware does not use PulseAudio.

alsamixer should be able to assign a primary sound card, or you can manually define it in /etc/modules.conf


All times are GMT -5. The time now is 10:53 PM.