diff --git a/.claude/launch.json b/.claude/launch.json index d6e4453..30035ae 100644 --- a/.claude/launch.json +++ b/.claude/launch.json @@ -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 } ] diff --git a/Pipfile b/Pipfile index 6705ec6..65f099e 100644 --- a/Pipfile +++ b/Pipfile @@ -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" diff --git a/README.md b/README.md index 732eb51..6f1fd4c 100644 --- a/README.md +++ b/README.md @@ -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, diff --git a/chataigne/show.template.js b/chataigne/show.template.js index 712db0c..7a37f5d 100644 --- a/chataigne/show.template.js +++ b/chataigne/show.template.js @@ -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; diff --git a/chataigne/test/test.js b/chataigne/test/test.js index 4d63392..c5531b7 100644 --- a/chataigne/test/test.js +++ b/chataigne/test/test.js @@ -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; diff --git a/padcontroller/__init__.py b/padcontroller/__init__.py new file mode 100644 index 0000000..73eaed4 --- /dev/null +++ b/padcontroller/__init__.py @@ -0,0 +1 @@ +"""Pad Controller: the SMC-PAD preset editor and MIDI intercept.""" diff --git a/padeditor/__main__.py b/padcontroller/__main__.py similarity index 73% rename from padeditor/__main__.py rename to padcontroller/__main__.py index cb6f625..4bd0b14 100644 --- a/padeditor/__main__.py +++ b/padcontroller/__main__.py @@ -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: diff --git a/padeditor/device.py b/padcontroller/device.py similarity index 96% rename from padeditor/device.py rename to padcontroller/device.py index ba3884f..aac6844 100644 --- a/padeditor/device.py +++ b/padcontroller/device.py @@ -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)] diff --git a/padeditor/factory.bin b/padcontroller/factory.bin similarity index 100% rename from padeditor/factory.bin rename to padcontroller/factory.bin diff --git a/padeditor/layer.py b/padcontroller/layer.py similarity index 100% rename from padeditor/layer.py rename to padcontroller/layer.py diff --git a/padeditor/padcontroller.py b/padcontroller/midi.py similarity index 93% rename from padeditor/padcontroller.py rename to padcontroller/midi.py index 1049b01..a0ad327 100644 --- a/padeditor/padcontroller.py +++ b/padcontroller/midi.py @@ -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] diff --git a/padeditor/preset.py b/padcontroller/preset.py similarity index 100% rename from padeditor/preset.py rename to padcontroller/preset.py diff --git a/padeditor/server.py b/padcontroller/server.py similarity index 97% rename from padeditor/server.py rename to padcontroller/server.py index 1550f5a..4045255 100644 --- a/padeditor/server.py +++ b/padcontroller/server.py @@ -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. diff --git a/padeditor/static/app.js b/padcontroller/static/app.js similarity index 100% rename from padeditor/static/app.js rename to padcontroller/static/app.js diff --git a/padeditor/static/index.html b/padcontroller/static/index.html similarity index 96% rename from padeditor/static/index.html rename to padcontroller/static/index.html index cfad576..6abac25 100644 --- a/padeditor/static/index.html +++ b/padcontroller/static/index.html @@ -3,12 +3,12 @@ -SMC-PAD editor +Pad Controller
-

SMC-PAD

+

Pad Controller

diff --git a/padeditor/static/style.css b/padcontroller/static/style.css similarity index 100% rename from padeditor/static/style.css rename to padcontroller/static/style.css diff --git a/padeditor/sysex.py b/padcontroller/sysex.py similarity index 100% rename from padeditor/sysex.py rename to padcontroller/sysex.py diff --git a/padeditor/systemd/install.sh b/padcontroller/systemd/install.sh similarity index 83% rename from padeditor/systemd/install.sh rename to padcontroller/systemd/install.sh index 1e1d62e..063973b 100755 --- a/padeditor/systemd/install.sh +++ b/padcontroller/systemd/install.sh @@ -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 diff --git a/padeditor/systemd/padcontroller.service b/padcontroller/systemd/padcontroller.service similarity index 67% rename from padeditor/systemd/padcontroller.service rename to padcontroller/systemd/padcontroller.service index 494c9ea..7cadc1c 100644 --- a/padeditor/systemd/padcontroller.service +++ b/padcontroller/systemd/padcontroller.service @@ -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 diff --git a/padeditor/__init__.py b/padeditor/__init__.py deleted file mode 100644 index 6f4e9ac..0000000 --- a/padeditor/__init__.py +++ /dev/null @@ -1 +0,0 @@ -"""SMC-PAD preset editor.""" diff --git a/scripts/pad/decode_usbmon.py b/scripts/pad/decode_usbmon.py index a3f7267..70ed9d5 100644 --- a/scripts/pad/decode_usbmon.py +++ b/scripts/pad/decode_usbmon.py @@ -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(" 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", diff --git a/scripts/pad/start_midi.sh b/scripts/pad/start_midi.sh index fb8b068..d31d55a 100755 --- a/scripts/pad/start_midi.sh +++ b/scripts/pad/start_midi.sh @@ -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)." diff --git a/scripts/shows/colour_sets.py b/scripts/shows/colour_sets.py index cf0d64f..c2ee1d2 100644 --- a/scripts/shows/colour_sets.py +++ b/scripts/shows/colour_sets.py @@ -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 = ( diff --git a/shows/midi.qxw b/shows/midi.qxw index 89367b7..ca8f30c 100644 --- a/shows/midi.qxw +++ b/shows/midi.qxw @@ -14,7 +14,7 @@ - + diff --git a/shows/test.qxw b/shows/test.qxw index 65eab1d..703060a 100644 --- a/shows/test.qxw +++ b/shows/test.qxw @@ -14,7 +14,7 @@ - + diff --git a/shows/test.show.json b/shows/test.show.json index c3c7dcc..4a57d4f 100644 --- a/shows/test.show.json +++ b/shows/test.show.json @@ -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 diff --git a/tests/test_pad_layer.py b/tests/test_pad_layer.py index f89f592..2b29d52 100644 --- a/tests/test_pad_layer.py +++ b/tests/test_pad_layer.py @@ -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] diff --git a/tests/test_padeditor.py b/tests/test_padcontroller.py similarity index 90% rename from tests/test_padeditor.py rename to tests/test_padcontroller.py index c4def55..6fa004b 100644 --- a/tests/test_padeditor.py +++ b/tests/test_padcontroller.py @@ -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)