Advertisement
TheNH813

/etc/rc.d/rc.alsa slackware

Apr 24th, 2016
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.80 KB | None | 0 0
  1. #!/bin/sh
  2. # Load the mixer settings and OSS compatibility for ALSA.
  3. # (the Advanced Linux Sound Architecture)
  4.  
  5. # A function to load the ALSA mixer settings:
  6. load_alsa_mixer() {
  7. if [ -r /var/lib/alsa/asound.state ]; then
  8. echo "Loading ALSA mixer settings: /usr/sbin/alsactl restore"
  9. /usr/sbin/alsactl restore
  10. else
  11. # It's possible a user might not want to set a default sound state.
  12. # In that case, do this: touch /var/lib/alsa/no.asound.state
  13. if [ ! -r /var/lib/alsa/no.asound.state ]; then
  14. echo "Setting default ALSA mixer settings."
  15. # set default mixer volumes for ALSA
  16. # Taken from the alsaconfig script.
  17. amixer -s -q <<EOF
  18. set Master 75% unmute
  19. set Master -12dB
  20. set 'Master Mono' 75% unmute
  21. set 'Master Mono' -12dB
  22. set Front 75% unmute
  23. set Front -12dB
  24. set PCM 90% unmute
  25. set PCM 0dB
  26. mixer Synth 90% unmute
  27. mixer Synth 0dB
  28. mixer CD 90% unmute
  29. mixer CD 0dB
  30. # mute mic
  31. set Mic 0% mute
  32. # ESS 1969 chipset has 2 PCM channels
  33. set PCM,1 90% unmute
  34. set PCM,1 0dB
  35. # Trident/YMFPCI/emu10k1
  36. set Wave 100% unmute
  37. set Music 100% unmute
  38. set AC97 100% unmute
  39. # CS4237B chipset:
  40. set 'Master Digital' 75% unmute
  41. # Envy24 chips with analog outs
  42. set DAC 90% unmute
  43. set DAC -12dB
  44. set DAC,0 90% unmute
  45. set DAC,0 -12dB
  46. set DAC,1 90% unmute
  47. set DAC,1 -12dB
  48. # some notebooks use headphone instead of master
  49. set Headphone 75% unmute
  50. set Headphone -12dB
  51. set Playback 100% unmute
  52. # turn off digital switches
  53. set "SB Live Analog/Digital Output Jack" off
  54. set "Audigy Analog/Digital Output Jack" off
  55. EOF
  56. echo "Storing default ALSA mixer settings: /usr/sbin/alsactl store"
  57. /usr/sbin/alsactl store
  58. fi
  59. fi
  60. }
  61.  
  62. # A function to load the ALSA OSS compat modules:
  63. load_alsa_oss_modules() {
  64. if modprobe -c | tr _ - | grep -wq snd-pcm-oss ; then
  65. if ! cat /proc/modules | tr _ - | grep -wq snd-pcm-oss ; then
  66. echo "Loading OSS compatibility modules for ALSA."
  67. modprobe snd-pcm-oss
  68. modprobe snd-seq-oss
  69. modprobe snd-mixer-oss
  70. fi
  71. fi
  72. }
  73.  
  74. # If hotplug or something else has loaded the ALSA modules, then
  75. # simply load the mixer settings and make sure the OSS compat
  76. # modules are loaded:
  77. if [ -d /proc/asound ]; then
  78. load_alsa_oss_modules
  79. load_alsa_mixer
  80. else
  81. # If there are ALSA modules defined in /etc/modprobe.d/*, but
  82. # ALSA is not yet loaded, then load the modules now:
  83. DRIVERS=$(modprobe -c | grep -E "^[[:space:]]*alias[[:space:]]+snd-card-[[:digit:]]" | tr -s "[[:blank:]]" " " | cut -d " " -f 3)
  84. if [ ! "$DRIVERS" = "" ]; then
  85. echo "Loading ALSA kernel modules."
  86. for module in $DRIVERS; do
  87. modprobe $module
  88. done
  89. fi
  90. # If ALSA is now up, then load the mixer settings and OSS modules:
  91. if [ -d /proc/asound ]; then
  92. load_alsa_oss_modules
  93. load_alsa_mixer
  94. fi
  95. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement