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:
1 parent
31ccbab340
commit
467b480c76
2 files changed
+26
-19
No files matched your search
+20
-13
@@ -8,8 +8,9 @@ from padcontroller.layer import PlayLayer # noqa: E402
|
||||
|
||||
PLAY_DOWN = [0xB0, 27, 127]
|
||||
PLAY_UP = [0xB0, 27, 0]
|
||||
PAUSE_DOWN = [0xB0, 28, 127]
|
||||
PAUSE_UP = [0xB0, 28, 0]
|
||||
# The pad latches Pause: one message a press, 127 and 0 on alternate presses.
|
||||
PAUSE_ON = [0xB0, 28, 127]
|
||||
PAUSE_OFF = [0xB0, 28, 0]
|
||||
|
||||
|
||||
class PlayLayerTest(unittest.TestCase):
|
||||
@@ -84,18 +85,16 @@ class PlayLayerTest(unittest.TestCase):
|
||||
|
||||
def test_pause_toggles_bank_1_to_the_movers(self):
|
||||
layer = PlayLayer()
|
||||
self.assertEqual(layer.handle(PAUSE_DOWN), [])
|
||||
self.assertEqual(layer.handle(PAUSE_UP), [])
|
||||
self.assertEqual(layer.handle(PAUSE_ON), [])
|
||||
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, 52, 100]), [[0x99, 52, 100]])
|
||||
layer.handle(PAUSE_DOWN)
|
||||
layer.handle(PAUSE_UP)
|
||||
self.assertEqual(layer.handle(PAUSE_OFF), [])
|
||||
self.assertEqual(layer.handle([0x99, 44, 100]), [[0x99, 44, 100]])
|
||||
|
||||
def test_pads_1_and_2_move_up_on_the_movers_layer(self):
|
||||
layer = PlayLayer()
|
||||
layer.handle(PAUSE_DOWN)
|
||||
layer.handle(PAUSE_ON)
|
||||
self.assertEqual(layer.handle([0x99, 36, 100]), [[0x99, 84, 100]])
|
||||
self.assertEqual(layer.handle([0x89, 36, 0]), [[0x89, 84, 0]])
|
||||
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):
|
||||
layer = PlayLayer()
|
||||
layer.handle(PAUSE_DOWN)
|
||||
layer.handle(PAUSE_ON)
|
||||
layer.handle([0x99, 48, 100])
|
||||
layer.handle(PAUSE_DOWN)
|
||||
layer.handle(PAUSE_OFF)
|
||||
self.assertEqual(layer.handle([0x89, 48, 0]), [[0x89, 96, 0]])
|
||||
|
||||
def test_reopen_with_no_colours_sends_nothing(self):
|
||||
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):
|
||||
layer = PlayLayer()
|
||||
self.assertEqual(layer.handle([0xB0, 38, 40]), [[0xB0, 38, 40]])
|
||||
layer.handle([0xB0, 39, 0])
|
||||
layer.handle(PAUSE_DOWN)
|
||||
layer.handle(PAUSE_ON)
|
||||
self.assertEqual(layer.handle([0x99, 48, 100]), [[0x99, 96, 100]])
|
||||
layer.handle([0x89, 48, 0])
|
||||
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):
|
||||
layer = PlayLayer()
|
||||
layer.handle(PAUSE_DOWN)
|
||||
layer.handle(PAUSE_ON)
|
||||
layer.handle([0x99, 48, 100])
|
||||
self.assertEqual(layer.handle([0x99, 49, 100]), [[0x99, 97, 100]])
|
||||
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):
|
||||
layer = PlayLayer()
|
||||
layer.handle(PAUSE_DOWN)
|
||||
layer.handle(PAUSE_ON)
|
||||
layer.handle([0x99, 42, 127])
|
||||
self.assertIsNone(layer.pattern)
|
||||
|
||||
def test_every_movement_pad_settles_when_it_goes_off(self):
|
||||
for pad_note, sent in ((51, 99), (44, 92), (47, 95), (40, 88)):
|
||||
layer = PlayLayer()
|
||||
layer.handle(PAUSE_DOWN)
|
||||
layer.handle(PAUSE_ON)
|
||||
self.assertEqual(layer.handle([0x99, pad_note, 100]), [[0x99, sent, 100]])
|
||||
self.assertEqual((layer.moving, layer.settle), (sent, False))
|
||||
layer.handle([0x99, pad_note, 100])
|
||||
|
||||
Reference in new issue
Block a user