@@ -116,17 +116,17 @@ def send_cc(self, channel, cc, val):
116
116
self .linn_out .send_cc (channel , cc , val )
117
117
# self.linn_out.send_messages(0xb0, [(channel, cc, val)])
118
118
119
- def set_light (self , x , y , col , index = None ): # col is [1,11], 0 resets
119
+ def set_light (self , x , y , col , index = None , mark = False ): # col is [1,11], 0 resets
120
120
"""Set light to color `col` at x, y if in range and connected"""
121
- if y < 0 or y > self .board_h :
121
+ if y < 0 or y >= self .board_h :
122
122
return
123
- if x < 0 or x > self .board_w :
123
+ if x < 0 or x >= self .board_w :
124
124
return
125
125
126
126
if not index :
127
127
index = self .get_note_index (x , y )
128
128
129
- self .red_lights [y ][x ] = ( col == 1 )
129
+ self .mark_lights [y ][x ] = mark
130
130
if self .linn_out :
131
131
self .send_cc (0 , 20 , x + 1 )
132
132
self .send_cc (0 , 21 , self .board_h - y - 1 )
@@ -169,7 +169,7 @@ def reset_light(self, x, y, reset_red=True):
169
169
light_col = 7
170
170
171
171
self .set_light (x , y , light_col , note )
172
- self .red_lights [y ][x ] = False
172
+ self .mark_lights [y ][x ] = False
173
173
174
174
def reset_launchpad_light (self , x , y ):
175
175
"""Reset the launchpad light at x, y"""
@@ -184,11 +184,11 @@ def reset_launchpad_light(self, x, y):
184
184
# light_col = self.options.lights[note]
185
185
self .set_launchpad_light (x , y , note )
186
186
187
- def set_red_light (self , x , y , state = True ):
187
+ def set_mark_light (self , x , y , state = True ):
188
188
"""Set launchpad light to touched color"""
189
- self .red_lights [y ][x ] = state
189
+ self .mark_lights [y ][x ] = state
190
190
if self .launchpad :
191
- lp_col = ivec3 ( 63 , 0 , 0 )
191
+ lp_col = self . options . mark_color
192
192
if state :
193
193
self .launchpad .LedCtrlXY (x , y , lp_col [0 ], lp_col [1 ], lp_col [2 ])
194
194
@@ -206,8 +206,8 @@ def setup_lights(self):
206
206
"""Set all lights"""
207
207
for y in range (self .board_h ):
208
208
for x in range (self .board_w ):
209
- if self .red_lights [y ][x ]:
210
- self .set_red_light (x , y , True )
209
+ if self .mark_lights [y ][x ]:
210
+ self .set_mark_light (x , y , True )
211
211
else :
212
212
self .reset_light (x , y )
213
213
@@ -256,30 +256,33 @@ def get_color(self, x, y):
256
256
# return NOTE_COLORS[get_note_index(x, y)]
257
257
note = self .get_note_index (x , y )
258
258
# note = (note - self.tonic) % 12
259
- if self .is_split ():
260
- split_chan = self .channel_from_split (x , self .board_h - y - 1 )
261
- if split_chan :
262
- light_col = self .options .split_lights [note ]
263
- try :
264
- light_col = light_col if self .scale_notes [note ]!= '.' else 7
265
- except IndexError :
266
- light_col = 7
267
- else :
268
- light_col = self .options .lights [note ]
269
- try :
270
- light_col = light_col if self .scale_notes [note ]!= '.' else 7
271
- except IndexError :
272
- light_col = 7
259
+ # if self.is_split():
260
+ # split_chan = self.channel_from_split(x, self.board_h - y - 1)
261
+ # if split_chan:
262
+ # light_col = self.options.split_lights[note]
263
+ # try:
264
+ # light_col = light_col if self.scale_notes[note]!='.' else 7
265
+ # except IndexError:
266
+ # light_col = 7
267
+ # else:
268
+ # light_col = self.options.lights[note]
269
+ # try:
270
+ # light_col = light_col if self.scale_notes[note]!='.' else 7
271
+ # except IndexError:
272
+ # light_col = 7
273
273
274
- else :
275
- light_col = self .options .lights [note ]
276
- try :
277
- light_col = light_col if self .scale_notes [note ]!= '.' else 7
278
- except IndexError :
279
- light_col = 7
274
+ # else:
275
+ # light_col = self.options.lights[note]
276
+ # try:
277
+ # light_col = light_col if self.scale_notes[note]!='.' else 7
278
+ # except IndexError:
279
+ # light_col = 7
280
280
281
281
if self .scale_notes [note ] != '.' :
282
- return self .options .colors [note ]
282
+ if self .channel_from_split (x , self .board_h - y - 1 ):
283
+ return self .options .split_colors [note ]
284
+ else :
285
+ return self .options .colors [note ]
283
286
else :
284
287
return None
285
288
@@ -1083,6 +1086,10 @@ def __init__(self):
1083
1086
self .options .colors = list (self .options .colors .split ("," ))
1084
1087
self .options .colors = list (map (lambda x : glm .ivec3 (get_color (x )), self .options .colors ))
1085
1088
1089
+ self .options .split_colors = get_option (opts , "colors" , DEFAULT_OPTIONS .split_colors )
1090
+ self .options .split_colors = list (self .options .split_colors .split ("," ))
1091
+ self .options .split_colors = list (map (lambda x : glm .ivec3 (get_color (x )), self .options .split_colors ))
1092
+
1086
1093
# LIGHT = ivec3(127)
1087
1094
self .options .lights = get_option (opts , "lights" , DEFAULT_OPTIONS .lights )
1088
1095
if self .options .lights :
@@ -1102,6 +1109,8 @@ def __init__(self):
1102
1109
1103
1110
if len (self .options .colors ) != 12 :
1104
1111
error ("Invalid color configuration. Make sure you have 12 colors under the colors option or remove it." )
1112
+ if len (self .options .split_colors ) != 12 :
1113
+ error ("Invalid split color configuration. Make sure you have 12 colors under the split_colors option or remove it." )
1105
1114
if len (self .options .lights ) != 12 :
1106
1115
error ("Invalid light color configuration. Make sure you have 12 light colors under the lights option or remove it." )
1107
1116
if len (self .options .split_lights ) != 12 :
@@ -1134,6 +1143,14 @@ def __init__(self):
1134
1143
if self .options .velocity_curve < EPSILON : # if its near zero, set default
1135
1144
self .options .velocity_curve = 1.0 # default
1136
1145
1146
+ self .options .mark_light = get_option (
1147
+ opts , "mark_light" , DEFAULT_OPTIONS .mark_light
1148
+ )
1149
+ self .options .mark_color = get_option (
1150
+ opts , "mark_color" , DEFAULT_OPTIONS .mark_color
1151
+ )
1152
+ self .options .mark_color = glm .ivec3 (get_color (self .options .mark_color ))
1153
+
1137
1154
self .options .min_velocity = get_option (
1138
1155
opts , "min_velocity" , DEFAULT_OPTIONS .min_velocity
1139
1156
)
@@ -1534,7 +1551,7 @@ def __init__(self):
1534
1551
w = self .max_width
1535
1552
h = self .board_h
1536
1553
self .board = [[0 for x in range (w )] for y in range (h )]
1537
- self .red_lights = [[False for x in range (w )] for y in range (h )]
1554
+ self .mark_lights = [[False for x in range (w )] for y in range (h )]
1538
1555
self .launchpad_state = [[None for x in range (8 )] for y in range (8 )]
1539
1556
1540
1557
self .font = pygame .font .Font (None , FONT_SZ )
@@ -1719,7 +1736,7 @@ def mark_xy(self, x, y, state, use_lights=False):
1719
1736
pass
1720
1737
if use_lights :
1721
1738
if state :
1722
- self .set_light (x , y , 1 )
1739
+ self .set_light (x , y , self . options . mark_light , mark = True )
1723
1740
else :
1724
1741
self .reset_light (x , y )
1725
1742
self .dirty = True
@@ -1748,7 +1765,7 @@ def mark(self, midinote, state, use_lights=False, only_row=None):
1748
1765
self .board [y + self .flipped ][x ] = state
1749
1766
if use_lights :
1750
1767
if state :
1751
- self .set_light (x , y , 1 )
1768
+ self .set_light (x , y , self . options . mark_light , mark = True )
1752
1769
else :
1753
1770
self .reset_light (x , y )
1754
1771
y += 1
0 commit comments