refactored sound to audio

This commit is contained in:
2026-03-04 01:28:50 +08:00
parent f7b59f9d81
commit 35cdffa984
2 changed files with 44 additions and 25 deletions

44
utils/.local/bin/audio Executable file
View File

@@ -0,0 +1,44 @@
#!/usr/bin/env bash
# available sinks listed here: pactl list sinks
LOUD_SINK="alsa_output.pci-0000_00_1f.3.analog-stereo"
LOUD_PRESET="Defender"
HEAD_SINK="alsa_output.usb-C-Media_Electronics_Inc._USB_Audio_Device-00.analog-stereo"
HEAD_PRESET="Techno"
if [ -z "$1" ]; then
echo -e "Current sink\t: $(pactl get-default-sink)"
echo -e "Loud sink\t: $LOUD_SINK"
echo -e "Loud preset\t: $LOUD_PRESET"
echo -e "Head sink\t: $HEAD_SINK"
echo -e "Head preset\t: $HEAD_PRESET"
exit
fi
if [ "$1" == "-h" ] || [ "$1" == "--help" ]; then
cat <<EOF
Usage: $(basename "$0") [-h]
Switch audio output and apply appropriate easyffects preset.
Options:
-h, --help Show this help message
--loud Enable loud speakers
--head Enable headphones
EOF
exit
fi
if [ "$1" == "--loud" ]; then
pactl set-default-sink "$LOUD_SINK" || exit 1
easyeffects -l "$LOUD_PRESET" || exit 2
exit
fi
if [ "$1" == "--head" ]; then
pactl set-default-sink "$HEAD_SINK" || exit 1
easyeffects -l "$HEAD_PRESET" || exit 2
exit
fi

View File

@@ -1,25 +0,0 @@
#!/usr/bin/env bash
case "$1" in
-h|--help)
cat <<EOF
Usage: $(basename "$0") [-h]
Switch audio output and apply appropriate easyffects preset.
Options:
-h, --help Show this help message
--defender Enable loud speakers
--head Enable headphones
EOF
;;
--defender)
pactl set-default-sink alsa_output.pci-0000_00_1f.3.analog-stereo
easyeffects -l Defender
;;
--head)
pactl set-default-sink alsa_output.usb-C-Media_Electronics_Inc._USB_Audio_Device-00.analog-stereo
easyeffects -l Techno
;;
esac