Toggle the pad's bank 1 to the movers with Pause, and add a Threshold sound mode.
Pause flips bank 1 between the cans (36-51) and the movers (84-99). Threshold flashes the cans on bass hits and is exclusive with Sound, and knob 6 is the sides' peak. The Sound and Threshold pads light while on, and the colour pads that were on are pressed again when QLC+ reloads the show. --lock-knobs is gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
72c227b153
commit
11da656ee6
6 files changed
+378
-81
No files matched your search
+138
-36
@@ -8,6 +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]
|
||||
SIDES_FULL = [[0xB0, 34, 127], [0xB0, 37, 127]]
|
||||
|
||||
|
||||
class PlayLayerTest(unittest.TestCase):
|
||||
@@ -46,44 +49,143 @@ class PlayLayerTest(unittest.TestCase):
|
||||
|
||||
def test_sound_pad_puts_the_submaster_back_to_full(self):
|
||||
layer = PlayLayer()
|
||||
self.assertEqual(layer.handle([0x99, 36, 100]), [[0x99, 36, 100], [0xB0, 100, 127]])
|
||||
self.assertEqual(layer.handle([0x99, 36, 100]), [[0x99, 36, 100], *SIDES_FULL, [0xB0, 100, 127]])
|
||||
self.assertEqual(layer.handle([0x89, 36, 0]), [[0x89, 36, 0], [0xB0, 100, 127]])
|
||||
self.assertEqual(layer.handle([0x99, 37, 100]), [[0x99, 37, 100]])
|
||||
|
||||
def test_threshold_pad_holds_the_submaster_at_zero_while_on(self):
|
||||
layer = PlayLayer()
|
||||
self.assertEqual(layer.handle([0x99, 37, 100]), [[0x99, 37, 100], [0xB0, 100, 0]])
|
||||
self.assertEqual(layer.handle([0x89, 37, 0]), [[0x89, 37, 0], [0xB0, 100, 0]])
|
||||
self.assertEqual(layer.handle([0x99, 37, 100]), [[0x99, 37, 100], [0xB0, 100, 127]])
|
||||
self.assertEqual(layer.handle([0x89, 37, 0]), [[0x89, 37, 0], [0xB0, 100, 127]])
|
||||
|
||||
def test_sound_pads_track_which_mode_is_on(self):
|
||||
layer = PlayLayer()
|
||||
layer.handle([0x99, 36, 100])
|
||||
layer.handle([0x89, 36, 0])
|
||||
self.assertEqual((layer.pump, layer.threshold), (True, False))
|
||||
layer.handle([0x99, 36, 100])
|
||||
layer.handle([0x99, 36, 0]) # note on at velocity 0 is a release
|
||||
self.assertEqual((layer.pump, layer.threshold), (False, False))
|
||||
|
||||
def test_turning_threshold_on_switches_pump_off_first(self):
|
||||
layer = PlayLayer()
|
||||
layer.handle([0x99, 36, 100])
|
||||
self.assertEqual(
|
||||
layer.handle([0x99, 37, 100]),
|
||||
[[0x99, 36, 127], [0x89, 36, 0], [0x99, 37, 100], *SIDES_FULL, [0xB0, 100, 0]],
|
||||
)
|
||||
self.assertEqual((layer.pump, layer.threshold), (False, True))
|
||||
|
||||
def test_turning_pump_on_switches_threshold_off_first(self):
|
||||
layer = PlayLayer()
|
||||
layer.handle([0x99, 37, 100])
|
||||
self.assertEqual(
|
||||
layer.handle([0x99, 36, 100]),
|
||||
[[0x99, 37, 127], [0x89, 37, 0], [0x99, 36, 100], *SIDES_FULL, [0xB0, 100, 127]],
|
||||
)
|
||||
self.assertEqual((layer.pump, layer.threshold), (True, False))
|
||||
|
||||
def test_turning_a_mode_off_leaves_the_other_alone(self):
|
||||
layer = PlayLayer()
|
||||
layer.handle([0x99, 37, 100])
|
||||
self.assertEqual(layer.handle([0x99, 37, 100]), [[0x99, 37, 100], [0xB0, 100, 127]])
|
||||
self.assertEqual((layer.pump, layer.threshold), (False, False))
|
||||
|
||||
def test_peak_knob_goes_on_to_the_hits_submaster(self):
|
||||
layer = PlayLayer()
|
||||
self.assertEqual(layer.handle([0xB0, 35, 60]), [[0xB0, 35, 60]])
|
||||
|
||||
def test_side_knobs_pass_through_while_sound_is_off(self):
|
||||
layer = PlayLayer()
|
||||
self.assertEqual(layer.handle([0xB0, 34, 90]), [[0xB0, 34, 90]])
|
||||
layer.handle([0x99, 37, 100]) # Threshold keeps them: the submaster holds the sides dark
|
||||
self.assertEqual(layer.handle([0xB0, 37, 80]), [[0xB0, 37, 80]])
|
||||
|
||||
def test_pump_holds_the_sides_at_the_peak(self):
|
||||
layer = PlayLayer()
|
||||
layer.handle([0xB0, 34, 90])
|
||||
layer.handle([0xB0, 35, 60])
|
||||
self.assertEqual(layer.handle([0x99, 36, 100]),
|
||||
[[0x99, 36, 100], [0xB0, 34, 60], [0xB0, 37, 60], [0xB0, 100, 127]])
|
||||
self.assertEqual(layer.handle([0xB0, 35, 40]), [[0xB0, 35, 40], [0xB0, 34, 40], [0xB0, 37, 40]])
|
||||
self.assertEqual(layer.handle([0xB0, 37, 100]), []) # kept for later
|
||||
|
||||
def test_pump_off_puts_the_side_knobs_back(self):
|
||||
layer = PlayLayer()
|
||||
layer.handle([0xB0, 34, 90])
|
||||
layer.handle([0xB0, 35, 60])
|
||||
layer.handle([0x99, 36, 100])
|
||||
layer.handle([0xB0, 37, 100])
|
||||
self.assertEqual(layer.handle([0x99, 36, 100]),
|
||||
[[0x99, 36, 100], [0xB0, 34, 90], [0xB0, 37, 100], [0xB0, 100, 127]])
|
||||
|
||||
def test_threshold_taking_over_from_pump_puts_the_side_knobs_back(self):
|
||||
layer = PlayLayer()
|
||||
layer.handle([0xB0, 34, 90])
|
||||
layer.handle([0xB0, 35, 60])
|
||||
layer.handle([0x99, 36, 100])
|
||||
self.assertEqual(layer.handle([0x99, 37, 100]),
|
||||
[[0x99, 36, 127], [0x89, 36, 0], [0x99, 37, 100],
|
||||
[0xB0, 34, 90], [0xB0, 37, 127], [0xB0, 100, 0]])
|
||||
|
||||
def test_colours_remember_the_last_pad_in_each_set(self):
|
||||
layer = PlayLayer()
|
||||
layer.handle([0x99, 52, 100])
|
||||
layer.handle([0x99, 55, 100])
|
||||
layer.handle(PLAY_DOWN)
|
||||
layer.handle([0x99, 61, 100]) # Colour 2 Blue, sent as 77
|
||||
self.assertEqual(layer.colours, {1: (9, 55), 2: (9, 77)})
|
||||
|
||||
def test_pressing_the_lit_colour_again_turns_it_off(self):
|
||||
layer = PlayLayer()
|
||||
layer.handle([0x99, 52, 100])
|
||||
layer.handle([0x89, 52, 0])
|
||||
layer.handle([0x99, 52, 100])
|
||||
self.assertEqual(layer.colours[1], None)
|
||||
|
||||
def test_reopen_presses_the_colours_again_and_clears_sound(self):
|
||||
layer = PlayLayer()
|
||||
layer.handle([0x99, 54, 100])
|
||||
layer.handle(PLAY_DOWN)
|
||||
layer.handle([0x99, 66, 100])
|
||||
layer.handle(PLAY_UP)
|
||||
layer.handle([0x99, 36, 100])
|
||||
self.assertEqual(layer.reopen(), [[0x99, 54, 127], [0x89, 54, 0], [0x99, 82, 127], [0x89, 82, 0],
|
||||
[0xB0, 100, 127]])
|
||||
self.assertEqual((layer.pump, layer.threshold), (False, False))
|
||||
self.assertEqual(layer.colours, {1: (9, 54), 2: (9, 82)}) # still on, for the next reopen
|
||||
|
||||
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([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([0x99, 44, 100]), [[0x99, 44, 100]])
|
||||
|
||||
def test_sound_pads_do_nothing_on_the_movers_layer(self):
|
||||
layer = PlayLayer()
|
||||
layer.handle(PAUSE_DOWN)
|
||||
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]])
|
||||
self.assertEqual(layer.handle([0x89, 37, 0]), [[0x89, 85, 0]])
|
||||
self.assertEqual((layer.pump, layer.threshold), (False, False))
|
||||
|
||||
def test_bank_1_release_matches_its_press_across_pause(self):
|
||||
layer = PlayLayer()
|
||||
layer.handle(PAUSE_DOWN)
|
||||
layer.handle([0x99, 48, 100])
|
||||
layer.handle(PAUSE_DOWN)
|
||||
self.assertEqual(layer.handle([0x89, 48, 0]), [[0x89, 96, 0]])
|
||||
|
||||
def test_reopen_with_no_colours_only_resets_the_submaster(self):
|
||||
self.assertEqual(PlayLayer().reopen(), [[0xB0, 100, 127]])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
|
||||
class LockedKnobsTest(unittest.TestCase):
|
||||
def test_knobs_are_dropped_until_custom_is_pressed(self):
|
||||
layer = PlayLayer(lock_knobs=True)
|
||||
self.assertEqual(layer.handle([0xB0, 31, 64]), [])
|
||||
layer.handle([0x99, 67, 100])
|
||||
self.assertEqual(layer.handle([0xB0, 31, 64]), [[0xB0, 31, 64]])
|
||||
self.assertEqual(layer.handle([0xB0, 36, 64]), [])
|
||||
|
||||
def test_another_pad_locks_them_again(self):
|
||||
layer = PlayLayer(lock_knobs=True)
|
||||
layer.handle([0x99, 67, 100])
|
||||
layer.handle([0x99, 60, 100])
|
||||
self.assertEqual(layer.handle([0xB0, 31, 64]), [])
|
||||
|
||||
def test_locking_sends_the_sliders_back_to_zero(self):
|
||||
layer = PlayLayer(lock_knobs=True)
|
||||
layer.handle([0x99, 67, 100])
|
||||
sent = layer.handle([0x99, 60, 100])
|
||||
self.assertEqual(sent[0], [0x99, 60, 100])
|
||||
self.assertEqual(sent[1:], [[0xB0, 30 + n, 0] for n in range(5)])
|
||||
self.assertEqual(layer.handle([0x99, 61, 100]), [[0x99, 61, 100]])
|
||||
|
||||
def test_play_layer_unlocks_the_second_set(self):
|
||||
layer = PlayLayer(lock_knobs=True)
|
||||
layer.handle(PLAY_DOWN)
|
||||
layer.handle([0x99, 67, 100])
|
||||
self.assertEqual(layer.handle([0xB0, 36, 64]), [[0xB0, 36, 64]])
|
||||
self.assertEqual(layer.handle([0xB0, 31, 64]), [])
|
||||
|
||||
def test_other_knobs_and_unlocked_mode_are_untouched(self):
|
||||
self.assertEqual(PlayLayer(lock_knobs=True).handle([0xB0, 40, 64]), [[0xB0, 40, 64]])
|
||||
self.assertEqual(PlayLayer().handle([0xB0, 31, 64]), [[0xB0, 31, 64]])
|
||||
Reference in new issue
Block a user