Put the pads on the cans or movers layer from Pause's value.

The SMC-PAD latches Pause itself: one message a press, 127 and 0 on
alternate presses, nothing on release. The pad controller flipped the layer
only on 127, so every second press did nothing. Bank 1 now follows the
value: 0 is the cans, 127 the movers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jimmyandClaude Opus 5.5 committed 2026-10-23 15:09:47 +13:00
1 parent 31ccbab340
commit 467b480c76
2 files changed
+26 -19

No files matched your search

+6 -6
View File
@@ -4,9 +4,10 @@ The SMC-PAD sends CC 27 as 127 when Play goes down and 0 when it comes up.
While it is down, pad notes 52–67 go out as 68–83, so QLC+ can tell a While it is down, pad notes 52–67 go out as 68–83, so QLC+ can tell a
second set of buttons from the first. Play itself is not passed on. second set of buttons from the first. Play itself is not passed on.
Pause (CC 28) does the same for bank 1, but toggles: each press flips it. Pause (CC 28) does the same for bank 1, but latches: the SMC-PAD sends one
Off, bank 1 pads 36–51 go out as they are, for the cans. On, they go out as message a press, 127 and 0 on alternate presses and nothing on release, and
84–99, for the movers. Pause itself is not passed on. bank 1 follows it. At 0, bank 1 pads 36–51 go out as they are, for the cans.
At 127, they go out as 84–99, for the movers. Pause itself is not passed on.
colours holds the last colour pad pressed in each set, as sent (52–67 for the colours holds the last colour pad pressed in each set, as sent (52–67 for the
cans, 68–83 for the movers), or None once it is pressed again: the colour cans, 68–83 for the movers), or None once it is pressed again: the colour
@@ -52,7 +53,7 @@ PATTERN_NOTES = range(36, 44) # the can patterns: pads 1–8 on the cans layer
class PlayLayer: class PlayLayer:
def __init__(self) -> None: def __init__(self) -> None:
self.held = False self.held = False
self.movers = False # Pause toggles bank 1 between the cans and the movers self.movers = False # Pause latched on puts bank 1 on the movers
# (channel, note as pressed) -> note sent, so a release matches its press # (channel, note as pressed) -> note sent, so a release matches its press
self.sent: dict[tuple[int, int], int] = {} self.sent: dict[tuple[int, int], int] = {}
# Pan and Tilt as last sent; QLC+ starts them at 0. # Pan and Tilt as last sent; QLC+ starts them at 0.
@@ -74,8 +75,7 @@ class PlayLayer:
self.held = data[2] > 0 self.held = data[2] > 0
return [] return []
if kind == 0xB0 and len(data) >= 3 and data[1] == PAUSE_CC: if kind == 0xB0 and len(data) >= 3 and data[1] == PAUSE_CC:
if data[2] > 0: self.movers = data[2] > 0
self.movers = not self.movers
return [] return []
if kind == 0xB0 and len(data) >= 3 and channel == KNOB_CHANNEL and data[1] in self.position: if kind == 0xB0 and len(data) >= 3 and channel == KNOB_CHANNEL and data[1] in self.position:
self.position[data[1]] = data[2] self.position[data[1]] = data[2]
+20 -13
View File
@@ -8,8 +8,9 @@ from padcontroller.layer import PlayLayer # noqa: E402
PLAY_DOWN = [0xB0, 27, 127] PLAY_DOWN = [0xB0, 27, 127]
PLAY_UP = [0xB0, 27, 0] PLAY_UP = [0xB0, 27, 0]
PAUSE_DOWN = [0xB0, 28, 127] # The pad latches Pause: one message a press, 127 and 0 on alternate presses.
PAUSE_UP = [0xB0, 28, 0] PAUSE_ON = [0xB0, 28, 127]
PAUSE_OFF = [0xB0, 28, 0]
class PlayLayerTest(unittest.TestCase): class PlayLayerTest(unittest.TestCase):
@@ -84,18 +85,16 @@ class PlayLayerTest(unittest.TestCase):
def test_pause_toggles_bank_1_to_the_movers(self): def test_pause_toggles_bank_1_to_the_movers(self):
layer = PlayLayer() layer = PlayLayer()
self.assertEqual(layer.handle(PAUSE_DOWN), []) self.assertEqual(layer.handle(PAUSE_ON), [])
self.assertEqual(layer.handle(PAUSE_UP), [])
self.assertEqual(layer.handle([0x99, 40, 100]), [[0x99, 88, 100]]) self.assertEqual(layer.handle([0x99, 40, 100]), [[0x99, 88, 100]])
self.assertEqual(layer.handle([0x99, 51, 100]), [[0x99, 99, 100]]) self.assertEqual(layer.handle([0x99, 51, 100]), [[0x99, 99, 100]])
self.assertEqual(layer.handle([0x99, 52, 100]), [[0x99, 52, 100]]) self.assertEqual(layer.handle([0x99, 52, 100]), [[0x99, 52, 100]])
layer.handle(PAUSE_DOWN) self.assertEqual(layer.handle(PAUSE_OFF), [])
layer.handle(PAUSE_UP)
self.assertEqual(layer.handle([0x99, 44, 100]), [[0x99, 44, 100]]) self.assertEqual(layer.handle([0x99, 44, 100]), [[0x99, 44, 100]])
def test_pads_1_and_2_move_up_on_the_movers_layer(self): def test_pads_1_and_2_move_up_on_the_movers_layer(self):
layer = PlayLayer() layer = PlayLayer()
layer.handle(PAUSE_DOWN) layer.handle(PAUSE_ON)
self.assertEqual(layer.handle([0x99, 36, 100]), [[0x99, 84, 100]]) self.assertEqual(layer.handle([0x99, 36, 100]), [[0x99, 84, 100]])
self.assertEqual(layer.handle([0x89, 36, 0]), [[0x89, 84, 0]]) self.assertEqual(layer.handle([0x89, 36, 0]), [[0x89, 84, 0]])
self.assertEqual(layer.handle([0x99, 37, 100]), [[0x99, 85, 100]]) self.assertEqual(layer.handle([0x99, 37, 100]), [[0x99, 85, 100]])
@@ -103,19 +102,27 @@ class PlayLayerTest(unittest.TestCase):
def test_bank_1_release_matches_its_press_across_pause(self): def test_bank_1_release_matches_its_press_across_pause(self):
layer = PlayLayer() layer = PlayLayer()
layer.handle(PAUSE_DOWN) layer.handle(PAUSE_ON)
layer.handle([0x99, 48, 100]) layer.handle([0x99, 48, 100])
layer.handle(PAUSE_DOWN) layer.handle(PAUSE_OFF)
self.assertEqual(layer.handle([0x89, 48, 0]), [[0x89, 96, 0]]) self.assertEqual(layer.handle([0x89, 48, 0]), [[0x89, 96, 0]])
def test_reopen_with_no_colours_sends_nothing(self): def test_reopen_with_no_colours_sends_nothing(self):
self.assertEqual(PlayLayer().reopen(), []) self.assertEqual(PlayLayer().reopen(), [])
def test_pause_follows_the_pads_latch(self):
layer = PlayLayer()
layer.handle(PAUSE_OFF) # already on the cans: stays there
self.assertFalse(layer.movers)
layer.handle(PAUSE_ON)
layer.handle(PAUSE_ON) # a repeat changes nothing
self.assertTrue(layer.movers)
def test_wander_off_settles_pan_and_tilt(self): def test_wander_off_settles_pan_and_tilt(self):
layer = PlayLayer() layer = PlayLayer()
self.assertEqual(layer.handle([0xB0, 38, 40]), [[0xB0, 38, 40]]) self.assertEqual(layer.handle([0xB0, 38, 40]), [[0xB0, 38, 40]])
layer.handle([0xB0, 39, 0]) layer.handle([0xB0, 39, 0])
layer.handle(PAUSE_DOWN) layer.handle(PAUSE_ON)
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))
@@ -132,7 +139,7 @@ class PlayLayerTest(unittest.TestCase):
def test_ballyhoo_takes_over_from_wander_without_a_settle(self): def test_ballyhoo_takes_over_from_wander_without_a_settle(self):
layer = PlayLayer() layer = PlayLayer()
layer.handle(PAUSE_DOWN) layer.handle(PAUSE_ON)
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), (97, False)) self.assertEqual((layer.moving, layer.settle), (97, False))
@@ -170,14 +177,14 @@ class PlayLayerTest(unittest.TestCase):
def test_pattern_pads_on_the_movers_layer_are_not_can_patterns(self): def test_pattern_pads_on_the_movers_layer_are_not_can_patterns(self):
layer = PlayLayer() layer = PlayLayer()
layer.handle(PAUSE_DOWN) layer.handle(PAUSE_ON)
layer.handle([0x99, 42, 127]) layer.handle([0x99, 42, 127])
self.assertIsNone(layer.pattern) self.assertIsNone(layer.pattern)
def test_every_movement_pad_settles_when_it_goes_off(self): def test_every_movement_pad_settles_when_it_goes_off(self):
for pad_note, sent in ((51, 99), (44, 92), (47, 95), (40, 88)): for pad_note, sent in ((51, 99), (44, 92), (47, 95), (40, 88)):
layer = PlayLayer() layer = PlayLayer()
layer.handle(PAUSE_DOWN) layer.handle(PAUSE_ON)
self.assertEqual(layer.handle([0x99, pad_note, 100]), [[0x99, sent, 100]]) self.assertEqual(layer.handle([0x99, pad_note, 100]), [[0x99, sent, 100]])
self.assertEqual((layer.moving, layer.settle), (sent, False)) self.assertEqual((layer.moving, layer.settle), (sent, False))
layer.handle([0x99, pad_note, 100]) layer.handle([0x99, pad_note, 100])