Run the movers' Wander and Ballyhoo one at a time.
Their two buttons go into a Movement solo frame where they sit, so starting one stops the other (scripts/shows/mover_movement_solo.py). The pad controller follows: it tracks the one that is on, and settles the knobs only when that one goes off. Swapping needs no settle, as the new EFX writes over the old one's offset. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
09aab70bd6
commit
80df550916
4 files changed
+120
-42
No files matched your search
+12
-8
@@ -38,10 +38,12 @@ reopen() presses them again when QLC+ loads the show.
|
|||||||
|
|
||||||
The movers' Wander and Ballyhoo pads (notes 96 and 97, pads 13 and 14 on the
|
The movers' Wander and Ballyhoo pads (notes 96 and 97, pads 13 and 14 on the
|
||||||
movers layer) each toggle a relative EFX around the Pan and Tilt knobs (9 and 10,
|
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,
|
CC 38 and 39). They share a solo frame in QLC+, so starting one stops the other.
|
||||||
until those sliders change, so when either goes off, settle asks for the two
|
QLC+ 4.12 leaves an EFX's last offset on the movers when it stops, until those
|
||||||
knobs one step off and then back (nudge() and positions()). moving holds the
|
sliders change, so when the one that is on goes off, settle asks for the two
|
||||||
notes whose EFX is on, from the presses: a guess like pump.
|
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: a guess like pump.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
@@ -76,7 +78,7 @@ class PlayLayer:
|
|||||||
self.knobs = {cc: 127 for cc in (PEAK_CC, *SIDE_CCS)}
|
self.knobs = {cc: 127 for cc in (PEAK_CC, *SIDE_CCS)}
|
||||||
# Pan and Tilt as last sent; QLC+ starts them at 0.
|
# Pan and Tilt as last sent; QLC+ starts them at 0.
|
||||||
self.position = {cc: 0 for cc in POSITION_CCS}
|
self.position = {cc: 0 for cc in POSITION_CCS}
|
||||||
self.moving: set[int] = set()
|
self.moving: int | None = None
|
||||||
self.settle = False # a relative EFX just went off: the caller sends nudge(), then positions()
|
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
|
# set -> (channel, note sent) of the colour that is on
|
||||||
self.colours: dict[int, tuple[int, int] | None] = {1: None, 2: None}
|
self.colours: dict[int, tuple[int, int] | None] = {1: None, 2: None}
|
||||||
@@ -131,9 +133,11 @@ class PlayLayer:
|
|||||||
self.threshold = not self.threshold
|
self.threshold = not self.threshold
|
||||||
extra = [*extra, [0xB0, SUBMASTER_CC, 0 if self.threshold else 127]]
|
extra = [*extra, [0xB0, SUBMASTER_CC, 0 if self.threshold else 127]]
|
||||||
elif note in RELATIVE_NOTES and is_on:
|
elif note in RELATIVE_NOTES and is_on:
|
||||||
if note in self.moving:
|
if note == self.moving:
|
||||||
|
self.moving = None
|
||||||
self.settle = True
|
self.settle = True
|
||||||
self.moving ^= {note}
|
else:
|
||||||
|
self.moving = note
|
||||||
if is_on and FIRST_NOTE <= out <= LAST_NOTE + SHIFT:
|
if is_on and FIRST_NOTE <= out <= LAST_NOTE + SHIFT:
|
||||||
colour_set = 1 if out <= LAST_NOTE else 2
|
colour_set = 1 if out <= LAST_NOTE else 2
|
||||||
pressed = (channel, out)
|
pressed = (channel, out)
|
||||||
@@ -155,7 +159,7 @@ class PlayLayer:
|
|||||||
"""
|
"""
|
||||||
self.pump = False
|
self.pump = False
|
||||||
self.threshold = False
|
self.threshold = False
|
||||||
self.moving.clear()
|
self.moving = None
|
||||||
out = []
|
out = []
|
||||||
for colour in self.colours.values():
|
for colour in self.colours.values():
|
||||||
if colour is not None:
|
if colour is not None:
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Make Wander and Ballyhoo one at a time in shows/test.qxw.
|
||||||
|
|
||||||
|
Their two buttons go into a solo frame, Movement, where they already sit on the
|
||||||
|
top row of the movers pads, so starting one stops the other, as the colour sets
|
||||||
|
do. padcontroller/layer.py follows the same rule.
|
||||||
|
|
||||||
|
python3 scripts/shows/mover_movement_solo.py
|
||||||
|
|
||||||
|
Run it once on a show with Wander and Ballyhoo on the top row; it stops if the
|
||||||
|
solo 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, appearance
|
||||||
|
|
||||||
|
SHOW = ROOT / "shows" / "test.qxw"
|
||||||
|
|
||||||
|
BUTTONS = ("Wander", "Ballyhoo")
|
||||||
|
SIZE = 90
|
||||||
|
|
||||||
|
|
||||||
|
def main() -> None:
|
||||||
|
xml = SHOW.read_text()
|
||||||
|
if 'Caption="Movement"' in xml:
|
||||||
|
raise SystemExit(f"{SHOW.relative_to(ROOT)} already has the Movement solo frame")
|
||||||
|
wid = max(int(i) for i in re.findall(r' ID="(\d+)"', xml.split("<VirtualConsole>")[1])
|
||||||
|
if int(i) != NO_FUNCTION) + 1
|
||||||
|
|
||||||
|
found = [re.search(rf' <Button Caption="{caption}" ID="\d+" Icon="">\n.*? </Button>\n', xml, re.S).group(0)
|
||||||
|
for caption in BUTTONS]
|
||||||
|
body = ""
|
||||||
|
for i, button in enumerate(found):
|
||||||
|
xml = xml.replace(button, "", 1)
|
||||||
|
# Inside the frame each sits at its place in the row, one level deeper.
|
||||||
|
moved = re.sub(r'X="\d+" Y="\d+"', f'X="{SIZE * i}" Y="0"', button, count=1)
|
||||||
|
body += "".join(" " + line if line else line for line in moved.splitlines(keepends=True))
|
||||||
|
|
||||||
|
frame = (f' <SoloFrame Caption="Movement" ID="{wid}">\n'
|
||||||
|
+ appearance(" ")
|
||||||
|
+ f' <WindowState Visible="True" X="10" Y="10" Width="{SIZE * len(BUTTONS)}" Height="{SIZE}"/>\n'
|
||||||
|
' <AllowChildren>True</AllowChildren>\n <AllowResize>True</AllowResize>\n'
|
||||||
|
' <ShowHeader>False</ShowHeader>\n <ShowEnableButton>False</ShowEnableButton>\n'
|
||||||
|
' <Mixing>False</Mixing>\n <Collapsed>False</Collapsed>\n <Disabled>False</Disabled>\n'
|
||||||
|
+ body + ' </SoloFrame>\n')
|
||||||
|
|
||||||
|
strobe = re.search(r' <Button Caption="Strobe" ID="89" Icon="">\n', xml).group(0)
|
||||||
|
xml = xml.replace(strobe, frame + strobe, 1)
|
||||||
|
SHOW.write_text(xml)
|
||||||
|
print(f"Put Wander and Ballyhoo in the Movement solo frame in {SHOW.relative_to(ROOT)} (widget {wid})")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
+45
-28
@@ -2470,6 +2470,51 @@
|
|||||||
<ShowEnableButton>False</ShowEnableButton>
|
<ShowEnableButton>False</ShowEnableButton>
|
||||||
<Collapsed>False</Collapsed>
|
<Collapsed>False</Collapsed>
|
||||||
<Disabled>False</Disabled>
|
<Disabled>False</Disabled>
|
||||||
|
<SoloFrame Caption="Movement" ID="116">
|
||||||
|
<Appearance>
|
||||||
|
<FrameStyle>None</FrameStyle>
|
||||||
|
<ForegroundColor>Default</ForegroundColor>
|
||||||
|
<BackgroundColor>Default</BackgroundColor>
|
||||||
|
<BackgroundImage>None</BackgroundImage>
|
||||||
|
<Font>Default</Font>
|
||||||
|
</Appearance>
|
||||||
|
<WindowState Visible="True" X="10" Y="10" Width="180" Height="90"/>
|
||||||
|
<AllowChildren>True</AllowChildren>
|
||||||
|
<AllowResize>True</AllowResize>
|
||||||
|
<ShowHeader>False</ShowHeader>
|
||||||
|
<ShowEnableButton>False</ShowEnableButton>
|
||||||
|
<Mixing>False</Mixing>
|
||||||
|
<Collapsed>False</Collapsed>
|
||||||
|
<Disabled>False</Disabled>
|
||||||
|
<Button Caption="Wander" ID="112" Icon="">
|
||||||
|
<WindowState Visible="True" X="0" Y="0" Width="90" Height="90"/>
|
||||||
|
<Appearance>
|
||||||
|
<FrameStyle>None</FrameStyle>
|
||||||
|
<ForegroundColor>Default</ForegroundColor>
|
||||||
|
<BackgroundColor>Default</BackgroundColor>
|
||||||
|
<BackgroundImage>None</BackgroundImage>
|
||||||
|
<Font>Default</Font>
|
||||||
|
</Appearance>
|
||||||
|
<Function ID="69"/>
|
||||||
|
<Action>Toggle</Action>
|
||||||
|
<Intensity Adjust="False">100</Intensity>
|
||||||
|
<Input Universe="1" Channel="37088"/>
|
||||||
|
</Button>
|
||||||
|
<Button Caption="Ballyhoo" ID="114" Icon="">
|
||||||
|
<WindowState Visible="True" X="90" Y="0" 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="37089"/>
|
||||||
|
</Button>
|
||||||
|
</SoloFrame>
|
||||||
<Button Caption="Strobe" ID="89" Icon="">
|
<Button Caption="Strobe" ID="89" Icon="">
|
||||||
<WindowState Visible="True" X="10" Y="100" Width="90" Height="90"/>
|
<WindowState Visible="True" X="10" Y="100" Width="90" Height="90"/>
|
||||||
<Appearance>
|
<Appearance>
|
||||||
@@ -2484,34 +2529,6 @@
|
|||||||
<Intensity Adjust="False">100</Intensity>
|
<Intensity Adjust="False">100</Intensity>
|
||||||
<Input Universe="1" Channel="37084"/>
|
<Input Universe="1" Channel="37084"/>
|
||||||
</Button>
|
</Button>
|
||||||
<Button Caption="Wander" ID="112" Icon="">
|
|
||||||
<WindowState Visible="True" X="10" Y="10" Width="90" Height="90"/>
|
|
||||||
<Appearance>
|
|
||||||
<FrameStyle>None</FrameStyle>
|
|
||||||
<ForegroundColor>Default</ForegroundColor>
|
|
||||||
<BackgroundColor>Default</BackgroundColor>
|
|
||||||
<BackgroundImage>None</BackgroundImage>
|
|
||||||
<Font>Default</Font>
|
|
||||||
</Appearance>
|
|
||||||
<Function ID="69"/>
|
|
||||||
<Action>Toggle</Action>
|
|
||||||
<Intensity Adjust="False">100</Intensity>
|
|
||||||
<Input Universe="1" Channel="37088"/>
|
|
||||||
</Button>
|
|
||||||
<Button Caption="Ballyhoo" ID="114" Icon="">
|
|
||||||
<WindowState Visible="True" X="100" Y="10" 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="37089"/>
|
|
||||||
</Button>
|
|
||||||
<Slider Caption="Peak" ID="91" WidgetStyle="Slider" InvertedAppearance="false">
|
<Slider Caption="Peak" ID="91" WidgetStyle="Slider" InvertedAppearance="false">
|
||||||
<WindowState Visible="True" X="380" Y="10" Width="52" Height="360"/>
|
<WindowState Visible="True" X="380" Y="10" Width="52" Height="360"/>
|
||||||
<Appearance>
|
<Appearance>
|
||||||
|
|||||||
@@ -193,9 +193,9 @@ class PlayLayerTest(unittest.TestCase):
|
|||||||
layer.handle(PAUSE_DOWN)
|
layer.handle(PAUSE_DOWN)
|
||||||
self.assertEqual(layer.handle([0x99, 48, 100]), [[0x99, 96, 100]])
|
self.assertEqual(layer.handle([0x99, 48, 100]), [[0x99, 96, 100]])
|
||||||
layer.handle([0x89, 48, 0])
|
layer.handle([0x89, 48, 0])
|
||||||
self.assertEqual((layer.moving, layer.settle), ({96}, False))
|
self.assertEqual((layer.moving, layer.settle), (96, False))
|
||||||
layer.handle([0x99, 48, 100])
|
layer.handle([0x99, 48, 100])
|
||||||
self.assertEqual((layer.moving, layer.settle), (set(), True))
|
self.assertEqual((layer.moving, layer.settle), (None, True))
|
||||||
self.assertEqual(layer.nudge(), [[0xB0, 38, 39], [0xB0, 39, 1]])
|
self.assertEqual(layer.nudge(), [[0xB0, 38, 39], [0xB0, 39, 1]])
|
||||||
self.assertEqual(layer.positions(), [[0xB0, 38, 40], [0xB0, 39, 0]])
|
self.assertEqual(layer.positions(), [[0xB0, 38, 40], [0xB0, 39, 0]])
|
||||||
|
|
||||||
@@ -203,16 +203,16 @@ class PlayLayerTest(unittest.TestCase):
|
|||||||
layer = PlayLayer()
|
layer = PlayLayer()
|
||||||
layer.handle([0x99, 48, 100])
|
layer.handle([0x99, 48, 100])
|
||||||
layer.handle([0x99, 48, 100])
|
layer.handle([0x99, 48, 100])
|
||||||
self.assertEqual((layer.moving, layer.settle), (set(), False))
|
self.assertEqual((layer.moving, layer.settle), (None, False))
|
||||||
|
|
||||||
def test_ballyhoo_off_settles_while_wander_runs_on(self):
|
def test_ballyhoo_takes_over_from_wander_without_a_settle(self):
|
||||||
layer = PlayLayer()
|
layer = PlayLayer()
|
||||||
layer.handle(PAUSE_DOWN)
|
layer.handle(PAUSE_DOWN)
|
||||||
layer.handle([0x99, 48, 100])
|
layer.handle([0x99, 48, 100])
|
||||||
self.assertEqual(layer.handle([0x99, 49, 100]), [[0x99, 97, 100]])
|
self.assertEqual(layer.handle([0x99, 49, 100]), [[0x99, 97, 100]])
|
||||||
self.assertEqual((layer.moving, layer.settle), ({96, 97}, False))
|
self.assertEqual((layer.moving, layer.settle), (97, False))
|
||||||
layer.handle([0x99, 49, 100])
|
layer.handle([0x99, 49, 100])
|
||||||
self.assertEqual((layer.moving, layer.settle), ({96}, True))
|
self.assertEqual((layer.moving, layer.settle), (None, True))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in new issue
Block a user