Автор:
n0xi0uzz
Описание: Скрипт изменения уровня звука
Язык: Bash
#!/bin/bash
#
#####################################################################
# Get current volume.
function get_volume()
{
mixer=$(amixer get Master | grep 'Front Left:')
echo $mixer | cut -d ' ' -f 4
}
#####################################################################
# Set volume.
function set_volume()
{
amixer cset iface=MIXER,name="Master Playback Volume" $1 >/dev/null
}
if [[ $(basename $0 .sh) == 'sound' ]]; then
sound_file=~/Documents/sounds/notify.wav
if [[ "$1" ]]; then sound_file="$1"; fi
ovol=$(get_volume)
echo "Current volume: $ovol"
aplay $sound_file
sleep 2
vol=40
echo "Playing at: $vol"
set_volume $vol
aplay $sound_file
sleep 2
echo "Again at: $ovol"
set_volume $ovol
aplay $sound_file
fi
# vim: tabstop=4: shiftwidth=4: noexpandtab:
# kate: tab-width 4; indent-width 4; replace-tabs false;
|
Последние размещения:
prostoHz (Java)
ndubinkin (XML)
Riateche (Plain Text)
Slapotam (Perl)
ksurent (Perl)
John_Wein (Java)
John_Wein (HTML)
Riateche (HTML)
Riateche (JavaScript)
Riateche (JavaScript)
Lisenish (C++)
Lisenish (C++)
cramur (C++)
|