aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Piasek <dagger@gentoo.org>2009-01-09 16:17:04 +0000
committerRobert Piasek <dagger@gentoo.org>2009-01-09 16:17:04 +0000
commit6148701714b9d10fc51cf9eb503673f84b767bc0 (patch)
tree66518c473a10185bae8de12afa08601d144b158a /media-sound
parentTesing svn access (diff)
downloadembedded-cross-6148701714b9d10fc51cf9eb503673f84b767bc0.tar.gz
embedded-cross-6148701714b9d10fc51cf9eb503673f84b767bc0.tar.bz2
embedded-cross-6148701714b9d10fc51cf9eb503673f84b767bc0.zip
Initial upload of openmoko-target
Diffstat (limited to 'media-sound')
-rw-r--r--media-sound/alsa-scenarios-gta02/Manifest1
-rw-r--r--media-sound/alsa-scenarios-gta02/alsa-scenarios-gta02-20081028.ebuild31
-rw-r--r--media-sound/alsa-utils/Manifest8
-rw-r--r--media-sound/alsa-utils/alsa-utils-1.0.14.ebuild94
-rw-r--r--media-sound/alsa-utils/files/alsa-modules.conf-rc38
-rw-r--r--media-sound/alsa-utils/files/alsa-utils-1.0.11_rc2-nls.patch25
-rw-r--r--media-sound/alsa-utils/files/alsa-utils-1.0.11_rc5-alsaconf-redirect.patch13
-rw-r--r--media-sound/alsa-utils/files/alsa-utils-1.0.14-seq.patch37
-rw-r--r--media-sound/alsa-utils/files/alsasound.confd41
-rw-r--r--media-sound/alsa-utils/files/alsasound.initd237
10 files changed, 525 insertions, 0 deletions
diff --git a/media-sound/alsa-scenarios-gta02/Manifest b/media-sound/alsa-scenarios-gta02/Manifest
new file mode 100644
index 0000000..d1ecd19
--- /dev/null
+++ b/media-sound/alsa-scenarios-gta02/Manifest
@@ -0,0 +1 @@
+EBUILD alsa-scenarios-gta02-20081028.ebuild 673 RMD160 cd5509795018dbfcb16463b3946aea778ed00f91 SHA1 80870f1568446b15d73152225865d41f8181a270 SHA256 bdfaf145ea36693b458d88f969e2fe0762b44cbd11cbc520a965594330455a8c
diff --git a/media-sound/alsa-scenarios-gta02/alsa-scenarios-gta02-20081028.ebuild b/media-sound/alsa-scenarios-gta02/alsa-scenarios-gta02-20081028.ebuild
new file mode 100644
index 0000000..9d7e627
--- /dev/null
+++ b/media-sound/alsa-scenarios-gta02/alsa-scenarios-gta02-20081028.ebuild
@@ -0,0 +1,31 @@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+DESCRIPTION="ALSA scenario files for the Openmoko Freerunner"
+HOMEPAGE="http://www.openmoko.org"
+ESVN_REPO_URI="http://svn.openmoko.org/trunk/src/target/audio/om-gta02/"
+ESVN_REVISION="r4870"
+
+LICENSE="GPL"
+SLOT="0"
+KEYWORDS="~arm"
+IUSE=""
+
+inherit subversion
+
+RDEPEND="media-libs/alsa-lib
+ media-sound/alsa-utils"
+DEPEND=""
+
+PROVIDE="virtual/alsa-scenarios"
+
+src_unpack() {
+ subversion_src_unpack
+}
+
+src_install() {
+ mkdir --parent "${D}/usr/share/openmoko/scenarios"
+
+ install -D -m 644 "${S}/"*.state "${D}/usr/share/openmoko/scenarios/"
+}
diff --git a/media-sound/alsa-utils/Manifest b/media-sound/alsa-utils/Manifest
new file mode 100644
index 0000000..2618ed7
--- /dev/null
+++ b/media-sound/alsa-utils/Manifest
@@ -0,0 +1,8 @@
+AUX alsa-modules.conf-rc 1028 RMD160 8e115310eb0e13e08b21304c98a78e721be0029a SHA1 7a2b5fed91fa640894efaf2f557eb2b04aff1a40 SHA256 6060c101ca0793ea80e2b6b5bb8d6b118325092788ff26f07c280dd1ff546570
+AUX alsa-utils-1.0.11_rc2-nls.patch 587 RMD160 9dff7b5f75295834457ff93a13d485d66685cdf3 SHA1 79009e9a09e8f3518cbab2d7f00eb4fb3cb410aa SHA256 c68819938d0241dd38293b0e411921b3ad580390183880fd364361fe71cb6d51
+AUX alsa-utils-1.0.11_rc5-alsaconf-redirect.patch 649 RMD160 cfb4dac18bfacf45bbb78e0c3278b431d5015d30 SHA1 02a306c5e555fe6423fb5e10b9c7fc40514b09c2 SHA256 e4da9da92bb88fbf66897da35b588bb81b6d4899a129d59237fd4d65cdd59a55
+AUX alsa-utils-1.0.14-seq.patch 1583 RMD160 4067b69562110bb82e54b7ef77a56bdd2ac48aaf SHA1 aa88f43ffc3b4ef697d2b81b4836cf493b4ce22a SHA256 8150feba5a28cdb5ec095817747f9c130d3f7f1b5929e0943cecd945af5d2e53
+AUX alsasound.confd 1052 RMD160 b3a788626e239a844ac71119e887066074be3b30 SHA1 6386e6097629dcd405b61fd950370e610362a712 SHA256 073015ea00ffcbe536fd15258d30d17cdd8cacd6c334f330882d5ed9bdcf83ad
+AUX alsasound.initd 6557 RMD160 6e58e7b93619a505f87f8de7fecc6489daf5638f SHA1 fb1c5436e2ddfa191119fb19d439fe43e9f797f1 SHA256 09e54f5e4f75331a1de3af641623edcf4d687b49f23180f8bc14b42fc471acfe
+DIST alsa-utils-1.0.14.tar.bz2 1013872 RMD160 e912588fc6ad223c7176847b8f99c80dd2ca7bb5 SHA1 767e71805ee606a4589bda9e95babbca61f9e92f SHA256 307d630f0ed15e7e92fa35dc0c961737fa9aed22bd7a4a6054a72f85145fa5cb
+EBUILD alsa-utils-1.0.14.ebuild 2388 RMD160 ee5597dbd8e3c85f0d86404fa41bd33cf4559aca SHA1 5c7febe9c7daa19175025e7d2e1e8720ee19d5f1 SHA256 782a2631f96d44f47f809863edf4e4966417c7ed2d8d4bd78684f8b74008f786
diff --git a/media-sound/alsa-utils/alsa-utils-1.0.14.ebuild b/media-sound/alsa-utils/alsa-utils-1.0.14.ebuild
new file mode 100644
index 0000000..1cc085c
--- /dev/null
+++ b/media-sound/alsa-utils/alsa-utils-1.0.14.ebuild
@@ -0,0 +1,94 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-sound/alsa-utils/alsa-utils-1.0.14.ebuild,v 1.11 2008/09/01 18:20:51 betelgeuse Exp $
+
+WANT_AUTOMAKE="latest"
+WANT_AUTOCONF="latest"
+
+inherit eutils autotools
+
+MY_P="${P/_rc/rc}"
+
+DESCRIPTION="Advanced Linux Sound Architecture Utils (alsactl, alsamixer, etc.)"
+HOMEPAGE="http://www.alsa-project.org/"
+SRC_URI="mirror://alsaproject/utils/${MY_P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0.9"
+KEYWORDS="arm sh"
+IUSE="nls midi minimal"
+
+DEPEND="!minimal? ( >=sys-libs/ncurses-5.1
+ dev-util/dialog )
+ >=media-libs/alsa-lib-1.0.14_rc1"
+RDEPEND="${DEPEND}
+ !minimal? ( virtual/modutils
+ sys-apps/pciutils
+ sys-apps/gawk
+ )"
+
+S="${WORKDIR}/${MY_P}"
+
+pkg_setup() {
+ if use midi && ! built_with_use --missing true media-libs/alsa-lib midi; then
+ eerror ""
+ eerror "To be able to build alsa-utils with midi support you need"
+ eerror "to have built media-libs/alsa-lib with midi USE flag."
+ die "Missing midi USE flag on media-libs/alsa-lib"
+ fi
+}
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+
+ epatch "${FILESDIR}/${PN}-1.0.11_rc2-nls.patch"
+ epatch "${FILESDIR}/${PN}-1.0.11_rc5-alsaconf-redirect.patch"
+ epatch "${FILESDIR}/${P}-seq.patch"
+
+ AT_M4DIR="m4" eautoreconf
+}
+
+src_compile() {
+ local myconf
+
+ myconf=""
+ use minimal && myconf="${myconf} --disable-alsatest --disable-alsamixer"
+
+ econf \
+ $(use_enable nls) \
+ $(use_enable midi sequencer) \
+ ${myconf} \
+ || die "configure failed"
+
+ emake || die "make failed"
+}
+
+src_install() {
+ local ALSA_UTILS_DOCS="ChangeLog README TODO
+ seq/aconnect/README.aconnect
+ seq/aseqnet/README.aseqnet"
+
+ emake DESTDIR="${D}" install || die "Installation Failed"
+
+ dodoc ${ALSA_UTILS_DOCS}
+ newdoc alsamixer/README README.alsamixer
+
+ newinitd "${FILESDIR}/alsasound.initd" alsasound
+ newconfd "${FILESDIR}/alsasound.confd" alsasound
+ insinto /etc/modules.d
+ newins "${FILESDIR}/alsa-modules.conf-rc" alsa
+
+ keepdir /var/lib/alsa
+}
+
+pkg_postinst() {
+ echo
+ elog "To take advantage of the init script, and automate the process of"
+ elog "loading and unloading the ALSA sound drivers as well as"
+ elog "storing and restoring sound-card mixer levels you should"
+ elog "add alsasound to the boot runlevel. You can do this as"
+ elog "root like so:"
+ elog " # rc-update add alsasound boot"
+ echo
+}
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 0000000..40e99df
--- /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/alsa-utils-1.0.11_rc2-nls.patch b/media-sound/alsa-utils/files/alsa-utils-1.0.11_rc2-nls.patch
new file mode 100644
index 0000000..864df38
--- /dev/null
+++ b/media-sound/alsa-utils/files/alsa-utils-1.0.11_rc2-nls.patch
@@ -0,0 +1,25 @@
+Index: alsa-utils-1.0.11rc2/speaker-test/speaker-test.c
+===================================================================
+--- alsa-utils-1.0.11rc2.orig/speaker-test/speaker-test.c
++++ alsa-utils-1.0.11rc2/speaker-test/speaker-test.c
+@@ -44,9 +44,6 @@
+ #include <getopt.h>
+ #include <inttypes.h>
+ #include <ctype.h>
+-#ifdef ENABLE_NLS
+-#include <locale.h>
+-#endif
+ #include <byteswap.h>
+
+ #define ALSA_PCM_NEW_HW_PARAMS_API
+@@ -59,6 +56,10 @@
+ #include "gettext.h"
+ #include "version.h"
+
++#ifdef ENABLE_NLS
++#include <locale.h>
++#endif
++
+ enum {
+ TEST_PINK_NOISE = 1,
+ TEST_SINE,
diff --git a/media-sound/alsa-utils/files/alsa-utils-1.0.11_rc5-alsaconf-redirect.patch b/media-sound/alsa-utils/files/alsa-utils-1.0.11_rc5-alsaconf-redirect.patch
new file mode 100644
index 0000000..89f74b7
--- /dev/null
+++ b/media-sound/alsa-utils/files/alsa-utils-1.0.11_rc5-alsaconf-redirect.patch
@@ -0,0 +1,13 @@
+Index: alsa-utils-1.0.11rc5/alsaconf/alsaconf.in
+===================================================================
+--- alsa-utils-1.0.11rc5.orig/alsaconf/alsaconf.in
++++ alsa-utils-1.0.11rc5/alsaconf/alsaconf.in
+@@ -1394,7 +1394,7 @@ if [ x$devs_found != x ]; then
+ Following card(s) are found on your system.
+ Choose a soundcard to configure:
+ ")
+- $DIALOG --title "$title" --menu "$msg" 17 76 8 "${devs_found[@]}" 2> $FOUND || acex 0
++ $DIALOG --title "$title" --menu "$msg" 17 76 8 "${devs_found[@]}" --output-fd 3 3> $FOUND || acex 0
+ card=`head -n 1 $FOUND`
+ if [ "$card" = "legacy" ]; then
+ ac_config_legacy
diff --git a/media-sound/alsa-utils/files/alsa-utils-1.0.14-seq.patch b/media-sound/alsa-utils/files/alsa-utils-1.0.14-seq.patch
new file mode 100644
index 0000000..5bc071f
--- /dev/null
+++ b/media-sound/alsa-utils/files/alsa-utils-1.0.14-seq.patch
@@ -0,0 +1,37 @@
+diff -uNr alsa-utils-1.0.14.ORIG/configure.in alsa-utils-1.0.14/configure.in
+--- alsa-utils-1.0.14.ORIG/configure.in 2007-06-27 16:22:05.000000000 +0100
++++ alsa-utils-1.0.14/configure.in 2007-06-27 16:22:37.000000000 +0100
+@@ -82,6 +82,18 @@
+ TESTSOUND="$dir/test.wav")
+ AC_SUBST(TESTSOUND)
+
++AC_ARG_ENABLE([sequencer],
++ [AC_HELP_STRING([--disable-sequencer], [Disable sequencer utilities (aconnect, aplaymidi, aseqdump, aseqnet)])] )
++
++if test "x$enable_sequencer" != "xno"; then
++ AC_CHECK_LIB([asound], [snd_seq_open], [has_seq=yes], [has_seq=no])
++fi
++if test "x$enable_sequencer" = "xyes" && test "x$has_seq" = "xno"; then
++ AC_MSG_FAILURE([cannot find snd_seq_open. ALSA was built without sequencer support])
++fi
++
++AM_CONDITIONAL([BUILD_SEQ], [test "x$has_seq" = "xyes"])
++
+ AM_CONFIG_HEADER(include/aconfig.h)
+
+ dnl Checks for typedefs, structures, and compiler characteristics.
+diff -uNr alsa-utils-1.0.14.ORIG/Makefile.am alsa-utils-1.0.14/Makefile.am
+--- alsa-utils-1.0.14.ORIG/Makefile.am 2007-06-27 16:22:05.000000000 +0100
++++ alsa-utils-1.0.14/Makefile.am 2007-06-27 16:25:06.000000000 +0100
+@@ -4,7 +4,10 @@
+ else
+ ALSAMIXER_DIR=
+ endif
+-SUBDIRS= include alsactl alsaconf $(ALSAMIXER_DIR) amidi amixer aplay iecset seq speaker-test utils m4 po
++if BUILD_SEQ
++SEQ_DIR=seq
++endif
++SUBDIRS= include alsactl alsaconf $(ALSAMIXER_DIR) amidi amixer aplay iecset $(SEQ_DIR) speaker-test utils m4 po
+ EXTRA_DIST= config.rpath config.rpath mkinstalldirs ChangeLog INSTALL TODO README configure hgcompile depcomp
+ AUTOMAKE_OPTIONS=foreign
+ ACLOCAL_AMFLAGS = -I m4
diff --git a/media-sound/alsa-utils/files/alsasound.confd b/media-sound/alsa-utils/files/alsasound.confd
new file mode 100644
index 0000000..2da67da
--- /dev/null
+++ b/media-sound/alsa-utils/files/alsasound.confd
@@ -0,0 +1,41 @@
+# ENABLE_OSS_EMUL:
+# Do you want to enable in-kernel oss emulation?
+# no - Do not load oss emul drivers
+# yes - Load oss emul drivers if they're found
+
+ENABLE_OSS_EMUL="yes"
+
+# 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"
+
+# LOAD_ON_START:
+# Do you want to load sound modules when alsasound starts?
+# no - Do not load modules
+# yes - Load modules
+LOAD_ON_START="yes"
+
+# UNLOAD_ON_STOP:
+# Do you want to unload sound modules when alsasound stops?
+# no - Do not unload modules
+# yes - Unload modules
+UNLOAD_ON_STOP="yes"
+
+# KILLPROC_ON_STOP
+# Do you want to kill any processes using ALSA when alsasound stops?
+# If you are using ALSA modules, leave as yes.
+# no - Do not terminate ALSA processes
+# yes - Kill running processes using ALSA
+KILLPROC_ON_STOP="yes"
diff --git a/media-sound/alsa-utils/files/alsasound.initd b/media-sound/alsa-utils/files/alsasound.initd
new file mode 100644
index 0000000..40600cf
--- /dev/null
+++ b/media-sound/alsa-utils/files/alsasound.initd
@@ -0,0 +1,237 @@
+#!/sbin/runscript
+# $Header: /var/cvsroot/gentoo-x86/media-sound/alsa-utils/files/alsasound.initd,v 1.9 2008/05/15 20:17:46 beandog Exp $
+# Copyright 2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+alsastatedir=/var/lib/alsa
+alsascrdir=/etc/alsa.d
+
+opts="save restore"
+
+depend() {
+ need localmount
+ after bootmisc modules isapnp coldplug hotplug
+}
+
+load_modules() {
+ # List of drivers for each card.
+ local DRIVERS="$(modprobe -c | sed -n -e 's/^alias \(snd-card-[[:digit:]]\+\) .*/\1/p')"
+
+ # Fall back on the automated aliases if we don't have ALSA configured properly...
+ if [ -z "${DRIVERS}" ] && \
+ ( [ ! -r /proc/asound/cards ] || grep -q ' no soundcards ' /proc/asound/cards 2>/dev/null ) ; then
+ ewarn "Could not detect custom ALSA settings. Loading all detected alsa drivers."
+ DRIVERS="$(modprobe -c | sed -n -e '/^alias pci:.* snd.*/ s/^alias pci:[^ ]* \(.*\)/\1/p' | sort | uniq)"
+ if [ -z "${DRIVERS}" ] ; then
+ eerror "Unable to find any ALSA drivers. Have you compiled alsa-drivers correctly?"
+ fi
+ fi
+
+ if [ "${ENABLE_OSS_EMUL}" = "yes" ] ; then
+ DRIVERS="${DRIVERS} $(modprobe -l | sed -n -e '/snd.*oss/ s:\/.*\/\(.*\).ko:\1:p')"
+ fi
+
+ # We want to ensure snd-seq is loaded as it is needed for things like
+ # timidity even if we don't use a real sequencer.
+ DRIVERS="${DRIVERS} $(modprobe -l | sed -n -e '/snd.seq\./ s:\/.*\/\(.*\).ko:\1:p')"
+
+ # We want to ensure snd-ioctl32 is loaded as it is needed for 32bit
+ # compatibility
+ DRIVERS="${DRIVERS} $(modprobe -l | sed -n -e '/snd.ioctl32\./ s:\/.*\/\(.*\).ko:\1:p')"
+
+ local DRIVER= DMOD=
+ for DRIVER in ${DRIVERS} ; do
+ [ "${DRIVER}" = "off" ] && continue
+ DMOD="$(echo "${DRIVER}" | sed -e 's/-/_/g')"
+ if ! grep -q "^${DMOD} " /proc/modules ; then
+ ebegin "Loading: ${DRIVER}"
+ modprobe ${DRIVER}
+ eend $?
+ fi
+ done
+
+ if [ -f /proc/asound/seq/drivers ] ; then
+ local SEQUENCERS="$(sed -n -e 's/\([^,]*\),empty,.*/\1/p' /proc/asound/seq/drivers)"
+ local SEQUENCER
+ for SEQUENCER in ${SEQUENCERS} ; do
+ DMOD="$(echo "${SEQUENCER}" | sed -e 's/-/_/g')"
+ if ! grep -q "^${DMOD} " /proc/modules ; then
+ ebegin "Loading: ${SEQUENCER}"
+ modprobe ${SEQUENCER}
+ eend $?
+ fi
+ done
+ fi
+
+ for DRIVER in ${DRIVERS}
+ do
+ local TMP=${DRIVER##snd-}
+ TMP=${TMP##snd_}
+ if [ -x "${alsascrdir}/${TMP}" ] ; then
+ ebegin "Running: ${alsascrdir}/${TMP}"
+ "${alsascrdir}/${TMP}"
+ eend $?
+ fi
+ done
+
+ if [ ! -d /proc/asound ] || grep -q ' no soundcards ' /proc/asound/cards ; then
+ eerror "ERROR: Failed to load necessary drivers"
+ return 1
+ fi
+}
+
+unload_modules_24() {
+ local LOADED_MODULES="$(lsmod | sed -n -e 's/^\(snd[^ ]*\) .*/\1/p')"
+ local MODULE
+ for MODULE in ${LOADED_MODULES} ; do
+ rmmod "${MODULE}"
+ done
+ rmmod soundcore 2>/dev/null
+ rmmod gameport 2>/dev/null
+
+ lsmod | grep -vq '^snd'
+}
+
+unload_modules_recursive() {
+ local revdeps="$(lsmod | sed -n -e "s/,/ /g" -e "s/^$1 *[0-9]* *[0-9]* \(.*\)/\1/p")"
+
+ for module in ${revdeps} ; do
+ unload_modules_recursive "${module}"
+ done
+
+ vebegin "Unloading: $1"
+ rmmod --wait "$1"
+ veend $?
+}
+
+unload_modules_26() {
+ # First of all, remove the snd module and all the modules depending
+ # on it, this should remove already most of ALSA modules.
+ lsmod | grep -q "^snd[[:space:]]" && unload_modules_recursive snd
+
+ # Then find the remaining ones, and handle them too.
+ for module in $(lsmod | sed -n -e 's/^\(snd[^ ]*\) .*/\1/p'); do
+ unload_modules_recursive "${module}"
+ done
+
+ lsmod | grep -vq "^snd"
+}
+
+terminate() {
+ #
+ # Kill processes holding open sound devices
+ #
+ # DEVS=`find /dev/ -follow -type c -maxdepth 1 -print 2>/dev/null | xargs ls -dils | grep "1*1[46]," | cut -d: -f2 | cut -d" " -f2; echo /proc/asound/dev/*`
+ local ossdevs="/dev/admmidi* /dev/adsp* /dev/amidi* /dev/audio* /dev/dmfm* \
+ /dev/dmmidi* /dev/dsp* /dev/dspW* /dev/midi0* /dev/mixer* /dev/music \
+ /dev/patmgr* /dev/sequencer* /dev/sndstat"
+ local alsadevs="/proc/asound/dev/* /dev/sound/* /dev/snd/*"
+ fuser -k ${ossdevs} ${alsadevs} >/dev/null 2>/dev/null
+
+ # remove all sequencer connections if any
+ [ -f /proc/asound/seq/clients ] && type aconnect >/dev/null 2>/dev/null && aconnect --removeall
+}
+
+restore() {
+ ebegin "Restoring Mixer Levels"
+
+ 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 -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"
+
+ mkdir -p "${alsastatedir}"
+ if ! alsactl -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 [ -f /proc/modules ] && [ "${LOAD_ON_START}" = "yes" ]; then
+ ebegin "Loading ALSA modules"
+ eindent
+ load_modules
+ eoutdent
+ eend $? || return 1
+ fi
+
+ if [ ! -d /proc/asound ]; then
+ eerror "ALSA failed to load."
+ eend 1
+ return 1
+ elif [ "${RESTORE_ON_START}" = "yes" ]; then
+ restore
+ fi
+
+ return 0
+}
+
+stop() {
+ if [ ! -d /proc/asound ] ; then
+ eerror "ALSA is not loaded"
+ return 0
+ fi
+
+ [ "${SAVE_ON_STOP}" = "yes" ] && save
+
+ if [ "${KILLPROC_ON_STOP}" = "yes" ] ; then
+ ebegin "Killing processes using ALSA"
+ terminate
+ eend 0
+ fi
+
+ if [ -f /proc/modules ] && [ "${UNLOAD_ON_STOP}" = "yes" ]; then
+ local ver="26"
+ case "$(uname -r)" in
+ 2.[01234].*) ver="24";;
+ *) ver="26";;
+ esac
+ ebegin "Unloading ALSA modules"
+ eindent
+ unload_modules_${ver}
+ eend $?
+ eoutdent
+ fi
+
+ return 0
+}