# Calculate format=patch
<reg>(\s*ebegin "Restoring Mixer Levels"

\s*if \[ ! -r "\$\{alsastatedir\}/asound.state" \] ; then)
(\s*ewarn "No mixer config in \${alsastatedir}/asound.state, you have to unmute your card!")
(\s*eend 0
\s*return 0
\s*fi)</reg>
<text>\1
		einfo "Setting up ALSA Mixer Levels"
		# set output volumes to 70%
		amixer scontrols | grep -v Mic |  sed -nr "/Wave|Master|Front|LFE|Center|Side|Speaker|Surround|PCM/ s/.*'([^']+)'.*/\\\\1/p" | xargs -I {} amixer -q set "{}" 85% unmute &amp;&gt;/dev/null
		# mute all mics
		amixer scontrols | sed -nr "/Mic/ s/.*'([^']+)'.*/\\\\1/p" | xargs -I {} amixer -q set "{}" 0% mute &amp;&gt;/dev/null
\3</text>
<reg>(\s*ebegin "Loading ALSA modules"
\s*eindent
\s*load_modules)
(\s*eoutdent)
(\s*eend \$\? \|\| return 1)
(\s*fi

\s*if \[ ! -d /proc/asound \]; then)</reg>
<text>\1
		RES=$?
\2
		eend $RES || return 1
\4</text>
