diff --git a/padcontroller/layer.py b/padcontroller/layer.py index eb81830..bffef78 100644 --- a/padcontroller/layer.py +++ b/padcontroller/layer.py @@ -36,9 +36,9 @@ cans, 68–83 for the movers), or None once it is pressed again: the colour buttons toggle in a solo frame. QLC+ does not save which buttons are on, so reopen() presses them again when QLC+ loads the show. -The movers' Wander, Ballyhoo, Circle and Sweep pads (notes 96–99, pads 13–16 on -the movers layer) each toggle a relative EFX around the Pan and Tilt knobs (9 and -10, CC 38 and 39). They share a solo frame in QLC+, so starting one stops the others. +The movers' movement pads (pads 13–16, 9–12 and 5 on the movers layer: notes +96–99, 92–95 and 88) each toggle a relative EFX around the Pan and Tilt knobs (9 +and 10, CC 38 and 39). They share a solo frame in QLC+, so starting one stops the others. QLC+ 4.12 leaves an EFX's last offset on the movers when it stops, until those sliders change, so when the one that is on goes off, settle asks for the two knobs one step off and then back (nudge() and positions()). Swapping needs @@ -62,7 +62,8 @@ SUBMASTER_CC = 100 KNOB_CHANNEL = 0 PEAK_CC = 35 # knob 6 SIDE_CCS = (34, 37) # knobs 5 and 8: Cans 9–15 and Cans 1, 2, 7, 8 -RELATIVE_NOTES = (96, 97, 98, 99) # Wander, Ballyhoo, Circle, Sweep: pads 13–16 on the movers layer +# Wander, Ballyhoo, Circle, Sweep; Diamond, Square, Corners, Leaf; Tilt: pads 13–16, 9–12, 5 +RELATIVE_NOTES = (96, 97, 98, 99, 92, 93, 94, 95, 88) POSITION_CCS = (38, 39) # knobs 9 and 10: the movers' Pan and Tilt diff --git a/padcontroller/midi.py b/padcontroller/midi.py index be4ca06..5602212 100644 --- a/padcontroller/midi.py +++ b/padcontroller/midi.py @@ -19,8 +19,8 @@ the pad controller runs means the show has just loaded with every button off. REOPEN_DELAY later it presses the last colour pads again (see PlayLayer.colours), which it keeps in COLOURS_FILE so they outlive a restart of the pad controller. -When the movers' Wander, Ballyhoo, Circle or Sweep pad goes off, SETTLE_DELAY -later it nudges the Pan and Tilt knobs a step and puts them back, so QLC+ drops +When one of the movers' movement pads goes off, SETTLE_DELAY later it +nudges the Pan and Tilt knobs a step and puts them back, so QLC+ drops the EFX's last offset (see PlayLayer.settle). Usage: diff --git a/scripts/shows/mover_all_efx.py b/scripts/shows/mover_all_efx.py new file mode 100644 index 0000000..9a3b144 --- /dev/null +++ b/scripts/shows/mover_all_efx.py @@ -0,0 +1,94 @@ +#!/usr/bin/env python3 +"""Drop the movers' Strobe from shows/test.qxw and add the rest of QLC+'s EFX shapes. + +The movers layer has no Strobe any more (pad 9, note 92): its button, its scene +and the HTP strobe channel that let it beat the colour scenes all go. Its pad and +the rest of the second row, and pad 5, take the five EFX shapes the movers did +not have yet. They join Wander, Ballyhoo, Circle and Sweep in the Movement solo +frame, now three rows deep, so still only one runs at a time: + + 92 Diamond pad 9 a diamond, about ±64° of pan and ±21° of tilt + 93 Square pad 10 a square, about ±53° of pan and ±16° of tilt + 94 Corners pad 11 SquareChoppy: jumps corner to corner of the same square + 95 Leaf pad 12 a four-petal leaf, about ±53° of pan and ±26° of tilt + 88 Tilt pad 5 Line2 on tilt alone, about ±26° up and down + +Like the others each is a relative EFX around the Pan and Tilt knobs, with all +four movers together so the pairs mirror, fading in over 0.5 s. Knob 13's speed +dial gives Corners an eighth of its time (2.5 s a round to start with) and the +rest a quarter (5.5 s). padcontroller/layer.py settles the knobs after all nine. + + python3 scripts/shows/mover_all_efx.py + +Run it once on a show with Circle and Sweep and the movers' Strobe; it stops if +Diamond is already there. QLC+ has to reopen the show to see it. +""" + +from __future__ import annotations + +import re + +from mover_bank import M1, M2, M3, M4, NO_FUNCTION, ROOT, STROBE, button, note +from mover_more_efx import SIZE, START_MS, efx + +SHOW = ROOT / "shows" / "test.qxw" + +# Speed dial factor indexes: (Not Sent), 0, 1/16, 1/8, 1/4, ... +TIMES_1_8, TIMES_1_4 = 3, 4 + +# Caption, function name, algorithm, width, height (of 255 each way), can note, column, row, dial factor +MOVES = ( + ("Diamond", "Movers diamond", "Diamond", 30, 20, 44, 0, 1, TIMES_1_4), + ("Square", "Movers square", "Square", 25, 15, 45, 1, 1, TIMES_1_4), + ("Corners", "Movers corners", "SquareChoppy", 25, 15, 46, 2, 1, TIMES_1_8), + ("Leaf", "Movers leaf", "Leaf", 25, 25, 47, 3, 1, TIMES_1_4), + ("Tilt", "Movers tilt", "Line2", 0, 25, 40, 0, 2, TIMES_1_4), +) +ROWS = 3 + + +def cut(xml: str, pattern: str) -> str: + xml, n = re.subn(pattern, "", xml, count=1, flags=re.S) + assert n == 1, pattern + return xml + + +def main() -> None: + xml = SHOW.read_text() + if 'Name="Movers diamond"' in xml: + raise SystemExit(f"{SHOW.relative_to(ROOT)} already has the movers diamond") + + strobe = int(re.search(r'', xml).group(1)) + xml = cut(xml, rf' \n.*? \n') + # The cans' Strobe has the same caption; the movers' one is widget 89 (scripts/shows/mover_bank.py). + xml = cut(xml, r' \n') + for fid in (M1, M2, M3, M4): + xml, n = re.subn(rf'( {fid}\n(?: .*\n)*?) {STROBE}\n', r"\1", xml, count=1) + assert n == 1, fid + + engine, console = xml.split("") + fid = max(int(i) for i in re.findall(r'\n.*? \n', xml, re.S).group(0) + dial = re.search(r' \n.*? \n', xml, re.S).group(0) + functions, buttons, rows = "", "", "" + for i, (caption, name, algorithm, width, height, can_note, column, row, factor) in enumerate(MOVES): + start_ms = START_MS // 2 if factor == TIMES_1_8 else START_MS + functions += efx(fid + i, name, algorithm, width, height, start_ms) + buttons += button(wid + i, caption, SIZE * column, SIZE * row, SIZE, fid + i, note(can_note), indent=" ") + rows += f' {fid + i}\n' + + grown = re.sub(r'({SIZE * ROWS}"', + solo, count=1) + grown = grown.replace(" \n", buttons + " \n") + xml = xml.replace(solo, grown, 1) + xml = xml.replace(dial, dial.replace(" \n", rows + " \n"), 1) + xml = xml.replace(" ", functions + " ", 1) + SHOW.write_text(xml) + print(f"Dropped the movers' Strobe and added {len(MOVES)} shapes to {SHOW.relative_to(ROOT)} " + f"(functions {fid}–{fid + len(MOVES) - 1}, widgets {wid}–{wid + len(MOVES) - 1})") + + +if __name__ == "__main__": + main() diff --git a/scripts/shows/mover_more_efx.py b/scripts/shows/mover_more_efx.py index c70267f..5a3fa9f 100644 --- a/scripts/shows/mover_more_efx.py +++ b/scripts/shows/mover_more_efx.py @@ -40,7 +40,7 @@ MOVES = ( ) -def efx(fid: int, name: str, algorithm: str, width: int, height: int) -> str: +def efx(fid: int, name: str, algorithm: str, width: int, height: int, start_ms: int = START_MS) -> str: fixtures = "".join(f""" {f} 0 @@ -58,7 +58,7 @@ def efx(fid: int, name: str, algorithm: str, width: int, height: int) -> str: # Relative: the EFX adds its offset from 127 to the Pan and Tilt sliders' levels. return f""" {fixtures} Parallel - + Forward Loop {algorithm} diff --git a/shows/test.qxw b/shows/test.qxw index dd95130..d7944c7 100644 --- a/shows/test.qxw +++ b/shows/test.qxw @@ -120,7 +120,6 @@ 0
44
43 - 9
Small Eye 7 @@ -131,7 +130,6 @@ 0
0
43 - 9
beamZ @@ -225,7 +223,6 @@ 0
257
43 - 9
Small Eye 7 @@ -236,7 +233,6 @@ 0
300
43 - 9
Cans @@ -840,13 +836,6 @@ 55
- - - 8,255,9,230 - 8,255,9,230 - 8,255,9,230 - 8,255,9,230 - 0,255,1,230,5,0 @@ -1070,6 +1059,256 @@ 0 + + + 17 + 0 + 0 + Forward + 0 + + + 8 + 0 + 0 + Forward + 0 + + + 9 + 0 + 0 + Forward + 0 + + + 18 + 0 + 0 + Forward + 0 + + Parallel + + Forward + Loop + Diamond + 30 + 20 + 0 + 0 + 1 + + 127 + 1 + 0 + + + 127 + 1 + 0 + + + + + 17 + 0 + 0 + Forward + 0 + + + 8 + 0 + 0 + Forward + 0 + + + 9 + 0 + 0 + Forward + 0 + + + 18 + 0 + 0 + Forward + 0 + + Parallel + + Forward + Loop + Square + 25 + 15 + 0 + 0 + 1 + + 127 + 1 + 0 + + + 127 + 1 + 0 + + + + + 17 + 0 + 0 + Forward + 0 + + + 8 + 0 + 0 + Forward + 0 + + + 9 + 0 + 0 + Forward + 0 + + + 18 + 0 + 0 + Forward + 0 + + Parallel + + Forward + Loop + SquareChoppy + 25 + 15 + 0 + 0 + 1 + + 127 + 1 + 0 + + + 127 + 1 + 0 + + + + + 17 + 0 + 0 + Forward + 0 + + + 8 + 0 + 0 + Forward + 0 + + + 9 + 0 + 0 + Forward + 0 + + + 18 + 0 + 0 + Forward + 0 + + Parallel + + Forward + Loop + Leaf + 25 + 25 + 0 + 0 + 1 + + 127 + 1 + 0 + + + 127 + 1 + 0 + + + + + 17 + 0 + 0 + Forward + 0 + + + 8 + 0 + 0 + Forward + 0 + + + 9 + 0 + 0 + Forward + 0 + + + 18 + 0 + 0 + Forward + 0 + + Parallel + + Forward + Loop + Line2 + 0 + 25 + 0 + 0 + 1 + + 127 + 1 + 0 + + + 127 + 1 + 0 + + @@ -2578,7 +2817,7 @@ None Default - + True True False @@ -2642,21 +2881,77 @@ 100 + + + + + - @@ -2849,6 +3144,11 @@ 70 71 72 + 73 + 74 + 75 + 76 + 77 diff --git a/tests/test_pad_layer.py b/tests/test_pad_layer.py index 8b74bab..3ea5f9d 100644 --- a/tests/test_pad_layer.py +++ b/tests/test_pad_layer.py @@ -214,13 +214,14 @@ class PlayLayerTest(unittest.TestCase): layer.handle([0x99, 49, 100]) self.assertEqual((layer.moving, layer.settle), (None, True)) - def test_sweep_off_settles(self): - layer = PlayLayer() - layer.handle(PAUSE_DOWN) - self.assertEqual(layer.handle([0x99, 51, 100]), [[0x99, 99, 100]]) - self.assertEqual((layer.moving, layer.settle), (99, False)) - layer.handle([0x99, 51, 100]) - self.assertEqual((layer.moving, layer.settle), (None, True)) + def test_every_movement_pad_settles_when_it_goes_off(self): + for pad_note, sent in ((51, 99), (44, 92), (47, 95), (40, 88)): + layer = PlayLayer() + layer.handle(PAUSE_DOWN) + self.assertEqual(layer.handle([0x99, pad_note, 100]), [[0x99, sent, 100]]) + self.assertEqual((layer.moving, layer.settle), (sent, False)) + layer.handle([0x99, pad_note, 100]) + self.assertEqual((layer.moving, layer.settle), (None, True)) if __name__ == "__main__":