Refactored audio scripts to new directory

This commit is contained in:
Christian Colglazier 2020-10-11 10:38:42 -04:00
parent d28568ee03
commit 580f77bb11
9 changed files with 43 additions and 40 deletions

View File

@ -31,7 +31,7 @@ bindsym $mod+F1 mode "$g13"
exec_always --no-startup-id g13d --config ~/.config/g13/resolve.bind --logo ~/.config/g13/resolve.lpbm &
# Starts Jack for audio
exec --no-startup-id sh ~/.config/scripts/system-start-audio.sh
exec --no-startup-id sh ~/.config/scripts/audio/system-start-audio.sh
# Open Google Play Music on workspace 10
for_window [title="Google Play Music Desktop Player"] move to workspace $ws10

View File

@ -7,6 +7,7 @@ source $(dirname ${BASH_SOURCE[0]})/audio-lib.sh
INTERFACE_NAME='Scarlett 18i20'
INTERFACE_NUM=$(getCardNumber $INTERFACE_NAME)
checkCard $INTERFACE_NAME $INTERFACE_NUM
# Sets the volume levels of the first mono instrument.
#

View File

@ -22,6 +22,19 @@ function getCardNumber() {
echo $(cat /proc/asound/cards | grep -m 1 $1 | grep -Po '\d{1,2}' | head -1)
}
# Checks if the card exists and if not exits.
#
# $1 card name
# $2 card number
function checkCard() {
if [ -z "$2" ]; then
echo $1 not connected
exit 1
else
echo $1 found at hw:$2
fi
}
# Prints a list of all controls for the given sound card.
function printControls() {
amixer -c $1 controls

11
scripts/audio/es8start.sh Normal file
View File

@ -0,0 +1,11 @@
#!/bin/bash
# Script to add another audio interface if available.
DEVICE_NAME='ES-8'
DEVICE_NUM=$(getCardNumber $DEVICE_NAME)
checkCard $DEVICE_NAME $DEVICE_NUM
# Start up audio interface
alsa_in -d hw:$DEVICENUM -j "$DEVICENAME In" -q 1 &
alsa_out -d hw:$DEVICENUM -j "$DEVICENAME Out" -q 1 &

14
scripts/audio/es9start.sh Normal file
View File

@ -0,0 +1,14 @@
#!/bin/bash
# Script to add another audio interface if available.
# Import library
source $(dirname ${BASH_SOURCE[0]})/audio-lib.sh
DEVICE_NAME='ES-9'
DEVICE_NUM=$(getCardNumber $DEVICE_NAME)
checkCard $DEVICE_NAME $DEVICE_NUM
# Start up audio interface
alsa_in -d hw:$DEVICE_NUM -j "$DEVICENAME In" -c 16 -q 1 &
alsa_out -d hw:$DEVICE_NUM -j "$DEVICENAME Out" -c 16 -q 1 &

View File

@ -27,7 +27,7 @@ function launchi3() {
if [ -z "$skipi3" ]; then
echo Opening i3wm sound workspaces
sleep .1 && i3-msg 'workspace 5; exec firefox'
sleep .1 && python ~/.config/scripts/start-firefox.py
sleep 8 && python ~/.config/scripts/start-firefox.py
fi
}
@ -54,7 +54,7 @@ fixPulse
pulseaudio -D
# Eurorack audio interface
sh ~/.config/scripts/es8start.sh
sh ~/.config/scripts/es9start.sh
sh ~/.config/scripts/audio/es8start.sh
sh ~/.config/scripts/audio/es9start.sh
launchi3

View File

@ -1,18 +0,0 @@
#!/bin/bash
# Script to add another audio interface if available.
DEVICENAME='ES-8'
DEVICENUM="$(cat /proc/asound/cards | grep -m 1 $DEVICENAME | grep -o '[0-9]' | head -1)"
if test -z "$DEVICENUM"
then
echo $DEVICENAME not connected
exit 1
else
echo $DEVICENAME found at hw:$DEVICENUM
fi
# Start up audio interface
alsa_in -d hw:$DEVICENUM -j "$DEVICENAME In" -q 1 &
alsa_out -d hw:$DEVICENUM -j "$DEVICENAME Out" -q 1 &

View File

@ -1,18 +0,0 @@
#!/bin/bash
# Script to add another audio interface if available.
DEVICENAME='ES-9'
DEVICENUM="$(cat /proc/asound/cards | grep -m 1 $DEVICENAME | grep -o '[0-9]' | head -1)"
if test -z "$DEVICENUM"
then
echo $DEVICENAME not connected
exit 1
else
echo $DEVICENAME found at hw:$DEVICENUM
fi
# Start up audio interface
alsa_in -d hw:$DEVICENUM -j "$DEVICENAME In" -c 16 -q 1 &
alsa_out -d hw:$DEVICENUM -j "$DEVICENAME Out" -c 16 -q 1 &