Difference between revisions of "How to define the default Alsa card"

From Salix OS
Jump to: navigation, search
(tag correction + removed title 2nd time)
(This solution is better, because it still uses dmix.)
Line 11: Line 11:
 
The one I want to make it default is '''VT82xx'''
 
The one I want to make it default is '''VT82xx'''
  
Then edit the file '''/etc/asound.conf''' by adding these lines:
+
Then add the following file /etc/profile.d/alsa.sh with this content:
   pcm.!default {
+
   #!/bin/sh
    type hw
+
  default_alsa_card=VT82xx
    card VT82xx
+
   export ALSA_CARD=$default_alsa_card
   }
+
   export ALSA_PCM_CARD=$default_alsa_card
   ctl.!default {
+
  export ALSA_CTL_CARD=$default_alsa_card
    type hw
+
 
    card VT82xx
+
  }
+
 
Of couse, replace ''VT82xx'' with your sound card name.
 
Of couse, replace ''VT82xx'' with your sound card name.
 +
Make this file executable with:
 +
  chmod +x /etc/profile.d/alsa.sh
  
If you want to have it works immediately, run '''/etc/rc.d/rc.alsa restart''' or reboot.
+
If you want to have it works immediately, source that file with '''source /etc/profile.d/alsa.sh''' and run your audio applications from this terminal or simply reboot.
  
 
[[Category:User Documentation|Alsa]]
 
[[Category:User Documentation|Alsa]]

Revision as of 23:13, 7 February 2010

If you have more than one card in your system, or precisely, than the system see more than one card (one sound card and a usb camera with a microphone for example), you must define which one is the default one. Here are the steps to achieve this:

Firstly, determine the name of your sound card:

 cat /proc/asound/cards

The name of your card is in the brackets. For me:

 0 [U0x46d0x9a4    ]: USB-Audio - USB Device 0x46d:0x9a4
                      USB Device 0x46d:0x9a4 at usb-0000:00:10.3-1, full speed
 1 [VT82xx         ]: HDA-Intel - HDA VIA VT82xx
                      HDA VIA VT82xx at 0xfbffc000 irq 17

The one I want to make it default is VT82xx

Then add the following file /etc/profile.d/alsa.sh with this content:

 #!/bin/sh
 default_alsa_card=VT82xx
 export ALSA_CARD=$default_alsa_card
 export ALSA_PCM_CARD=$default_alsa_card
 export ALSA_CTL_CARD=$default_alsa_card

Of couse, replace VT82xx with your sound card name. Make this file executable with:

 chmod +x /etc/profile.d/alsa.sh

If you want to have it works immediately, source that file with source /etc/profile.d/alsa.sh and run your audio applications from this terminal or simply reboot.