Skip to content

Commit e9dd993

Browse files
committed
improved light behavior, fixed bugs
1 parent 7898099 commit e9dd993

File tree

3 files changed

+104
-24
lines changed

3 files changed

+104
-24
lines changed

settings.ini.example

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1+
; Rename this file to settings.ini to apply settings.
2+
; Uncomment options and change them to customize look and behavior.
3+
14
[general]
2-
velocity_curve=1.0
3-
min_velocity=0
4-
max_velocity=127
55
size=128
6-
midi_out=midimech
7-
split_out=split
8-
fps=60
9-
split=false
6+
;velocity_curve=1.0
7+
;lights=1,9,9,2,2,3,3,5,8,8,11,11
8+
;split_lights=4,7,5,7,5,5,7,5,7,5,7,5
9+
;colors=red,darkred,orange,goldenrod,yellow,green,darkolivegreen,blue,darkslateblue,indigo,darkorchid,pink
10+
;split_colors=cyan,blue,blue,blue,blue,blue,blue,blue,blue,blue,blue,blue
11+
;mark_light=1
12+
;mark_color=red
13+
;one_channel=0
14+
;lite=false

src/core.py

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -194,12 +194,16 @@ def set_mark_light(self, x, y, state=True):
194194

195195
def set_launchpad_light(self, x, y, color):
196196
"""Set launchpad light to color index"""
197-
if color is not None:
198-
col = self.options.colors[color] / 4
199-
else:
200-
col = glm.ivec3(0,0,0)
201197
if self.is_macro_button(x, 8 - y - 1):
202198
col = glm.ivec3(63,63,63)
199+
else:
200+
if color != -1: # not mark
201+
if color is not None and self.scale_notes[color] != '.':
202+
col = self.options.colors[color] / 4
203+
else:
204+
col = glm.ivec3(0,0,0)
205+
else:
206+
col = self.options.mark_color / 4
203207
self.launchpad.LedCtrlXY(x, 8-y, col[0], col[1], col[2])
204208

205209
def setup_lights(self):
@@ -444,6 +448,10 @@ def init_board(self):
444448

445449
def midi_write(self, dev, msg, ts=0):
446450
"""Write MIDI message `msg` to device `dev`"""
451+
# if type(dev) in (list,tuple):
452+
# for d in dev:
453+
# self.midi_write(d, msg, ts)
454+
# return
447455
if dev:
448456
dev.send_raw(*msg)
449457

@@ -931,7 +939,7 @@ def cb_launchpad_in(self, event, timestamp=0):
931939
y = 8 - event[1]
932940
if 0 <= x < 8 and 0 <= y < 8:
933941
note = y * 8 + x
934-
self.set_launchpad_light(x, y, 0) # red
942+
self.set_launchpad_light(x, y, -1)
935943
if not self.is_macro_button(x, 8 - y - 1):
936944
self.note_on([144, note, event[2]], timestamp, width=8, force_channel=self.options.launchpad_channel)
937945
else:
@@ -1086,7 +1094,7 @@ def __init__(self):
10861094
self.options.colors = list(self.options.colors.split(","))
10871095
self.options.colors = list(map(lambda x: glm.ivec3(get_color(x)), self.options.colors))
10881096

1089-
self.options.split_colors = get_option(opts, "colors", DEFAULT_OPTIONS.split_colors)
1097+
self.options.split_colors = get_option(opts, "split_colors", DEFAULT_OPTIONS.split_colors)
10901098
self.options.split_colors = list(self.options.split_colors.split(","))
10911099
self.options.split_colors = list(map(lambda x: glm.ivec3(get_color(x)), self.options.split_colors))
10921100

@@ -1160,6 +1168,11 @@ def __init__(self):
11601168
self.options.show_lowest_note = get_option(
11611169
opts, "show_lowest_note", DEFAULT_OPTIONS.show_lowest_note
11621170
)
1171+
1172+
self.options.y_bend = get_option(
1173+
opts, "y_bend", DEFAULT_OPTIONS.y_bend
1174+
)
1175+
11631176
# self.options.mpe = get_option(
11641177
# opts, "mpe", DEFAULT_OPTIONS.mpe
11651178
# ) or get_option(
@@ -1177,9 +1190,9 @@ def __init__(self):
11771190
opts, "split", DEFAULT_OPTIONS.split
11781191
)
11791192
self.options.foot_in = get_option(opts, "foot_in", DEFAULT_OPTIONS.foot_in)
1180-
self.options.sustain = get_option(
1181-
opts, "sustain", DEFAULT_OPTIONS.sustain
1182-
) # sustain scale
1193+
# self.options.sustain = get_option(
1194+
# opts, "sustain", DEFAULT_OPTIONS.sustain
1195+
# )
11831196

