You are not logged in.

#1 2013-10-20 02:20:45

b4nst0n
Member
Registered: 2013-08-08
Posts: 50

[SOLVED]How to Autoswitch onboard sound card and USB sound card?

I have a 5HV2 USB sound card.
and I've done these steps.
-  install asoundconf.
-  echo "snd-usb-audio" >> /etc/modules-load.d/snd-usb-audio.conf
-  add the following two lines to /etc/udev/rules.d/00-local.rules and reboot.
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'"
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'"

But it doesn't work, when I plug my USB sound card, it does't change anything.

what should I do next?

thanks for all replay.

Last edited by b4nst0n (2013-10-20 12:57:59)

Offline

#2 2013-10-20 02:24:19

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: [SOLVED]How to Autoswitch onboard sound card and USB sound card?

I don't know why you do all of that.  I have one setup that has to be idiot-proof for the user to switch between the built in 2 channel sound card on a laptop and a 7+1 channel usb sound card for use in a research lab.  I simply created two asoundrc files (~/.asoundrc2 ~/.asoundrc8) and one or the other gets copied to ~/.asoundrc (in hindsight a sym link might be better).

That's all that is needed, no changing modules, no udev rules, and no rebooting needed.

EDIT: and the two asoundrc files' contents can come from here, or check out the links in user Brebs's signature on these forums.

Last edited by Trilby (2013-10-20 02:29:24)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2013-10-20 03:01:59

b4nst0n
Member
Registered: 2013-08-08
Posts: 50

Re: [SOLVED]How to Autoswitch onboard sound card and USB sound card?

Trilby wrote:

I don't know why you do all of that.  I have one setup that has to be idiot-proof for the user to switch between the built in 2 channel sound card on a laptop and a 7+1 channel usb sound card for use in a research lab.  I simply created two asoundrc files (~/.asoundrc2 ~/.asoundrc8) and one or the other gets copied to ~/.asoundrc (in hindsight a sym link might be better).

That's all that is needed, no changing modules, no udev rules, and no rebooting needed.

EDIT: and the two asoundrc files' contents can come from here, or check out the links in user Brebs's signature on these forums.

Oh no lol, all I do is because Wiki told me to do.
On your way, it's auto switch or switch by uesr?
And I don't konw what should I put into ~/.asoundrd2 or anyother files. Just like "snd_hda_intel" and "snd_usb_audio"?
try man asoundconf and there is nothing.

BTW, I will try to add follow to /etc/modprobe.d/alsa-base.conf
options snd slots=snd_usb_audio,snd_hda_intel
options snd_usb_audio index=0
options snd_hda_intel index=1

I just want to know what does "0" and "1" means, could it auto switch?

Last edited by b4nst0n (2013-10-20 03:04:54)

Offline

#4 2013-10-20 11:37:18

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: [SOLVED]How to Autoswitch onboard sound card and USB sound card?

Oops, sorry, I misread.  I missed the *auto* part of this.  I thought you just wanted to be able to dynamically switch between the two.  To auto switch when the usb card is plugged in, that does seem like the right approach.  Is that a typo/copy-paste-error though in your udev rules?  Those should not say &gt, those should be > and >> to write to the /etc/asound.conf file.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#5 2013-10-20 12:41:31

b4nst0n
Member
Registered: 2013-08-08
Posts: 50

Re: [SOLVED]How to Autoswitch onboard sound card and USB sound card?

Trilby wrote:

Oops, sorry, I misread.  I missed the *auto* part of this.  I thought you just wanted to be able to dynamically switch between the two.  To auto switch when the usb card is plugged in, that does seem like the right approach.  Is that a typo/copy-paste-error though in your udev rules?  Those should not say &gt, those should be > and >> to write to the /etc/asound.conf file.

Holy !!

Forget anything, I did again as Wiki told me and it works great now, I don't know why. ^^

But thanks for your replay XD

Offline

Board footer

Powered by FluxBB