Skip to content

Instantly share code, notes, and snippets.

@brianfay
Last active November 25, 2015 00:30
Show Gist options
  • Save brianfay/f0a1b515f95b2e791755 to your computer and use it in GitHub Desktop.
Save brianfay/f0a1b515f95b2e791755 to your computer and use it in GitHub Desktop.
Toggle Jack on and off (I just mapped this to Ctrl-Alt-J, probably still won't handle suspending computer...)
#!/bin/bash
if [ -n "`jack_control status | grep started`" ]
then
echo "jack already started, stopping it..."
jack_control stop
else
echo "let's get this owl hootin'"
jack_control eps realtime true
jack_control ds alsa
if [ -n "`cat /proc/asound/cards | grep USB`" ]
then
jack_control dps device hw:USB
jack_control dps capture hw:USB
jack_control dps playback hw:USB
else
jack_control dps device hw:PCH
jack_control dps capture hw:PCH
jack_control dps playback hw:PCH
fi
jack_control dps rate 48000
jack_control dps nperiods 3
jack_control dps period 128
jack_control start
sleep 0.1
#now that we started jack (hopefully), change pulseaudio input
echo "Setting default sink to: jack_out";
pacmd set-default-sink jack_out
pacmd list-sink-inputs | grep index | while read line
do
echo "Moving input: ";
echo $line | cut -f2 -d' ';
echo "to sink: jack_out";
pacmd move-sink-input `echo $line | cut -f2 -d' '` jack_out
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment