logo
Автор: 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;
Последние размещения:
antonivanov (SQL)
antonivanov (PHP)
brinza (PHP)
ilyhamas (Delphi)
Riateche (PHP)
otherlight (Java)
otherlight (JavaScript)
otherlight (CSS)
otherlight (CSS)
biophreak (JavaScript)
n4n (Perl)
prostoHz (Java)
ndubinkin (XML)
Riateche (Plain Text)
Slapotam (Perl)
ksurent (Perl)
John_Wein (Java)
John_Wein (HTML)
Riateche (HTML)
netsago.paste.β © 2009 Neunica