From f28aa3d4d272bacffd346066f847ec497398385a Mon Sep 17 00:00:00 2001
From: Christian Colglazier <christian@cacolglazier.com>
Date: Sat, 16 Nov 2019 11:36:22 -0500
Subject: [PATCH] ES-8 dynamic startup script

---
 scripts/start-es-8.sh | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
 create mode 100644 scripts/start-es-8.sh

diff --git a/scripts/start-es-8.sh b/scripts/start-es-8.sh
new file mode 100644
index 0000000..48798e5
--- /dev/null
+++ b/scripts/start-es-8.sh
@@ -0,0 +1,18 @@
+#!/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" &
+alsa_out -d hw:$DEVICENUM -j "$DEVICENAME Out" &