Add cabaret's can patterns to the test show.
Eight of make_cabaret_vc.py's Can Patterns on the cans pads 1-8, in a Can patterns solo frame in place of the pads frame's empty Buttons 53-60: Theater, Rainbow, Odd Even, Left Right, Scanner (with a fading tail), Fill, Center and Pairs, laid out for the test show's cans and walking the ring round the room (scripts/shows/can_patterns.py). Collapse and Chase Out are left out. The masks show the Colour 1 colour; Odd Even (a checkerboard) and Left Right swap between Colour 1 and Colour 2 through four Matrix widgets in the Chase colours frame. All of them follow the cans' Speed dial (knob 1). Each pattern is RGB matrices running from start to stop (rgbscripts/steps.js and swap.js, linked into ~/.qlcplus/rgbscripts), so a chase started over one lands on top, and the pad controller restarts the pattern that is on just after a Colour 1 press so the new colour scene doesn't cover it. The row of 4 (#3-#6) never animates; CLAUDE.md now says so for whatever comes next. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e7e1cf656b
commit
4fd11445e8
9 files changed
+1622
-98
No files matched your search
@@ -21,6 +21,15 @@ 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
|
||||
none: the new EFX writes over the old one's offset. moving holds the note whose
|
||||
EFX is on, from the presses: only a guess, as QLC+ sends no feedback for it.
|
||||
|
||||
The cans' pattern pads (pads 1–8 on the cans layer: notes 36–43) each toggle a
|
||||
pattern, in a solo frame like the movement pads; pattern holds the note of the
|
||||
one that is on. A Colour 1 pad starts a colour scene on the cans, and the
|
||||
newest function wins their colour, so the scene would cover the pattern. While
|
||||
a pattern is on, a Colour 1 press sets restart_pattern, and the caller sends
|
||||
pattern_tap() twice a moment later, off and on again, so the pattern restarts on
|
||||
top in the new colour. Taps sent with the colour itself land in the same QLC+
|
||||
tick and change nothing.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -37,6 +46,7 @@ KNOB_CHANNEL = 0
|
||||
# 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
|
||||
PATTERN_NOTES = range(36, 44) # the can patterns: pads 1–8 on the cans layer
|
||||
|
||||
|
||||
class PlayLayer:
|
||||
@@ -49,6 +59,9 @@ class PlayLayer:
|
||||
self.position = {cc: 0 for cc in POSITION_CCS}
|
||||
self.moving: int | None = None
|
||||
self.settle = False # a relative EFX just went off: the caller sends nudge(), then positions()
|
||||
self.pattern: int | None = None
|
||||
self.pattern_channel = 0
|
||||
self.restart_pattern = False # a Colour 1 press covered the pattern: the caller sends pattern_tap() twice
|
||||
# set -> (channel, note sent) of the colour that is on
|
||||
self.colours: dict[int, tuple[int, int] | None] = {1: None, 2: None}
|
||||
|
||||
@@ -83,6 +96,11 @@ class PlayLayer:
|
||||
self.settle = True
|
||||
else:
|
||||
self.moving = note
|
||||
elif note in PATTERN_NOTES and is_on:
|
||||
self.pattern = None if note == self.pattern else note
|
||||
self.pattern_channel = channel
|
||||
elif FIRST_NOTE <= note <= LAST_NOTE and is_on and self.pattern is not None:
|
||||
self.restart_pattern = True
|
||||
if is_on and FIRST_NOTE <= out <= LAST_NOTE + SHIFT:
|
||||
colour_set = 1 if out <= LAST_NOTE else 2
|
||||
pressed = (channel, out)
|
||||
@@ -100,12 +118,17 @@ class PlayLayer:
|
||||
def reopen(self) -> list[list[int]]:
|
||||
"""QLC+ has loaded the show: everything is off. Press the colours that were on."""
|
||||
self.moving = None
|
||||
self.pattern = None
|
||||
out = []
|
||||
for colour in self.colours.values():
|
||||
if colour is not None:
|
||||
out += tap(*colour)
|
||||
return out
|
||||
|
||||
def pattern_tap(self) -> list[list[int]]:
|
||||
"""A tap of the can pattern that is on, to toggle it; nothing once none is."""
|
||||
return [] if self.pattern is None else tap(self.pattern_channel, self.pattern)
|
||||
|
||||
def nudge(self) -> list[list[int]]:
|
||||
"""Pan and Tilt one step off their knobs, so QLC+ writes them again."""
|
||||
return [[0xB0 | KNOB_CHANNEL, cc, v - 1 if v else 1] for cc, v in self.position.items()]
|
||||
|
||||
@@ -60,6 +60,7 @@ VIRTUAL_NAME = "padcontroller"
|
||||
COLOURS_FILE = Path(os.environ.get("XDG_STATE_HOME", Path.home() / ".local" / "state")) / "padcontroller" / "colours.json"
|
||||
REOPEN_DELAY = 1.5 # s for QLC+ to finish loading the virtual console
|
||||
SETTLE_DELAY = 0.1 # s for QLC+ to stop a relative EFX before the knob nudge, and between its two steps
|
||||
RESTART_DELAY = 0.1 # s after a Colour 1 press before the can pattern's off tap, and between it and the on tap
|
||||
# Bluetooth first when the pad is paired, USB otherwise.
|
||||
SOURCE_HINTS = (
|
||||
"SMC-PAD Bluetooth",
|
||||
@@ -265,6 +266,9 @@ def main() -> None:
|
||||
if layer.settle:
|
||||
layer.settle = False
|
||||
later += [(now + SETTLE_DELAY, layer.nudge), (now + 2 * SETTLE_DELAY, layer.positions)]
|
||||
if layer.restart_pattern:
|
||||
layer.restart_pattern = False
|
||||
later += [(now + RESTART_DELAY, layer.pattern_tap), (now + 2 * RESTART_DELAY, layer.pattern_tap)]
|
||||
for due in [item for item in later if now >= item[0]]:
|
||||
later.remove(due)
|
||||
for out in due[1]():
|
||||
|
||||
Reference in new issue
Block a user