diff --git a/i3/desktop.conf b/i3/desktop.conf index 0441ee5..86ded73 100644 --- a/i3/desktop.conf +++ b/i3/desktop.conf @@ -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 diff --git a/scripts/aquamix.sh b/scripts/audio/aquamix.sh similarity index 97% rename from scripts/aquamix.sh rename to scripts/audio/aquamix.sh index 3145814..c4b5259 100644 --- a/scripts/aquamix.sh +++ b/scripts/audio/aquamix.sh @@ -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. # diff --git a/scripts/audio-lib.sh b/scripts/audio/audio-lib.sh similarity index 92% rename from scripts/audio-lib.sh rename to scripts/audio/audio-lib.sh index 015b8bd..acdbee5 100644 --- a/scripts/audio-lib.sh +++ b/scripts/audio/audio-lib.sh @@ -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 diff --git a/scripts/audio/es8start.sh b/scripts/audio/es8start.sh new file mode 100644 index 0000000..a5f5e9a --- /dev/null +++ b/scripts/audio/es8start.sh @@ -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 & diff --git a/scripts/audio/es9start.sh b/scripts/audio/es9start.sh new file mode 100644 index 0000000..7f2e021 --- /dev/null +++ b/scripts/audio/es9start.sh @@ -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 & diff --git a/scripts/es9stop.sh b/scripts/audio/es9stop.sh similarity index 100% rename from scripts/es9stop.sh rename to scripts/audio/es9stop.sh diff --git a/scripts/system-start-audio.sh b/scripts/audio/system-start-audio.sh similarity index 88% rename from scripts/system-start-audio.sh rename to scripts/audio/system-start-audio.sh index bb3b4c7..48f4e22 100644 --- a/scripts/system-start-audio.sh +++ b/scripts/audio/system-start-audio.sh @@ -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 diff --git a/scripts/es8start.sh b/scripts/es8start.sh deleted file mode 100644 index 424c077..0000000 --- a/scripts/es8start.sh +++ /dev/null @@ -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 & diff --git a/scripts/es9start.sh b/scripts/es9start.sh deleted file mode 100644 index 7172415..0000000 --- a/scripts/es9start.sh +++ /dev/null @@ -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 &