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
+2
-2
@@ -2,9 +2,9 @@
|
||||
"version": "0.0.1",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "padeditor",
|
||||
"name": "padcontroller",
|
||||
"runtimeExecutable": ".venv/bin/python",
|
||||
"runtimeArgs": ["-m", "padeditor", "--no-browser"],
|
||||
"runtimeArgs": ["-m", "padcontroller", "--no-browser"],
|
||||
"port": 8770
|
||||
}
|
||||
]
|
||||
|
||||
@@ -14,5 +14,5 @@ python_version = "3.12"
|
||||
|
||||
[scripts]
|
||||
midi = "python scripts/pad/midi.py"
|
||||
padcontroller = "python -m padeditor.padcontroller"
|
||||
padeditor = "python -m padeditor"
|
||||
padcontroller-midi = "python -m padcontroller.midi"
|
||||
padcontroller = "python -m padcontroller"
|
||||
@@ -53,13 +53,13 @@ manufacturer/model is missing.
|
||||
|
||||
## SMC-PAD pad controller
|
||||
|
||||
`padeditor.padcontroller` reads the SMC-PAD, smooths its knobs, applies the Play
|
||||
layer, and sends the result on a virtual MIDI port named `SMC-PAD Smooth` for
|
||||
QLC+. Run it by hand with `.venv/bin/python -m padeditor.padcontroller`, or install
|
||||
`padcontroller.midi` reads the SMC-PAD, smooths its knobs, applies the Play
|
||||
layer, and sends the result on a virtual MIDI port named `padcontroller` for
|
||||
QLC+. Run it by hand with `.venv/bin/python -m padcontroller.midi`, or install
|
||||
it as a systemd user service that starts at login and waits for the pad:
|
||||
|
||||
```bash
|
||||
padeditor/systemd/install.sh
|
||||
padcontroller/systemd/install.sh
|
||||
```
|
||||
|
||||
Options after the command go to the pad controller (for example `--lock-knobs`).
|
||||
@@ -76,7 +76,7 @@ python3 scripts/shows/make_chataigne.py shows/test.show.json chataigne/test
|
||||
|
||||
Open `chataigne/test/test.noisette`. The **Pad** (MIDI) module reads the SMC-PAD
|
||||
directly (`--pad` picks the port: USB `SINCO SMC-PAD-Master` by default, or
|
||||
`SMC-PAD Bluetooth`). The script does the Play-layer shift that `padeditor/layer.py` does for
|
||||
`SMC-PAD Bluetooth`). The script does the Play-layer shift that `padcontroller/layer.py` does for
|
||||
QLC+, with no knob smoothing, so the pad controller is not needed. Set the lamps with
|
||||
`scripts/pad/pad_lamps.py`. The **Lights** (DMX) module sends Art-Net to the
|
||||
node in the spec. The **Preview** module sends a copy to 127.0.0.1 for the simulator (`--preview ''` leaves it out). If it comes up on the wrong output, set DMX Type to Art-Net,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Pads pick colours, sliders mix a custom colour, like the QLC+ virtual console.
|
||||
// It reads the pad directly: Play shifts bank 2 here, as padeditor/layer.py does
|
||||
// It reads the pad directly: Play shifts bank 2 here, as padcontroller/layer.py does
|
||||
// when QLC+ is used.
|
||||
// Generated by scripts/shows/make_chataigne.py: edit this template, not the output.
|
||||
//
|
||||
@@ -11,7 +11,7 @@
|
||||
var LAMP = "Lamp";
|
||||
var LAMP_OFF = 0.3; // brightness of a pad's tile when it is not playing
|
||||
var FADE_RATE = 100; // script updates per second
|
||||
var PLAY_CC = 27; // hold Play to move bank 2 (notes 52-67) up 16, like padeditor/layer.py
|
||||
var PLAY_CC = 27; // hold Play to move bank 2 (notes 52-67) up 16, like padcontroller/layer.py
|
||||
var BANK_FIRST = 52;
|
||||
var BANK_LAST = 67;
|
||||
var BANK_SHIFT = 16;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Pads pick colours, sliders mix a custom colour, like the QLC+ virtual console.
|
||||
// It reads the pad directly: Play shifts bank 2 here, as padeditor/layer.py does
|
||||
// It reads the pad directly: Play shifts bank 2 here, as padcontroller/layer.py does
|
||||
// when QLC+ is used.
|
||||
// Generated by scripts/shows/make_chataigne.py: edit this template, not the output.
|
||||
//
|
||||
@@ -70,7 +70,7 @@ var GROUPS = [
|
||||
var LAMP = "Lamp";
|
||||
var LAMP_OFF = 0.3; // brightness of a pad's tile when it is not playing
|
||||
var FADE_RATE = 100; // script updates per second
|
||||
var PLAY_CC = 27; // hold Play to move bank 2 (notes 52-67) up 16, like padeditor/layer.py
|
||||
var PLAY_CC = 27; // hold Play to move bank 2 (notes 52-67) up 16, like padcontroller/layer.py
|
||||
var BANK_FIRST = 52;
|
||||
var BANK_LAST = 67;
|
||||
var BANK_SHIFT = 16;
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
"""Pad Controller: the SMC-PAD preset editor and MIDI intercept."""
|
||||
@@ -1,4 +1,4 @@
|
||||
"""python3 -m padeditor [--port 8770]"""
|
||||
"""python3 -m padcontroller [--port 8770]"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
@@ -6,18 +6,18 @@ import argparse
|
||||
import threading
|
||||
import webbrowser
|
||||
|
||||
from padeditor.server import make_server
|
||||
from padcontroller.server import make_server
|
||||
|
||||
|
||||
def main(argv: list[str] | None = None) -> int:
|
||||
parser = argparse.ArgumentParser(prog="padeditor", description="SMC-PAD preset editor")
|
||||
parser = argparse.ArgumentParser(prog="padcontroller", description="Pad Controller: SMC-PAD preset editor")
|
||||
parser.add_argument("--host", default="127.0.0.1")
|
||||
parser.add_argument("--port", type=int, default=8770)
|
||||
parser.add_argument("--no-browser", action="store_true")
|
||||
args = parser.parse_args(argv)
|
||||
server = make_server(args.host, args.port)
|
||||
url = f"http://{args.host}:{args.port}/"
|
||||
print(f"SMC-PAD editor → {url} Ctrl+C to quit")
|
||||
print(f"Pad Controller → {url} Ctrl+C to quit")
|
||||
if not args.no_browser:
|
||||
threading.Timer(0.4, webbrowser.open, args=(url,)).start()
|
||||
try:
|
||||
@@ -13,8 +13,8 @@ import sys
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
from padeditor.preset import GLOBAL_LEN, IMAGE_LEN, changed_ranges
|
||||
from padeditor.sysex import (
|
||||
from padcontroller.preset import GLOBAL_LEN, IMAGE_LEN, changed_ranges
|
||||
from padcontroller.sysex import (
|
||||
CMD_READ,
|
||||
MEM_GLOBAL,
|
||||
MEM_PRESET,
|
||||
@@ -84,7 +84,7 @@ def transact(midiout, midiin, message: list[int], timeout: float = 0.8, expect:
|
||||
|
||||
|
||||
def decode_body(raw: bytes) -> bytes:
|
||||
from padeditor.sysex import decode
|
||||
from padcontroller.sysex import decode
|
||||
|
||||
return decode(raw[1:-1])
|
||||
|
||||
@@ -182,7 +182,7 @@ def read_global(link: Link | None = None) -> bytes:
|
||||
def set_bank(bank: int, link: Link | None = None) -> int:
|
||||
"""Switch the pad bank the way MidiSuite does: one live byte in the
|
||||
global block. It does not commit; Save keeps whatever the block holds."""
|
||||
from padeditor.preset import GLOBAL_BANK
|
||||
from padcontroller.preset import GLOBAL_BANK
|
||||
|
||||
if bank not in (0, 1):
|
||||
raise PadError("pad bank must be 0 or 1")
|
||||
@@ -235,7 +235,7 @@ def save_image(desired: bytes, link: Link | None = None, settings: bytes | None
|
||||
def write_colour(preset: int, index: int, rgb: tuple[int, int, int] | list[int]) -> int:
|
||||
"""Light one pad. The same three-byte write MidiSuite sends while its
|
||||
colour picker moves. It does not commit; Save does that."""
|
||||
from padeditor.preset import colour_offset
|
||||
from padcontroller.preset import colour_offset
|
||||
|
||||
if len(rgb) != 3:
|
||||
raise PadError("a pad colour needs red, green, and blue")
|
||||
@@ -270,7 +270,7 @@ def probe_relative(listen: float = 2.5) -> str:
|
||||
when a turn of that knob sends a step, ``absolute`` when it sends a
|
||||
running value, or ``silent`` when nothing arrives.
|
||||
"""
|
||||
from padeditor.preset import KNOB_AT, KNOB_COUNT, KNOB_LEN, PRESET_COUNT, PRESET_LEN, RELATIVE_TYPE
|
||||
from padcontroller.preset import KNOB_AT, KNOB_COUNT, KNOB_LEN, PRESET_COUNT, PRESET_LEN, RELATIVE_TYPE
|
||||
|
||||
knob = KNOB_COUNT - 1
|
||||
offsets = [index * PRESET_LEN + KNOB_AT + knob * KNOB_LEN for index in range(PRESET_COUNT)]
|
||||
File renamed without changes.
File renamed without changes.
@@ -2,20 +2,20 @@
|
||||
|
||||
Reads the physical pad (Bluetooth or USB), passes pad notes through
|
||||
immediately, and eases Control Change values toward their targets at
|
||||
~120 Hz before emitting on a virtual port named "SMC-PAD Smooth".
|
||||
~120 Hz before emitting on a virtual port named "padcontroller".
|
||||
|
||||
On start it also sets the pad lamps over USB (scripts/pad/pad_lamps.py): bank 1 off and
|
||||
bank 2 in the colours from shows/test.qxw. On Bluetooth it says so and carries on.
|
||||
While Play is held, bank 2 notes 52–67 go out as 68–83 (see padeditor/layer.py).
|
||||
While Play is held, bank 2 notes 52–67 go out as 68–83 (see padcontroller/layer.py).
|
||||
|
||||
Point QLC+ MIDI input at that virtual port (midi.qxw does this via
|
||||
patch_smc_pad.py once the pad controller is running).
|
||||
|
||||
Usage:
|
||||
.venv/bin/python -m padeditor.padcontroller
|
||||
.venv/bin/python -m padcontroller.midi
|
||||
# optional: --tau 0.05 (seconds; lower = snappier, higher = silkier)
|
||||
|
||||
padeditor/systemd/install.sh runs it as a systemd user service.
|
||||
padcontroller/systemd/install.sh runs it as a systemd user service.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -35,13 +35,13 @@ for p in glob.glob(str(ROOT / ".venv" / "lib" / "python*" / "site-packages")):
|
||||
sys.path.insert(0, p)
|
||||
import rtmidi
|
||||
|
||||
from padeditor.layer import PlayLayer # noqa: E402
|
||||
from padcontroller.layer import PlayLayer # noqa: E402
|
||||
|
||||
# The lamp colours come from the show scripts, which are not part of this package.
|
||||
sys.path.insert(0, str(ROOT / "scripts" / "pad"))
|
||||
from pad_lamps import set_lamps # noqa: E402
|
||||
|
||||
VIRTUAL_NAME = "SMC-PAD Smooth"
|
||||
VIRTUAL_NAME = "padcontroller"
|
||||
SOURCE_HINTS = (
|
||||
"SMC-PAD Bluetooth",
|
||||
"SINCO SMC-PAD-Private",
|
||||
@@ -96,7 +96,7 @@ def ensure_alsa_link() -> None:
|
||||
src = _alsa_port(hint)
|
||||
if src:
|
||||
break
|
||||
dst = _alsa_port("smc-smooth-in")
|
||||
dst = _alsa_port("padcontroller-in")
|
||||
if not src or not dst:
|
||||
return
|
||||
subprocess.run(["aconnect", src, dst], capture_output=True)
|
||||
@@ -119,8 +119,8 @@ def main() -> None:
|
||||
ap.add_argument("--no-lamps", action="store_true", help="leave the pad lamp colours alone")
|
||||
args = ap.parse_args()
|
||||
|
||||
midiin = rtmidi.MidiIn(rtapi=rtmidi.API_LINUX_ALSA, name="smc-smooth-in")
|
||||
midiout = rtmidi.MidiOut(rtapi=rtmidi.API_LINUX_ALSA, name="smc-smooth-out")
|
||||
midiin = rtmidi.MidiIn(rtapi=rtmidi.API_LINUX_ALSA, name="padcontroller-in")
|
||||
midiout = rtmidi.MidiOut(rtapi=rtmidi.API_LINUX_ALSA, name="padcontroller-out")
|
||||
|
||||
src = find_source_port(midiin)
|
||||
src_name = midiin.get_ports()[src]
|
||||
File renamed without changes.
@@ -10,8 +10,8 @@ from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
||||
from pathlib import Path
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from padeditor.device import Link, PadError, connected, read_global, read_image, save_image, set_bank, write_colour
|
||||
from padeditor.preset import IMAGE_LEN, PresetError, pack, pack_global, unpack, unpack_global
|
||||
from padcontroller.device import Link, PadError, connected, read_global, read_image, save_image, set_bank, write_colour
|
||||
from padcontroller.preset import IMAGE_LEN, PresetError, pack, pack_global, unpack, unpack_global
|
||||
|
||||
STATIC_DIR = Path(__file__).parent / "static"
|
||||
# The image MidiSuite uploads for its factory reset, and its global block.
|
||||
File renamed without changes.
@@ -3,12 +3,12 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>SMC-PAD editor</title>
|
||||
<title>Pad Controller</title>
|
||||
<link rel="stylesheet" href="/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<h1>SMC-PAD</h1>
|
||||
<h1>Pad Controller</h1>
|
||||
<button id="load" type="button">Load</button>
|
||||
<button id="save" type="button" class="primary" disabled>Save to pad</button>
|
||||
<button id="factory" type="button">Factory reset</button>
|
||||
File renamed without changes.
File renamed without changes.
@@ -1,9 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# Install the SMC-PAD pad controller as a systemd user service and start it.
|
||||
#
|
||||
# padeditor/systemd/install.sh # install, enable, start
|
||||
# padeditor/systemd/install.sh --lock-knobs # pass options to the pad controller
|
||||
# padeditor/systemd/install.sh --uninstall
|
||||
# padcontroller/systemd/install.sh # install, enable, start
|
||||
# padcontroller/systemd/install.sh --lock-knobs # pass options to the pad controller
|
||||
# padcontroller/systemd/install.sh --uninstall
|
||||
#
|
||||
# Logs: journalctl --user -u padcontroller -f
|
||||
set -euo pipefail
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
# SMC-PAD pad controller (padeditor.padcontroller) as a systemd user service.
|
||||
# SMC-PAD pad controller (padcontroller.midi) as a systemd user service.
|
||||
# install.sh fills in @ROOT@, @PYTHON@ and @ARGS@ and copies it to
|
||||
# ~/.config/systemd/user/.
|
||||
|
||||
[Unit]
|
||||
Description=SMC-PAD pad controller (virtual port "SMC-PAD Smooth")
|
||||
Description=SMC-PAD pad controller (virtual port "padcontroller")
|
||||
After=sound.target
|
||||
# Keep retrying while the pad is switched off or not paired yet.
|
||||
StartLimitIntervalSec=0
|
||||
@@ -11,7 +11,7 @@ StartLimitIntervalSec=0
|
||||
[Service]
|
||||
Type=simple
|
||||
WorkingDirectory=@ROOT@
|
||||
ExecStart=@PYTHON@ -m padeditor.padcontroller @ARGS@
|
||||
ExecStart=@PYTHON@ -m padcontroller.midi @ARGS@
|
||||
Environment=PYTHONUNBUFFERED=1
|
||||
# The pad controller closes its ports on Ctrl+C.
|
||||
KillSignal=SIGINT
|
||||
@@ -1 +0,0 @@
|
||||
"""SMC-PAD preset editor."""
|
||||
@@ -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 = (
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
</Output>
|
||||
</Universe>
|
||||
<Universe Name="Universe 2" ID="1">
|
||||
<Input Plugin="MIDI" UID="SMC-PAD Smooth" Line="0" Profile="M-VAVE SMC-PAD">
|
||||
<Input Plugin="MIDI" UID="padcontroller" Line="0" Profile="M-VAVE SMC-PAD">
|
||||
<PluginParameters midichannel="16"/>
|
||||
</Input>
|
||||
</Universe>
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
</Output>
|
||||
</Universe>
|
||||
<Universe Name="Universe 2" ID="1">
|
||||
<Input Plugin="MIDI" UID="SMC-PAD Smooth" Line="0" Profile="M-VAVE SMC-PAD">
|
||||
<Input Plugin="MIDI" UID="padcontroller" Line="0" Profile="M-VAVE SMC-PAD">
|
||||
<PluginParameters midichannel="16"/>
|
||||
</Input>
|
||||
</Universe>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
"name": "Universe 2",
|
||||
"input": {
|
||||
"plugin": "MIDI",
|
||||
"uid": "SMC-PAD Smooth",
|
||||
"uid": "padcontroller",
|
||||
"profile": "M-VAVE SMC-PAD",
|
||||
"channel": 16,
|
||||
"line": 0
|
||||
|
||||
@@ -4,7 +4,7 @@ from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
|
||||
|
||||
from padeditor.layer import PlayLayer # noqa: E402
|
||||
from padcontroller.layer import PlayLayer # noqa: E402
|
||||
|
||||
PLAY_DOWN = [0xB0, 27, 127]
|
||||
PLAY_UP = [0xB0, 27, 0]
|
||||
|
||||
@@ -8,7 +8,7 @@ from pathlib import Path
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
sys.path.insert(0, str(ROOT))
|
||||
|
||||
from padeditor.preset import ( # noqa: E402
|
||||
from padcontroller.preset import ( # noqa: E402
|
||||
GAP_AT,
|
||||
IMAGE_LEN,
|
||||
KNOB_AT,
|
||||
@@ -20,7 +20,7 @@ from padeditor.preset import ( # noqa: E402
|
||||
scale,
|
||||
unpack,
|
||||
)
|
||||
from padeditor.sysex import decode, encode # noqa: E402
|
||||
from padcontroller.sysex import decode, encode # noqa: E402
|
||||
|
||||
FACTORY_KNOB = bytes.fromhex("0002001e007f")
|
||||
|
||||
@@ -86,8 +86,8 @@ def test_an_edit_dirties_only_that_byte():
|
||||
|
||||
|
||||
def test_a_colour_is_one_write_like_midisuite(monkeypatch):
|
||||
from padeditor import device
|
||||
from padeditor.preset import colour_offset
|
||||
from padcontroller import device
|
||||
from padcontroller.preset import colour_offset
|
||||
|
||||
# MidiSuite set preset 5 record 21 green with one write to 0x3a46.
|
||||
assert colour_offset(4, 21) == 0x3A46
|
||||
@@ -107,7 +107,7 @@ def test_a_colour_is_one_write_like_midisuite(monkeypatch):
|
||||
|
||||
|
||||
def test_global_block_matches_midisuite():
|
||||
from padeditor.preset import pack_global, unpack_global
|
||||
from padcontroller.preset import pack_global, unpack_global
|
||||
|
||||
factory = bytes.fromhex("780032040000020001010000")
|
||||
block = unpack_global(factory)
|
||||
@@ -126,7 +126,7 @@ def test_colour_scale_matches_the_pad_lamps():
|
||||
|
||||
|
||||
def test_a_step_is_relative_and_a_ramp_is_absolute():
|
||||
from padeditor.device import _classify
|
||||
from padcontroller.device import _classify
|
||||
|
||||
assert _classify([]) == "silent"
|
||||
assert _classify([(0, 45, 1), (0, 45, 127)]) == "relative"
|
||||
@@ -134,7 +134,7 @@ def test_a_step_is_relative_and_a_ramp_is_absolute():
|
||||
|
||||
|
||||
def test_export_packs_the_image_without_opening_midi():
|
||||
from padeditor.server import ApiError, Editor
|
||||
from padcontroller.server import ApiError, Editor
|
||||
|
||||
raw = bytes(_image())
|
||||
assert Editor().exported(unpack(raw)) == raw
|
||||
@@ -174,18 +174,18 @@ def test_factory_image_reads_as_midisuite_shows_it():
|
||||
def test_factory_document_packs_back_to_the_midisuite_image():
|
||||
from pathlib import Path
|
||||
|
||||
from padeditor.preset import pack
|
||||
from padeditor.server import Editor
|
||||
from padcontroller.preset import pack
|
||||
from padcontroller.server import Editor
|
||||
|
||||
document = Editor().factory()
|
||||
assert pack(document) == (Path(__file__).parents[1] / "padeditor" / "factory.bin").read_bytes()
|
||||
assert pack(document) == (Path(__file__).parents[1] / "padcontroller" / "factory.bin").read_bytes()
|
||||
assert document["global"]["raw"] == "780032040000020001010000"
|
||||
|
||||
|
||||
def test_global_bank_byte_round_trips_and_is_checked():
|
||||
import pytest
|
||||
|
||||
from padeditor.preset import PresetError, pack_global, unpack_global
|
||||
from padcontroller.preset import PresetError, pack_global, unpack_global
|
||||
|
||||
raw = bytes.fromhex("780032040000020001010001")
|
||||
block = unpack_global(raw)
|
||||
Reference in new issue
Block a user