Add a Ballyhoo pad for the movers to the test show.
Pad 11 on the movers layer (note 94) toggles a fast figure of eight around the Pan and Tilt knobs, like Wander: about ±85° of pan and ±26° of tilt, all four movers together so the pairs mirror left to right and front to back (scripts/shows/mover_ballyhoo.py). The pad controller now settles the knobs after Ballyhoo goes off as well as Wander, and keeps track of each separately. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8caf341d30
commit
913494c0aa
5 files changed
+180
-18
No files matched your search
+14
-12
@@ -36,11 +36,12 @@ 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 pad (note 93, pad 10 on the movers layer) toggles a relative
|
||||
EFX around the Pan and Tilt knobs (9 and 10, CC 38 and 39). QLC+ 4.12 leaves the
|
||||
EFX's last offset on the movers when it stops, until those sliders change, so
|
||||
when Wander goes off, settle() asks for the two knobs one step off and then back
|
||||
(nudge() and positions()). wander follows the presses, a guess like pump.
|
||||
The movers' Wander and Ballyhoo pads (notes 93 and 94, pads 10 and 11 on the
|
||||
movers layer) each toggle a relative EFX around the Pan and Tilt knobs (9 and 10,
|
||||
CC 38 and 39). QLC+ 4.12 leaves an EFX's last offset on the movers when it stops,
|
||||
until those sliders change, so when either goes off, settle asks for the two
|
||||
knobs one step off and then back (nudge() and positions()). moving holds the
|
||||
notes whose EFX is on, from the presses: a guess like pump.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -59,7 +60,7 @@ 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
|
||||
WANDER_NOTE = 93 # pad 10 on the movers layer
|
||||
RELATIVE_NOTES = (93, 94) # Wander and Ballyhoo, pads 10 and 11 on the movers layer
|
||||
POSITION_CCS = (38, 39) # knobs 9 and 10: the movers' Pan and Tilt
|
||||
|
||||
|
||||
@@ -75,8 +76,8 @@ class PlayLayer:
|
||||
self.knobs = {cc: 127 for cc in (PEAK_CC, *SIDE_CCS)}
|
||||
# Pan and Tilt as last sent; QLC+ starts them at 0.
|
||||
self.position = {cc: 0 for cc in POSITION_CCS}
|
||||
self.wander = False
|
||||
self.settle = False # Wander just went off: the caller sends nudge(), then positions()
|
||||
self.moving: set[int] = set()
|
||||
self.settle = False # a relative EFX just went off: the caller sends nudge(), then positions()
|
||||
# set -> (channel, note sent) of the colour that is on
|
||||
self.colours: dict[int, tuple[int, int] | None] = {1: None, 2: None}
|
||||
|
||||
@@ -129,9 +130,10 @@ class PlayLayer:
|
||||
extra = self.sides(restore=True)
|
||||
self.threshold = not self.threshold
|
||||
extra = [*extra, [0xB0, SUBMASTER_CC, 0 if self.threshold else 127]]
|
||||
elif note == WANDER_NOTE and is_on:
|
||||
self.wander = not self.wander
|
||||
self.settle = not self.wander
|
||||
elif note in RELATIVE_NOTES and is_on:
|
||||
if note in self.moving:
|
||||
self.settle = True
|
||||
self.moving ^= {note}
|
||||
if is_on and FIRST_NOTE <= out <= LAST_NOTE + SHIFT:
|
||||
colour_set = 1 if out <= LAST_NOTE else 2
|
||||
pressed = (channel, out)
|
||||
@@ -153,7 +155,7 @@ class PlayLayer:
|
||||
"""
|
||||
self.pump = False
|
||||
self.threshold = False
|
||||
self.wander = False
|
||||
self.moving.clear()
|
||||
out = []
|
||||
for colour in self.colours.values():
|
||||
if colour is not None:
|
||||
|
||||
@@ -19,7 +19,7 @@ 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 pad goes off, SETTLE_DELAY later it nudges the Pan and
|
||||
When the movers' Wander or Ballyhoo pad 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).
|
||||
|
||||
@@ -61,7 +61,7 @@ from pad_lamps import set_lamps, set_sound_lamps # noqa: E402
|
||||
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 the Wander EFX before the knob nudge, and between its two steps
|
||||
SETTLE_DELAY = 0.1 # s for QLC+ to stop a relative EFX before the knob nudge, and between its two steps
|
||||
# Bluetooth first when the pad is paired, USB otherwise.
|
||||
SOURCE_HINTS = (
|
||||
"SMC-PAD Bluetooth",
|
||||
@@ -228,7 +228,7 @@ def main() -> None:
|
||||
load_colours(layer)
|
||||
saved_colours = dict(layer.colours)
|
||||
reopen_at: float | None = None
|
||||
# (when, messages to send then), for the Wander settle
|
||||
# (when, messages to send then), for the Wander and Ballyhoo settle
|
||||
later: list[tuple[float, Callable[[], list[list[int]]]]] = []
|
||||
# Links made this soon after start are ours being restored, with QLC+'s buttons as they were.
|
||||
reopen_from = time.monotonic() + 5.0
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Add a Ballyhoo pad for the movers to shows/test.qxw, on note 94.
|
||||
|
||||
On the movers layer (Pause on), pad 11 toggles a fast, wide figure of eight
|
||||
around wherever the Pan and Tilt knobs (9 and 10, CC 38 and 39) put the movers,
|
||||
as Wander does:
|
||||
|
||||
94 Ballyhoo an Eight about ±85° of pan and ±26° of tilt, 3 s round
|
||||
|
||||
All four start together. M1 and M4 turn the other way to M2 and M3, so the
|
||||
same move mirrors left to right and front to back, and the beams sweep out
|
||||
and cross in the middle together. It fades in over 0.5 s. When it goes off,
|
||||
the pad controller nudges the two knobs so QLC+ drops its last offset
|
||||
(padcontroller/layer.py).
|
||||
|
||||
python3 scripts/shows/mover_ballyhoo.py
|
||||
|
||||
Run it once on a show with Wander and without Ballyhoo; it stops if Ballyhoo
|
||||
is already there. QLC+ has to reopen the show to see it.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
|
||||
from mover_bank import LEFT_TO_RIGHT, NO_FUNCTION, ROOT, button, note
|
||||
|
||||
SHOW = ROOT / "shows" / "test.qxw"
|
||||
|
||||
WIDTH, HEIGHT = 40, 24 # of 255 each way: 540° of pan, 270° of tilt
|
||||
ROUND_MS = 3000
|
||||
FADE_IN_MS = 500
|
||||
|
||||
|
||||
def efx(fid: int) -> str:
|
||||
fixtures = "".join(f""" <Fixture>
|
||||
<ID>{f}</ID>
|
||||
<Head>0</Head>
|
||||
<Mode>0</Mode>
|
||||
<Direction>Forward</Direction>
|
||||
<StartOffset>0</StartOffset>
|
||||
</Fixture>
|
||||
""" for f in LEFT_TO_RIGHT)
|
||||
# Relative: the EFX adds its offset from 127 to the Pan and Tilt sliders' levels.
|
||||
return f""" <Function ID="{fid}" Type="EFX" Name="Movers ballyhoo">
|
||||
{fixtures} <PropagationMode>Parallel</PropagationMode>
|
||||
<Speed FadeIn="{FADE_IN_MS}" FadeOut="0" Duration="{ROUND_MS}"/>
|
||||
<Direction>Forward</Direction>
|
||||
<RunOrder>Loop</RunOrder>
|
||||
<Algorithm>Eight</Algorithm>
|
||||
<Width>{WIDTH}</Width>
|
||||
<Height>{HEIGHT}</Height>
|
||||
<Rotation>0</Rotation>
|
||||
<StartOffset>0</StartOffset>
|
||||
<IsRelative>1</IsRelative>
|
||||
<Axis Name="X">
|
||||
<Offset>127</Offset>
|
||||
<Frequency>1</Frequency>
|
||||
<Phase>0</Phase>
|
||||
</Axis>
|
||||
<Axis Name="Y">
|
||||
<Offset>127</Offset>
|
||||
<Frequency>1</Frequency>
|
||||
<Phase>0</Phase>
|
||||
</Axis>
|
||||
</Function>
|
||||
"""
|
||||
|
||||
|
||||
def main() -> None:
|
||||
xml = SHOW.read_text()
|
||||
if 'Name="Movers ballyhoo"' in xml:
|
||||
raise SystemExit(f"{SHOW.relative_to(ROOT)} already has the movers ballyhoo")
|
||||
engine, console = xml.split("<VirtualConsole>")
|
||||
fid = max(int(i) for i in re.findall(r'<Function ID="(\d+)" Type', engine)) + 1
|
||||
wid = max(int(i) for i in re.findall(r' ID="(\d+)"', console) if int(i) != NO_FUNCTION) + 1
|
||||
|
||||
xml = xml.replace(" </Engine>", efx(fid) + " </Engine>", 1)
|
||||
# Beside Wander, on the pad after it.
|
||||
wander = re.search(r' <Button Caption="Wander" ID="\d+" Icon="">\n.*? </Button>\n', xml, re.S).group(0)
|
||||
xml = xml.replace(wander, wander + button(wid, "Ballyhoo", 190, 100, 90, fid, note(46)), 1)
|
||||
SHOW.write_text(xml)
|
||||
print(f"Added the movers ballyhoo to {SHOW.relative_to(ROOT)} (function {fid}, widget {wid})")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -1077,6 +1077,56 @@
|
||||
<Phase>0</Phase>
|
||||
</Axis>
|
||||
</Function>
|
||||
<Function ID="70" Type="EFX" Name="Movers ballyhoo">
|
||||
<Fixture>
|
||||
<ID>17</ID>
|
||||
<Head>0</Head>
|
||||
<Mode>0</Mode>
|
||||
<Direction>Forward</Direction>
|
||||
<StartOffset>0</StartOffset>
|
||||
</Fixture>
|
||||
<Fixture>
|
||||
<ID>8</ID>
|
||||
<Head>0</Head>
|
||||
<Mode>0</Mode>
|
||||
<Direction>Forward</Direction>
|
||||
<StartOffset>0</StartOffset>
|
||||
</Fixture>
|
||||
<Fixture>
|
||||
<ID>9</ID>
|
||||
<Head>0</Head>
|
||||
<Mode>0</Mode>
|
||||
<Direction>Forward</Direction>
|
||||
<StartOffset>0</StartOffset>
|
||||
</Fixture>
|
||||
<Fixture>
|
||||
<ID>18</ID>
|
||||
<Head>0</Head>
|
||||
<Mode>0</Mode>
|
||||
<Direction>Forward</Direction>
|
||||
<StartOffset>0</StartOffset>
|
||||
</Fixture>
|
||||
<PropagationMode>Parallel</PropagationMode>
|
||||
<Speed FadeIn="500" FadeOut="0" Duration="3000"/>
|
||||
<Direction>Forward</Direction>
|
||||
<RunOrder>Loop</RunOrder>
|
||||
<Algorithm>Eight</Algorithm>
|
||||
<Width>40</Width>
|
||||
<Height>24</Height>
|
||||
<Rotation>0</Rotation>
|
||||
<StartOffset>0</StartOffset>
|
||||
<IsRelative>1</IsRelative>
|
||||
<Axis Name="X">
|
||||
<Offset>127</Offset>
|
||||
<Frequency>1</Frequency>
|
||||
<Phase>0</Phase>
|
||||
</Axis>
|
||||
<Axis Name="Y">
|
||||
<Offset>127</Offset>
|
||||
<Frequency>1</Frequency>
|
||||
<Phase>0</Phase>
|
||||
</Axis>
|
||||
</Function>
|
||||
</Engine>
|
||||
<VirtualConsole>
|
||||
<Frame Caption="">
|
||||
@@ -2661,6 +2711,20 @@
|
||||
<Intensity Adjust="False">100</Intensity>
|
||||
<Input Universe="1" Channel="37085"/>
|
||||
</Button>
|
||||
<Button Caption="Ballyhoo" ID="114" Icon="">
|
||||
<WindowState Visible="True" X="190" Y="100" Width="90" Height="90"/>
|
||||
<Appearance>
|
||||
<FrameStyle>None</FrameStyle>
|
||||
<ForegroundColor>Default</ForegroundColor>
|
||||
<BackgroundColor>Default</BackgroundColor>
|
||||
<BackgroundImage>None</BackgroundImage>
|
||||
<Font>Default</Font>
|
||||
</Appearance>
|
||||
<Function ID="70"/>
|
||||
<Action>Toggle</Action>
|
||||
<Intensity Adjust="False">100</Intensity>
|
||||
<Input Universe="1" Channel="37086"/>
|
||||
</Button>
|
||||
<Slider Caption="Peak" ID="91" WidgetStyle="Slider" InvertedAppearance="false">
|
||||
<WindowState Visible="True" X="380" Y="10" Width="52" Height="360"/>
|
||||
<Appearance>
|
||||
|
||||
+12
-3
@@ -193,9 +193,9 @@ class PlayLayerTest(unittest.TestCase):
|
||||
layer.handle(PAUSE_DOWN)
|
||||
self.assertEqual(layer.handle([0x99, 45, 100]), [[0x99, 93, 100]])
|
||||
layer.handle([0x89, 45, 0])
|
||||
self.assertEqual((layer.wander, layer.settle), (True, False))
|
||||
self.assertEqual((layer.moving, layer.settle), ({93}, False))
|
||||
layer.handle([0x99, 45, 100])
|
||||
self.assertEqual((layer.wander, layer.settle), (False, True))
|
||||
self.assertEqual((layer.moving, layer.settle), (set(), True))
|
||||
self.assertEqual(layer.nudge(), [[0xB0, 38, 39], [0xB0, 39, 1]])
|
||||
self.assertEqual(layer.positions(), [[0xB0, 38, 40], [0xB0, 39, 0]])
|
||||
|
||||
@@ -203,7 +203,16 @@ class PlayLayerTest(unittest.TestCase):
|
||||
layer = PlayLayer()
|
||||
layer.handle([0x99, 45, 100])
|
||||
layer.handle([0x99, 45, 100])
|
||||
self.assertEqual((layer.wander, layer.settle), (False, False))
|
||||
self.assertEqual((layer.moving, layer.settle), (set(), False))
|
||||
|
||||
def test_ballyhoo_off_settles_while_wander_runs_on(self):
|
||||
layer = PlayLayer()
|
||||
layer.handle(PAUSE_DOWN)
|
||||
layer.handle([0x99, 45, 100])
|
||||
self.assertEqual(layer.handle([0x99, 46, 100]), [[0x99, 94, 100]])
|
||||
self.assertEqual((layer.moving, layer.settle), ({93, 94}, False))
|
||||
layer.handle([0x99, 46, 100])
|
||||
self.assertEqual((layer.moving, layer.settle), ({93}, True))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in new issue
Block a user