You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
calculate-overlay/profiles/templates/3.1/2_ac_install_merge/media-sound/alsa-utils/init.d/alsasound

55 lines
1.5 KiB

# 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
# reduce beep
amixer scontrols | sed -nr "/Beep/ s/.*'([^']+)'.*/\\\\1/p" | xargs -I {} amixer -q set "{}" 10% mute &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
save
if ! grep -q "PCM Playback Volume" ${alsastatedir}/asound.state
then
sed -ri "s/^\}/\
control.99 \{\\n\
iface MIXER\\n\
name 'PCM Playback Volume'\\n\
value.0 255\\n\
value.1 255\\n\
comment \{\\n\
access 'read write user'\\n\
type INTEGER\\n\
count 2\\n\
range '0 - 255'\\n\
tlv '0000000100000008ffffec1400000014'\\n\
dbmin -5100\\n\
dbmax 0\\n\
dbvalue.0 0\\n\
dbvalue.1 0\\n\
}\\n\
\}\\n\
\}\\n\
/" ${alsastatedir}/asound.state &amp;&amp; restore
fi
\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>