summaryrefslogtreecommitdiffstats
path: root/volchange
blob: e056f30a96b864387efd97f0c4c285a835f9bab4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/zsh
if lsmod | =grep -q oss_hdaudio;then
    type="vmix0-outvol"

    max="25.0"
    if [[ $1 = 'cur' ]];then 
        cur=$(ossmix $type | awk '{ print $10 }'); 
        cur=$(( ${cur#*:}/$max * 100.0 ))
        printf "♪ %.2f ♪" $cur
        exit
    fi
    if  [[ $1 = '1' ]];then curvol="+3" ;fi
    if  [[ $1 = '2' ]];then curvol="-3";fi
    if [[ $1 = 'mute' ]];then ossmix jack.int-speaker.mute TOGGLE; exit;fi
    ossmix $type -- "$curvol"
else
    if [[ $1 = 'cur' ]];then
        amixer get Master  | =grep -o -E "[0-9]+%"
        exit
    fi
    if  [[ $1 = '1' ]];then curvol="10%+" ;fi
    if  [[ $1 = '2' ]];then curvol="10%-";fi
    if [[ $1 = 'mute' ]];then
        amixer sset Master playback toggle
        exit
    fi
    amixer sset Master playback $curvol
fi