11841197
# which split the sustain affects
11851198
self.options.sustain_split = get_option(
@@ -1529,14 +1542,22 @@ def __init__(self):
15291542
lp = launchpad.LaunchpadLPX()
15301543
if lp.Open(1):
15311544
self.launchpad_mode = "lpx"
1532-
lp.LedCtrlXY(0, 0, 0, 0, 63)
1533-
lp.LedCtrlXY(1, 0, 0, 0, 63)
1534-
lp.LedCtrlXY(2, 0, 63, 0, 63)
1535-
lp.LedCtrlXY(3, 0, 63, 0, 63)
15361545
if self.launchpad_mode is not None:
15371546
self.launchpad = lp
15381547

15391548
self.done = False
1549+
1550+
if self.launchpad_mode == "lpx":
1551+
lp.LedCtrlXY(0, 0, 0, 0, 63)
1552+
lp.LedCtrlXY(1, 0, 0, 0, 63)
1553+
lp.LedCtrlXY(2, 0, 63, 0, 63)
1554+
lp.LedCtrlXY(3, 0, 63, 0, 63)
1555+
1556+
# if self.launchpad:
1557+
# # use the alternate colors
1558+
# self.options.colors = get_option(opts, "colors", DEFAULT_OPTIONS.colors_alt)
1559+
# self.options.colors = list(self.options.colors.split(","))
1560+
# self.options.colors = list(map(lambda x: glm.ivec3(get_color(x)), self.options.colors))
15401561

15411562
if not self.midi_out:
15421563
error(

src/options.py

Lines changed: 58 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,92 @@
22

33
@dataclass
44
class Options:
5-
version: int = 0
5+
version: int = 0 # Version of the program (not yet impl)
66
# lights: str = "4,7,3,7,3,3,7,3,7,3,7,3"
7+
8+
# LinnStrument light numbers
79
lights: str = "4,7,3,7,3,3,7,3,7,3,7,3"
10+
# Same as above, for split
811
split_lights: str = "4,7,5,7,5,5,7,5,7,5,7,5"
12+
13+
# LinnStrument light color for mark, default: 1 (red)
914
mark_light: int = 1
15+
16+
# LaunchPad light color for mark, default: red
1017
mark_color: str = "red"
11-
# colors: str = "red,darkred,orange,goldenrod,yellow,green,darkolivegreen,blue,darkslateblue,indigo,darkorchid,pink"
18+
19+
# Color scheme using webcolors
1220
colors: str = "cyan,green,green,green,green,green,green,green,green,green,green,green"
1321
split_colors: str = "cyan,blue,blue,blue,blue,blue,blue,blue,blue,blue,blue,blue"
22+
23+
# MPE Settings
24+
# one_channel==0: MPE enabled
25+
# one_channel==1: Output to channel 1 only
26+
# one_channel==2: Output to channel 2 only, ...
1427
one_channel: int = 0
15-
lite: bool = False # lite mode (no gfx)
28+
29+
# lite mode (no extra gfx, less processing)
30+
lite: bool = False
31+
32+
# Custom velocity curve exponent, ex: 0.5 = more sensitive
1633
velocity_curve: float = 1.0
34+
35+
# Velocity curve exponent for foot controller curve bending
1736
velocity_curve_low: float = 0.5
1837
velocity_curve_high: float = 3.0
38+
39+
# Clamp velocity
1940
min_velocity: float = 0
2041
max_velocity: float = 127
42+
43+
# Show lowest note mark (old option, no longer maintained)
2144
show_lowest_note: bool = False
22-
mpe: bool = True
45+
46+
# MPE mode on by default? (use one_channel instead)
47+
# mpe: bool = True
48+
49+
# Automatically set based on size==200,
50+
# but can be forced for testing purposes
2351
hardware_split: bool = False
52+
53+
# Midi out device name, partial matches allowed
2454
midi_out: str = "midimech"
55+
56+
# Split device name, partial matches allowed
2557
split_out: str = "split"
58+
59+
# Application frames per second
2660
fps: int = 60
61+
62+
# Start with split on?
2763
split: bool = False
64+
65+
# Foot controller device name, partial matches allowed
2866
foot_in: str = ""
67+
68+
# Sustain pedal value multiplier (not yet impl)
2969
sustain: float = 1.0
70+
71+
# which split should sustain pedal use (left, right, both)
3072
sustain_split: str = "both"
73+
74+
# Size of LinnStrument (128 or 200)
3175
size: int = 128
76+
77+
# Right now these are calculated from size, don't use
3278
width: int = 16
3379
height: int = 8
80+
81+
# launchpad viberato method (off, mod, or pitch)
3482
vibrato: str = 'mod'
83+
84+
# Set scale based on left hand chord (not yet impl)
3585
jazz: bool = False
86+
3687
chord_analyzer: bool = True
3788

89+
# Allow Y axis to bend chromatically (not yet impl)
90+
y_bend: bool = False
91+
3892
DEFAULT_OPTIONS = Options()
3993

0 commit comments

Comments
 (0)