Skip to content

Commit a0af416

Browse files
committed
launchpad compatibility test
1 parent d550d33 commit a0af416

File tree

3 files changed

+85
-57
lines changed

3 files changed

+85
-57
lines changed

src/core.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1706,7 +1706,10 @@ def __init__(self):
17061706
if "linnstrument" in name_lower:
17071707
print("Instrument (Out): " + name)
17081708
self.linn_out = rtmidi2.MidiOut()
1709-
self.linn_out.open_port(i)
1709+
try:
1710+
self.linn_out.open_port(i)
1711+
except:
1712+
print("Unable to open LinnStrument")
17101713
elif self.options.split_out and self.options.split_out in name_lower:
17111714
print("Split (Out): " + name)
17121715
self.split_out = rtmidi2.MidiOut()

src/launchpad.py

Lines changed: 80 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -12,63 +12,88 @@ def __init__(self, core, out, mode, index=0, octave_separation=0):
1212
# self.pos = glm.ivec2(0, 0)
1313

1414
def button(self, x, y):
15-
if self.mode == 'lpx':
16-
if y == -1:
17-
if x == 0:
18-
self.octave += 1
19-
self.core.clear_marks(use_lights=False)
20-
self.core.send_all_notes_off()
21-
elif x == 1:
22-
self.octave -= 1
23-
self.core.clear_marks(use_lights=False)
24-
self.core.send_all_notes_off()
25-
elif x == 2:
26-
self.core.move_board(-1)
27-
# self.pos.x -= 1
28-
elif x == 3:
29-
self.core.move_board(1)
30-
elif x == 4:
31-
self.core.set_tonic(self.core.tonic - 1)
32-
elif x == 5:
33-
self.core.set_tonic(self.core.tonic + 1)
34-
if x == 8:
35-
if y == 0:
36-
self.core.next_scale()
37-
elif y == 1:
38-
self.core.prev_scale()
39-
elif y == 2:
40-
self.core.next_mode()
41-
elif y == 3:
42-
self.core.prev_mode()
43-
elif y == 4:
44-
self.core.next_bank()
45-
elif y == 5:
46-
self.core.prev_bank()
47-
elif y == 6:
48-
self.core.next_program()
49-
elif y == 7:
50-
self.core.prev_program()
51-
15+
# if self.mode == 'lpx':
16+
if y == -1:
17+
if x == 0:
18+
if self.core.options.debug:
19+
print("OCT+")
20+
self.octave += 1
21+
self.core.clear_marks(use_lights=False)
22+
self.core.send_all_notes_off()
23+
elif x == 1:
24+
if self.core.options.debug:
25+
print("OCT-")
26+
self.octave -= 1
27+
self.core.clear_marks(use_lights=False)
28+
self.core.send_all_notes_off()
29+
elif x == 2:
30+
if self.core.options.debug:
31+
print("MOV-")
32+
self.core.move_board(-1)
33+
# self.pos.x -= 1
34+
elif x == 3:
35+
if self.core.options.debug:
36+
print("MOV+")
37+
self.core.move_board(1)
38+
elif x == 4:
39+
if self.core.options.debug:
40+
print("TRA-")
41+
self.core.set_tonic(self.core.tonic - 1)
42+
elif x == 5:
43+
if self.core.options.debug:
44+
print("TRA+")
45+
self.core.set_tonic(self.core.tonic + 1)
46+
if x == 8:
47+
if y == 0:
48+
if self.core.options.debug:
49+
print("SCL+")
50+
self.core.next_scale()
51+
elif y == 1:
52+
if self.core.options.debug:
53+
print("SCL-")
54+
self.core.prev_scale()
55+
elif y == 2:
56+
if self.core.options.debug:
57+
print("MOD+")
58+
self.core.next_mode()
59+
elif y == 3:
60+
if self.core.options.debug:
61+
print("MOD-")
62+
self.core.prev_mode()
63+
elif y == 4:
64+
if self.core.options.debug:
65+
print("BANK+")
66+
self.core.next_bank()
67+
elif y == 5:
68+
if self.core.options.debug:
69+
print("BANK-")
70+
self.core.prev_bank()
71+
elif y == 6:
72+
if self.core.options.debug:
73+
print("PROG+")
74+
self.core.next_program()
75+
elif y == 7:
76+
if self.core.options.debug:
77+
print("PROG-")
78+
self.core.prev_program()
5279

5380
def set_lights(self):
54-
if self.mode == "lpx":
55-
self.out.LedCtrlXY(0, 0, 0, 0, 63)
56-
self.out.LedCtrlXY(1, 0, 0, 0, 63)
57-
self.out.LedCtrlXY(2, 0, 63, 0, 63)
58-
self.out.LedCtrlXY(3, 0, 63, 0, 63)
59-
self.out.LedCtrlXY(4, 0, 63, 0, 0)
60-
self.out.LedCtrlXY(5, 0, 63, 0, 0)
61-
62-
self.out.LedCtrlXY(8, 1, 63, 63, 0)
63-
self.out.LedCtrlXY(8, 2, 63, 63, 0)
64-
self.out.LedCtrlXY(8, 3, 0, 63, 63)
65-
self.out.LedCtrlXY(8, 4, 0, 63, 63)
66-
self.out.LedCtrlXY(8, 5, 63, 24, 63)
67-
self.out.LedCtrlXY(8, 6, 63, 24, 63)
68-
self.out.LedCtrlXY(8, 7, 24, 63, 63)
69-
self.out.LedCtrlXY(8, 8, 24, 63, 63)
70-
71-
81+
# if self.mode == "lpx":
82+
self.out.LedCtrlXY(0, 0, 0, 0, 63)
83+
self.out.LedCtrlXY(1, 0, 0, 0, 63)
84+
self.out.LedCtrlXY(2, 0, 63, 0, 63)
85+
self.out.LedCtrlXY(3, 0, 63, 0, 63)
86+
self.out.LedCtrlXY(4, 0, 63, 0, 0)
87+
self.out.LedCtrlXY(5, 0, 63, 0, 0)
88+
89+
self.out.LedCtrlXY(8, 1, 63, 63, 0)
90+
self.out.LedCtrlXY(8, 2, 63, 63, 0)
91+
self.out.LedCtrlXY(8, 3, 0, 63, 63)
92+
self.out.LedCtrlXY(8, 4, 0, 63, 63)
93+
self.out.LedCtrlXY(8, 5, 63, 24, 63)
94+
self.out.LedCtrlXY(8, 6, 63, 24, 63)
95+
self.out.LedCtrlXY(8, 7, 24, 63, 63)
96+
self.out.LedCtrlXY(8, 8, 24, 63, 63)
7297

7398
def get_octave(self):
7499
return self.octave_separation + self.octave

src/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Settings:
1919

2020
# Color scheme using webcolors
2121
# split_colors: str = "cyan,blue,blue,blue,blue,blue,blue,blue,blue,blue,blue,blue"
22-
launchpad_colors: str = ''
22+
launchpad_colors: str = '5,1,9,1,13,122,1,37,45,94,1,95'
2323

2424
colors: str = "red,darkred,orange,goldenrod,yellow,green,darkolivegreen,blue,darkslateblue,indigo,darkorchid,pink"
2525
# colors: str = "cyan,green,green,green,green,green,green,green,green,green,green,green"

0 commit comments

Comments
 (0)