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.

31 lines
783 B

#!/bin/sh
Device="Audio Adapter (Unitek Y-247A) Mono"
Name=$(wpctl status | grep "$Device")
Id=$( echo $Name | cut -d '.' -f 1 | cut -c 5-)
Node=$(wpctl inspect $Id | grep node.name | cut -d '=' -f 2)
case "$1" in
start) wpctl set-volume $Id 0.2
touch ~/.local/state/loopback.lock
pw-loopback -C $Node & ;;
stop) killall pw-loopback
rm ~/.local/state/loopback.lock ;;
toggle)
if [ -f ~/.local/state/loopback.lock ]; then
loopback stop
else
loopback start
fi ;;
*) cat << EOF
loopback: cli audio script for looping back pulse devices to the default output.
Allowed options:
start Start loopback for device
stop Stop all active loopbacks
toggle Start or stop loopback depending if it is already running
EOF
esac