Re: Making an (external) soundcard optional

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On So, 2009-01-04 at 21:08 +0000, Dominique Michel wrote:> Le Sun, 4 Jan 2009 21:00:35 +0000,> Dominique Michel <dominique.michel@xxxxxxxxx> a écrit :> > > Le Sun, 04 Jan 2009 19:50:06 +0100,> > Tobias Gödderz <goedderz@xxxxxxxxxxx> a écrit :> > > > > On So, 2009-01-04 at 12:15 +0000, Dominique Michel wrote:> > > > Le Sun, 04 Jan 2009 12:02:44 +0100,> > > > Tobias Gödderz <goedderz@xxxxxxxxxxx> a écrit :> > > > > > > > I have a laptop and use an Aureon 5.1 USB card from Terratec at home,> > > > > and my internal sound card if I'm on the road. I am, of course, too lazy> > > > > to switch the default soundcard manually, so I wonder if there is a way> > > > > to either> > > > > > > > > > i)  make the USB soundcard the default, and automatically use the other> > > > >     if the USB card isn't available> > > > > or> > > > > ii) use a multi device to dupe the audio stream to both cards that> > > > >     doesn't fail if one card isn't available, but silently ignores that> > > > >     and just plays on the other one.> > > > > > > > > > Of course I could write a script that changes my ~/.asoundrc if the USB> > > > > card is available or not, if there is no sane way to do it with alsa.> > > > > > > > > > > > > It must be also possible to use udev. I am no an expert, but I know that,> > > > if udev load your usb sound card before alsasound, no matter what is> > > > in /etc/modprobe.conf, the usb sound card will be the first one, that> > > > imply the default card.> > > > > > > > Most users do not want that and blacklist usb_snd_audio> > > > in /etc/modprobe,d/blacklist.> > > > > > Hm. I tried using the index=n option, and it works in the way that the> > > order is preserved, but if card 0 isn't plugged in, even at boot time,> > > alsa still tries to use it, which results in:> > > > The index option don't work if udev load the usb card before alsasound. In> > such a case, usb_snd_audio will be the first sound card because it will be> > loaded before that alsasound the sound modules for the other cards.> before that alsasound load the sound modules for the other cards.> > > > > In your case, I think that alsasound get confused. It would be better to load> > the usb sound card as last card. That way, alsasound will work, it will> > just issue an error message about the usb sound card but will load the modules> > for the other cards.> > > > After, I don't know if it is possible to make a .asoundrc file that will work> > with and without the usb card. Maybe make 2 of them and test for the usb sound> > card in ~/.profile (if using gdm) in order to symlink the one to use.> > > > As example, if /proc/asound/card1 is your usb card:> > > > CARD_FOUND=$(ls /proc/asound|grep card1)> > if [[ "$CARD_FOUND" == "card1" ]]; then> >     ln -s "/home/goedder/.asoundusb" "/home/goedder/.asoundrc"> > else> >     ln -s "/home/goedder/.asoundnousb" "/home/goedder/.asoundrc"> > fi> Sorry! That will work:> > CARD_FOUND=$(ls /proc/asound|grep card1)> if [[ "$CARD_FOUND" == "card1" ]]; then>     rm "/home/goedder/.asoundrc">     ln -s "/home/goedder/.asoundusb" "/home/goedder/.asoundrc"> else>     rm "/home/goedder/.asoundrc">     ln -s "/home/goedder/.asoundnousb" "/home/goedder/.asoundrc"> fi
Thank you.
Kind regards,
Tobias
-- open STDOUT, "|-"    and print "uJa tsonrehtP  lreahrekc"    or  print pack "nN"x4, unpack "vV"x4, <STDIN>


------------------------------------------------------------------------------_______________________________________________Alsa-user mailing listAlsa-user@xxxxxxxxxxxxxxxxxxxxxxxxxx://lists.sourceforge.net/lists/listinfo/alsa-user

[Index of Archives]     [ALSA Devel]     [Linux Audio Users]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]

  Powered by Linux