Skip to content

Commit dd5c194

Browse files
committed
Fixed transposition, added ls_color()
1 parent 314f033 commit dd5c194

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

Diff for: src/core.py

+14-9
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,13 @@ def send_all_notes_off(self):
153153
self.midi_write(self.midi_out, [0xb0 | ch, 120, 0], 0)
154154
self.midi_write(self.midi_out, [0xb0 | ch, 123, 0], 0)
155155

156+
def ls_color(self, x, y, col):
157+
"""Set LinnStrument pad color"""
158+
if self.linn_out:
159+
self.send_ls_cc(0, 20, x + 1)
160+
self.send_ls_cc(0, 21, self.board_h - y - 1)
161+
self.send_ls_cc(0, 22, col)
162+
156163
def set_light(self, x, y, col, index=None, mark=False): # col is [1,11], 0 resets
157164
"""Set light to color `col` at x, y if in range and connected"""
158165
if y < 0 or y >= self.board_h:
@@ -164,10 +171,8 @@ def set_light(self, x, y, col, index=None, mark=False): # col is [1,11], 0 rese
164171
index = self.get_note_index(x, y, transpose=False)
165172

166173
self.mark_lights[y][x] = mark
167-
if self.linn_out:
168-
self.send_ls_cc(0, 20, x + 1)
169-
self.send_ls_cc(0, 21, self.board_h - y - 1)
170-
self.send_ls_cc(0, 22, col)
174+
175+
self.ls_color(x, y, col)
171176

172177
if index is not None:
173178
for lp in self.launchpads:
@@ -1753,15 +1758,15 @@ def __init__(self):
17531758
num_launchpads = 0
17541759
if self.options.launchpad:
17551760
launchpads = []
1756-
lp = launchpad.LaunchpadPro()
1761+
lp = launchpad.LaunchpadProMk3()
17571762
if lp.Check(0):
17581763
if lp.Open(0):
1759-
self.launchpads += [Launchpad(self, lp, "pro", num_launchpads)]
1764+
self.launchpads += [Launchpad(self, lp, "promk3", num_launchpads)]
17601765
num_launchpads += 1
1761-
lp = launchpad.LaunchpadProMk3()
1766+
lp = launchpad.LaunchpadPro()
17621767
if lp.Check(0):
17631768
if lp.Open(0):
1764-
self.launchpads += [Launchpad(self, lp, "promk3", num_launchpads)]
1769+
self.launchpads += [Launchpad(self, lp, "pro", num_launchpads)]
17651770
num_launchpads += 1
17661771
lp = launchpad.LaunchpadLPX()
17671772
if lp.Check(1):
@@ -2026,7 +2031,7 @@ def mark(self, midinote, state, use_lights=False, only_row=None):
20262031
octave = self.get_octave(x, y)
20272032
if octave == midinote // 12:
20282033
# print(octave)
2029-
self.board[y + self.flipped][x] = state
2034+
self.board[y + self.flipped][x + self.position.x] = state
20302035
if use_lights:
20312036
if state:
20322037
self.set_light(x, y, self.options.mark_light, mark=True)

0 commit comments

Comments
 (0)