Move the SMC-PAD MIDI intercept into padeditor and add a systemd user service with an installer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jimmyandClaude Opus 5.5 committed 2026-10-22 12:06:31 +13:00
1 parent 647cfa3a75
commit 00de2595b6
13 files changed
+127 -34

No files matched your search

+22 -9
View File
@@ -3,7 +3,7 @@
#
# Order matters:
# 1) pad present (Bluetooth or USB)
# 2) smoother (creates "SMC-PAD Smooth")
# 2) intercept (creates "SMC-PAD Smooth")
# 3) patch workspace to that port
# 4) open QLC+ last
set -euo pipefail
@@ -30,12 +30,21 @@ if ! pad_present; then
exit 1
fi
# Restart smoother so it re-opens the pad port cleanly (avoid pkill -f; it matches this script)
while read -r pid; do
[[ -n "$pid" ]] && kill "$pid" 2>/dev/null || true
done < <(ps -eo pid,args | awk '/[.]venv\/bin\/python .*smooth_smc_pad[.]py/ {print $1}')
sleep 0.4
nohup "$PYTHON" scripts/pad/smooth_smc_pad.py --tau 0.055 >>/tmp/smooth_smc_pad.log 2>&1 &
# Restart the intercept so it re-opens the pad port cleanly. Use the systemd
# user service when it is installed (padeditor/systemd/install.sh).
SERVICE=smc-pad-intercept.service
LOG=/tmp/smc_pad_intercept.log
if systemctl --user is-enabled --quiet "$SERVICE" 2>/dev/null; then
systemctl --user restart "$SERVICE"
LOG=
else
# avoid pkill -f; it matches this script
while read -r pid; do
[[ -n "$pid" ]] && kill "$pid" 2>/dev/null || true
done < <(ps -eo pid,args | awk '/python.* -m padeditor[.]intercept/ {print $1}')
sleep 0.4
nohup "$PYTHON" -m padeditor.intercept --tau 0.055 >>"$LOG" 2>&1 &
fi
for _ in $(seq 1 20); do
if aconnect -l 2>/dev/null | grep -q 'SMC-PAD Smooth'; then
break
@@ -43,8 +52,12 @@ for _ in $(seq 1 20); do
sleep 0.25
done
if ! aconnect -l 2>/dev/null | grep -q 'SMC-PAD Smooth'; then
echo "Smoother failed to create SMC-PAD Smooth. See /tmp/smooth_smc_pad.log" >&2
tail -20 /tmp/smooth_smc_pad.log >&2 || true
echo "The intercept failed to create SMC-PAD Smooth." >&2
if [[ -n "$LOG" ]]; then
tail -20 "$LOG" >&2 || true
else
journalctl --user -u "$SERVICE" -n 20 --no-pager >&2 || true
fi
exit 1
fi