Rename padeditor to padcontroller, with the MIDI intercept as padcontroller.midi and its virtual port as padcontroller.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1e09cb3825
commit
9742121144
31 files changed
+79
-79
No files matched your search
@@ -18,7 +18,7 @@ from pathlib import Path
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
sys.path.insert(0, str(ROOT))
|
||||
|
||||
from padeditor.sysex import decode # noqa: E402
|
||||
from padcontroller.sysex import decode # noqa: E402
|
||||
|
||||
LINKTYPE_USB_LINUX_MMAPPED = 220
|
||||
HEADER = struct.Struct("<QBBBBHBBqiiIIQiiII") # 64 bytes
|
||||
|
||||
@@ -32,11 +32,11 @@ sys.path.insert(0, str(ROOT))
|
||||
sys.path.insert(0, str(ROOT / "scripts" / "pad"))
|
||||
|
||||
from patch_smc_pad import PAD_COLORS # noqa: E402
|
||||
from padeditor import preset # noqa: E402
|
||||
from padeditor.device import PadError, read_image, save_image, transact # noqa: E402
|
||||
from padeditor.device import private_port as _private_port # noqa: E402
|
||||
from padeditor.preset import scale # noqa: E402
|
||||
from padeditor.sysex import ( # noqa: E402
|
||||
from padcontroller import preset # noqa: E402
|
||||
from padcontroller.device import PadError, read_image, save_image, transact # noqa: E402
|
||||
from padcontroller.device import private_port as _private_port # noqa: E402
|
||||
from padcontroller.preset import scale # noqa: E402
|
||||
from padcontroller.sysex import ( # noqa: E402
|
||||
RAM,
|
||||
decode,
|
||||
encode,
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
.venv/bin/python scripts/pad/pad_lamps.py
|
||||
|
||||
Needs the USB Private port. padeditor.padcontroller does this on start; run this
|
||||
Needs the USB Private port. padcontroller.midi does this on start; run this
|
||||
when the pad is read by Chataigne instead.
|
||||
"""
|
||||
|
||||
|
||||
@@ -75,13 +75,13 @@ PAD_COLORS = [
|
||||
|
||||
|
||||
def detect_midi_uid() -> str:
|
||||
"""Prefer smoothed virtual port when the pad controller (padeditor.padcontroller) is running."""
|
||||
"""Prefer smoothed virtual port when the pad controller (padcontroller.midi) is running."""
|
||||
try:
|
||||
out = subprocess.check_output(["aconnect", "-l"], text=True)
|
||||
except (FileNotFoundError, subprocess.CalledProcessError):
|
||||
out = ""
|
||||
for name in (
|
||||
"SMC-PAD Smooth",
|
||||
"padcontroller",
|
||||
"SMC-PAD Bluetooth",
|
||||
"SINCO SMC-PAD-Private",
|
||||
"SINCO SMC-PAD-Master",
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#
|
||||
# Order matters:
|
||||
# 1) pad present (Bluetooth or USB)
|
||||
# 2) pad controller (creates "SMC-PAD Smooth")
|
||||
# 2) pad controller (creates "padcontroller")
|
||||
# 3) patch workspace to that port
|
||||
# 4) open QLC+ last
|
||||
set -euo pipefail
|
||||
@@ -31,7 +31,7 @@ if ! pad_present; then
|
||||
fi
|
||||
|
||||
# Restart the pad controller so it re-opens the pad port cleanly. Use the systemd
|
||||
# user service when it is installed (padeditor/systemd/install.sh).
|
||||
# user service when it is installed (padcontroller/systemd/install.sh).
|
||||
SERVICE=padcontroller.service
|
||||
LOG=/tmp/padcontroller.log
|
||||
if systemctl --user is-enabled --quiet "$SERVICE" 2>/dev/null; then
|
||||
@@ -41,18 +41,18 @@ 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[.]padcontroller/ {print $1}')
|
||||
done < <(ps -eo pid,args | awk '/python.* -m padcontroller[.]midi/ {print $1}')
|
||||
sleep 0.4
|
||||
nohup "$PYTHON" -m padeditor.padcontroller --tau 0.055 >>"$LOG" 2>&1 &
|
||||
nohup "$PYTHON" -m padcontroller.midi --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
|
||||
if aconnect -l 2>/dev/null | grep -q 'padcontroller'; then
|
||||
break
|
||||
fi
|
||||
sleep 0.25
|
||||
done
|
||||
if ! aconnect -l 2>/dev/null | grep -q 'SMC-PAD Smooth'; then
|
||||
echo "The pad controller failed to create SMC-PAD Smooth." >&2
|
||||
if ! aconnect -l 2>/dev/null | grep -q 'padcontroller'; then
|
||||
echo "The pad controller failed to create padcontroller." >&2
|
||||
if [[ -n "$LOG" ]]; then
|
||||
tail -20 "$LOG" >&2 || true
|
||||
else
|
||||
@@ -69,7 +69,7 @@ nohup qlcplus --open "$ROOT/shows/midi.qxw" >/tmp/qlcplus.log 2>&1 &
|
||||
sleep 1.5
|
||||
|
||||
echo
|
||||
echo "Chain (expect pad → Smooth → qlcplus):"
|
||||
aconnect -l | grep -E "SMC-PAD|SINCO|Smooth|qlcplus|smc-smooth" -A2 || aconnect -l
|
||||
echo "Chain (expect pad → padcontroller → qlcplus):"
|
||||
aconnect -l | grep -E "SMC-PAD|SINCO|padcontroller|qlcplus" -A2 || aconnect -l
|
||||
echo
|
||||
echo "OK — twist a knob / hit a pad. If silent: re-run this script (don't pick Midi Through in IO)."
|
||||
@@ -12,7 +12,7 @@ The sliders are Playback sliders over five scenes per set (Dim, R, G, B, W),
|
||||
so they never override a channel. Knobs 1–5 move colour 1's sliders and knobs
|
||||
6–10 colour 2's. Run the pad controller with --lock-knobs to make them work only
|
||||
after the Custom pad is pressed; any other pad sends them back to zero (see
|
||||
padeditor/layer.py).
|
||||
padcontroller/layer.py).
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -26,12 +26,12 @@ SPEC = ROOT / "shows" / "test.show.json"
|
||||
FADE_MS = 1000
|
||||
DIMMER, RED, GREEN, BLUE, WHITE = 0, 2, 3, 4, 5
|
||||
PAD_BANK_2_FIRST_NOTE = 52
|
||||
HELD_FIRST_NOTE = 68 # padeditor/layer.py sends bank 2 here while Play is held
|
||||
HELD_FIRST_NOTE = 68 # padcontroller/layer.py sends bank 2 here while Play is held
|
||||
PROFILE = "M-VAVE SMC-PAD"
|
||||
OMNI = 16 # QLC+ MIDI plugin channel that accepts every MIDI channel
|
||||
PAD_MIDI_CH = 9 # the pads send notes on channel 10
|
||||
KNOB_FIRST_CC = 30 # pad knob 1; colour 2's sliders follow colour 1's
|
||||
PAD_PORT = "SMC-PAD Smooth" # padeditor/padcontroller.py; it applies the Play layer
|
||||
PAD_PORT = "padcontroller" # padcontroller/midi.py; it applies the Play layer
|
||||
|
||||
# name, r, g, b, w. Bottom row first, four to a row. The cans have a white emitter, so the whites use it.
|
||||
COLOURS = (
|
||||
|
||||
Reference in new issue
Block a user