Alsa

Aus Info-Theke
Zur Navigation springen Zur Suche springen


Primäre Soundkarte bestimmen[Bearbeiten]

  • cat /proc/asound/cards
0 [Generic        ]: HDA-Intel - HD-Audio Generic
                      HD-Audio Generic at 0xff744000 irq 54
 1 [Generic_1      ]: HDA-Intel - HD-Audio Generic
                      HD-Audio Generic at 0xff740000 irq 16
  • Script Sound.sh ausführen, Ergebnis in ~/.asoundrc speichern (ohne erste Zeile):
Using sound card: Generic
pcm.Generic { type hw; card Generic; }
ctl.Generic { type hw; card Generic; }
pcm.Generic_1 { type hw; card Generic_1; }
ctl.Generic_1 { type hw; card Generic_1; }
pcm.CODEC { type hw; card CODEC; }
ctl.CODEC { type hw; card CODEC; }
pcm.!default pcm.Generic
ctl.!default ctl.Generic
  • in den letzen 2 Zeilen Generic durch Generic_1 ersetzen

Script Sound.sh[Bearbeiten]

#!/bin/bash
# asoundrc v0.1.0 20090101 markc@renta.net GPLv3
# asoundrc v0.2.0 20090320 quatro_por_quatro@yahoo.es GPLv3
#
# A simple script to create a particular default audio device regardless
# of what cards are loaded or in what order. 
#
 if default_card="${1:-$(cat "$(for f in $(ls -1 /proc/asound/card[0-9]*/{midi,codec}* 2>/dev/null); do echo "${f%/*}"; done \
 | sed -e '\|^[\[:blank:]\]$|d' -e 'q')/id" 2>/dev/null)}"; then
   echo "Using sound card: ${default_card}" >&2 
   cat /proc/asound/card[0-9]*/id | \
   gawk --assign default_card="${default_card}" \
  '{print "pcm."$1" { type hw; card "$1"; }\nctl."$1" { type hw; card "$1"; }" }
END {print "pcm.!default pcm."default_card"\nctl.!default ctl."default_card}'
   else
    echo "Warning: No sound cards found." >&2
fi