diff options
Diffstat (limited to 'media-sound/alsa-utils/files')
-rw-r--r-- | media-sound/alsa-utils/files/alsa-modules.conf-rc | 38 | ||||
-rw-r--r-- | media-sound/alsa-utils/files/alsasound.confd-r4 | 15 | ||||
-rw-r--r-- | media-sound/alsa-utils/files/alsasound.initd-r6 | 87 | ||||
-rw-r--r-- | media-sound/alsa-utils/files/alsasound.initd-r7 | 87 |
4 files changed, 227 insertions, 0 deletions
diff --git a/media-sound/alsa-utils/files/alsa-modules.conf-rc b/media-sound/alsa-utils/files/alsa-modules.conf-rc new file mode 100644 index 000000000000..40e99df8d3f4 --- /dev/null +++ b/media-sound/alsa-utils/files/alsa-modules.conf-rc @@ -0,0 +1,38 @@ +# Alsa kernel modules' configuration file. + +# ALSA portion +alias char-major-116 snd +# OSS/Free portion +alias char-major-14 soundcore + +## +## IMPORTANT: +## You need to customise this section for your specific sound card(s) +## and then run `update-modules' command. +## Read alsa-driver's INSTALL file in /usr/share/doc for more info. +## +## ALSA portion +## alias snd-card-0 snd-interwave +## alias snd-card-1 snd-ens1371 +## OSS/Free portion +## alias sound-slot-0 snd-card-0 +## alias sound-slot-1 snd-card-1 +## + +# OSS/Free portion - card #1 +alias sound-service-0-0 snd-mixer-oss +alias sound-service-0-1 snd-seq-oss +alias sound-service-0-3 snd-pcm-oss +alias sound-service-0-8 snd-seq-oss +alias sound-service-0-12 snd-pcm-oss +## OSS/Free portion - card #2 +## alias sound-service-1-0 snd-mixer-oss +## alias sound-service-1-3 snd-pcm-oss +## alias sound-service-1-12 snd-pcm-oss + +alias /dev/mixer snd-mixer-oss +alias /dev/dsp snd-pcm-oss +alias /dev/midi snd-seq-oss + +# Set this to the correct number of cards. +options snd cards_limit=1 diff --git a/media-sound/alsa-utils/files/alsasound.confd-r4 b/media-sound/alsa-utils/files/alsasound.confd-r4 new file mode 100644 index 000000000000..6fec8f5938da --- /dev/null +++ b/media-sound/alsa-utils/files/alsasound.confd-r4 @@ -0,0 +1,15 @@ +# RESTORE_ON_START: +# Do you want to restore your mixer settings? If not, your cards will be +# muted. +# no - Do not restore state +# yes - Restore state + +RESTORE_ON_START="yes" + +# SAVE_ON_STOP: +# Do you want to save changes made to your mixer volumes when alsasound +# stops? +# no - Do not save state +# yes - Save state + +SAVE_ON_STOP="yes" diff --git a/media-sound/alsa-utils/files/alsasound.initd-r6 b/media-sound/alsa-utils/files/alsasound.initd-r6 new file mode 100644 index 000000000000..f80a3518f3e2 --- /dev/null +++ b/media-sound/alsa-utils/files/alsasound.initd-r6 @@ -0,0 +1,87 @@ +#!/sbin/openrc-run +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +alsastatedir=/var/lib/alsa +alsascrdir=/etc/alsa.d +alsahomedir=/var/run/alsasound + +extra_commands="save restore" + +depend() { + need localmount + after bootmisc modules isapnp coldplug hotplug +} + +restore() { + ebegin "Restoring Mixer Levels" + + checkpath -q -d -m 0700 -o root:root ${alsahomedir} || return 1 + + if [ ! -r "${alsastatedir}/asound.state" ] ; then + ewarn "No mixer config in ${alsastatedir}/asound.state, you have to unmute your card!" + eend 0 + return 0 + fi + + local cards="$(sed -n -e 's/ *\([[:digit:]]*\) .*/\1/p' /proc/asound/cards)" + local CARDNUM + for cardnum in ${cards}; do + [ -e /dev/snd/controlC${cardnum} ] || sleep 2 + [ -e /dev/snd/controlC${cardnum} ] || sleep 2 + [ -e /dev/snd/controlC${cardnum} ] || sleep 2 + [ -e /dev/snd/controlC${cardnum} ] || sleep 2 + alsactl -E HOME="${alsahomedir}" -I -f "${alsastatedir}/asound.state" restore ${cardnum} \ + || ewarn "Errors while restoring defaults, ignoring" + done + + for ossfile in "${alsastatedir}"/oss/card*_pcm* ; do + [ -e "${ossfile}" ] || continue + # We use cat because I'm not sure if cp works properly on /proc + local procfile=${ossfile##${alsastatedir}/oss} + procfile="$(echo "${procfile}" | sed -e 's,_,/,g')" + if [ -e /proc/asound/"${procfile}"/oss ] ; then + cat "${ossfile}" > /proc/asound/"${procfile}"/oss + fi + done + + eend 0 +} + +save() { + ebegin "Storing ALSA Mixer Levels" + + checkpath -q -d -m 0700 -o root:root ${alsahomedir} || return 1 + + mkdir -p "${alsastatedir}" + if ! alsactl -E HOME="${alsahomedir}" -f "${alsastatedir}/asound.state" store; then + eerror "Error saving levels." + eend 1 + return 1 + fi + + for ossfile in /proc/asound/card*/pcm*/oss; do + [ -e "${ossfile}" ] || continue + local device=${ossfile##/proc/asound/} ; device=${device%%/oss} + device="$(echo "${device}" | sed -e 's,/,_,g')" + mkdir -p "${alsastatedir}/oss/" + cp "${ossfile}" "${alsastatedir}/oss/${device}" + done + + eend 0 +} + +start() { + if [ "${RESTORE_ON_START}" = "yes" ]; then + restore + fi + + return 0 +} + +stop() { + if [ "${SAVE_ON_STOP}" = "yes" ]; then + save + fi + return 0 +} diff --git a/media-sound/alsa-utils/files/alsasound.initd-r7 b/media-sound/alsa-utils/files/alsasound.initd-r7 new file mode 100644 index 000000000000..da2d5b349b82 --- /dev/null +++ b/media-sound/alsa-utils/files/alsasound.initd-r7 @@ -0,0 +1,87 @@ +#!/sbin/openrc-run +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +alsastatedir=/var/lib/alsa +alsascrdir=/etc/alsa.d +alsahomedir=/var/run/alsasound + +extra_commands="save restore" + +depend() { + need localmount + after bootmisc modules isapnp coldplug hotplug +} + +restore() { + ebegin "Restoring Mixer Levels" + + checkpath -q -d -m 0700 -o root:root ${alsahomedir} || return 1 + + if [ ! -r "${alsastatedir}/asound.state" ] ; then + ewarn "No mixer config in ${alsastatedir}/asound.state, you have to unmute your card!" + eend 0 + return 0 + fi + + local cards="$(sed -n -e 's/^ *\([[:digit:]]*\) .*/\1/p' /proc/asound/cards)" + local CARDNUM + for cardnum in ${cards}; do + [ -e /dev/snd/controlC${cardnum} ] || sleep 2 + [ -e /dev/snd/controlC${cardnum} ] || sleep 2 + [ -e /dev/snd/controlC${cardnum} ] || sleep 2 + [ -e /dev/snd/controlC${cardnum} ] || sleep 2 + alsactl -E HOME="${alsahomedir}" -I -f "${alsastatedir}/asound.state" restore ${cardnum} \ + || ewarn "Errors while restoring defaults, ignoring" + done + + for ossfile in "${alsastatedir}"/oss/card*_pcm* ; do + [ -e "${ossfile}" ] || continue + # We use cat because I'm not sure if cp works properly on /proc + local procfile=${ossfile##${alsastatedir}/oss} + procfile="$(echo "${procfile}" | sed -e 's,_,/,g')" + if [ -e /proc/asound/"${procfile}"/oss ] ; then + cat "${ossfile}" > /proc/asound/"${procfile}"/oss + fi + done + + eend 0 +} + +save() { + ebegin "Storing ALSA Mixer Levels" + + checkpath -q -d -m 0700 -o root:root ${alsahomedir} || return 1 + + mkdir -p "${alsastatedir}" + if ! alsactl -E HOME="${alsahomedir}" -f "${alsastatedir}/asound.state" store; then + eerror "Error saving levels." + eend 1 + return 1 + fi + + for ossfile in /proc/asound/card*/pcm*/oss; do + [ -e "${ossfile}" ] || continue + local device=${ossfile##/proc/asound/} ; device=${device%%/oss} + device="$(echo "${device}" | sed -e 's,/,_,g')" + mkdir -p "${alsastatedir}/oss/" + cp "${ossfile}" "${alsastatedir}/oss/${device}" + done + + eend 0 +} + +start() { + if [ "${RESTORE_ON_START}" = "yes" ]; then + restore + fi + + return 0 +} + +stop() { + if [ "${SAVE_ON_STOP}" = "yes" ]; then + save + fi + return 0 +} |