soundboard: add volume control

This commit is contained in:
dogeystamp 2022-10-08 15:08:31 -04:00
parent c34c81bde7
commit a80882c27e
Signed by: dogeystamp
GPG Key ID: 7225FE3592EFFA38
3 changed files with 27 additions and 1 deletions

View File

@ -46,6 +46,23 @@ shift + KP_{Insert,End,Down,Next,Left,Begin,Right,Home,Up,Prior}
snd_id="{0-9}";\
ls $SB_DIR/cur/sb-socket$snd_id-* | sb-msg "stop"
# loop specific sound
ctrl + shift + KP_{Insert,End,Down,Next,Left,Begin,Right,Home,Up,Prior}
snd_id="{0-9}";\
ls $SB_DIR/cur/sb-socket$snd_id-* | sb-msg "set loop inf"
# reduce volume of current dir
ctrl + KP_Subtract
snd_id="{0-9}";\
ls $SB_DIR/cur/sb-socket* | sb-msg "add volume -5";\
sb-vol
# increase volume of current dir
ctrl + KP_Add
snd_id="{0-9}";\
ls $SB_DIR/cur/sb-socket* | sb-msg "add volume +5";\
sb-vol
# stop all sounds
shift + KP_Delete
find $SB_DIR/ -name "sb-socket*" | sb-msg "stop";\

View File

@ -3,5 +3,4 @@
while read -r socket; do
printf "$1\n" | socat - $socket
rm "$socket"
done

View File

@ -0,0 +1,10 @@
#!/bin/sh
# Get the highest volume in the current directory, and present it as a notification.
RES=$(ls $SB_DIR/cur/sb-socket* | \
sb-msg '{ "command": ["get_property", "volume"], "request_id": 100 }' |\
jq .data | sort | head -n 1 | awk '{ printf("%.0f\n", $0) }')
CUR_DIR="$(basename $(readlink $SB_DIR/cur))"
notify-send -a "soundboard" -r 13371337 "$(printf "%s\nVolume set to %s\n" "$CUR_DIR" "$RES")"