Show in the test show whether the pads are on the cans or the movers.
A Pads layer frame under the movers pads has Cans pads and Movers pads buttons (scripts/shows/layer_indicator.py). The pad controller holds channel 16 note 0 (cans) or 1 (movers) down and the other up whenever Pause changes, QLC+ reloads or it starts, and the Flash buttons light while their note is held, so the lit one is the layer and a missed message can't leave them the wrong way round. Each flashes an empty scene of its own: with one between them, QLC+ lit both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
467b480c76
commit
c7546e5ea9
5 files changed
+142
-13
No files matched your search
@@ -0,0 +1,57 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Show in shows/test.qxw whether the pad's bank 1 is on the cans or the movers.
|
||||
|
||||
Pause on the pad latches bank 1 onto the cans or the movers, but only
|
||||
padcontroller knows which is on (padcontroller/layer.py). It now says so on
|
||||
MIDI channel 16: note 0 held down for the cans and note 1 for the movers, the
|
||||
other released. Two Flash buttons in a Pads layer frame, under the movers
|
||||
pads frame, light while their note is held, so whichever is lit is the layer
|
||||
the pads are on. Flash rather than Toggle, so each message sets the state outright and a
|
||||
missed one can't leave them the wrong way round. Each flashes an empty scene
|
||||
of its own: QLC+ lights every button whose function is flashing, so with one
|
||||
scene between them both would light.
|
||||
|
||||
python3 scripts/shows/layer_indicator.py
|
||||
|
||||
Run it once; it stops if the frame is already there. QLC+ has to reopen the
|
||||
show to see it.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
|
||||
from mover_bank import NO_FUNCTION, ROOT, button, frame
|
||||
|
||||
SHOW = ROOT / "shows" / "test.qxw"
|
||||
LAYER_NOTE_BASE = 15 * 4096 + 128 # QLC+ input channel of a channel-16 note: this plus the note
|
||||
CANS_NOTE, MOVERS_NOTE = 0, 1 # padcontroller/layer.py
|
||||
SIZE = 90
|
||||
|
||||
|
||||
def main() -> None:
|
||||
xml = SHOW.read_text()
|
||||
if 'Caption="Pads layer"' in xml:
|
||||
raise SystemExit(f"{SHOW.relative_to(ROOT)} already has the pads layer indicator")
|
||||
fid = max(int(i) for i in re.findall(r'<Function ID="(\d+)" Type', xml)) + 1
|
||||
wid = max(int(i) for i in re.findall(r' ID="(\d+)"', xml.split("<VirtualConsole>")[1]) if int(i) != NO_FUNCTION) + 1
|
||||
|
||||
layers = (("Cans pads", CANS_NOTE), ("Movers pads", MOVERS_NOTE))
|
||||
scenes = "".join(f' <Function ID="{fid + k}" Type="Scene" Name="{caption} lamp">\n'
|
||||
' <Speed FadeIn="0" FadeOut="0" Duration="0"/>\n </Function>\n'
|
||||
for k, (caption, _) in enumerate(layers))
|
||||
buttons = "".join(button(wid + 1 + k, caption, 10 + k * SIZE, 10, SIZE, fid + k, LAYER_NOTE_BASE + note, "Flash")
|
||||
for k, (caption, note) in enumerate(layers))
|
||||
widget = frame(wid, "Pads layer", 470, 700, 2 * SIZE + 20, SIZE + 20, buttons, header=False)
|
||||
|
||||
anchor = ' <Frame Caption="Movers position" ID="106">' # after the movers pads in the console
|
||||
if anchor not in xml:
|
||||
raise SystemExit("Couldn't find the Movers position frame")
|
||||
xml = xml.replace(anchor, widget + anchor, 1)
|
||||
xml = xml.replace(" </Engine>", scenes + " </Engine>", 1)
|
||||
SHOW.write_text(xml)
|
||||
print(f"Added the pads layer indicator to {SHOW.relative_to(ROOT)} (widgets from ID {wid})")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in new issue
Block a user