@@ -345,6 +345,7 @@ def note_on(self, data, timestamp, width=None, curve=True, no_overlap=None):
345
345
# print(data)
346
346
ch = d0 & 0x0F
347
347
msg = (data [0 ] & 0xF0 ) >> 4
348
+ aftertouch = (msg == 10 )
348
349
if self .options .one_channel :
349
350
data [0 ] = d0 & 0xF0 # send all to channel 0 if enabled
350
351
row = None
@@ -373,14 +374,16 @@ def note_on(self, data, timestamp, width=None, curve=True, no_overlap=None):
373
374
midinote = data [1 ] - 24 + self .transpose * 2
374
375
if self .is_split ():
375
376
split_chan = self .channel_from_split (row , col )
376
- self .mark (midinote , 1 , only_row = row )
377
+ if not aftertouch :
378
+ self .mark (midinote , 1 , only_row = row )
377
379
data [1 ] += self .out_octave * 12 + self .transpose * 2
378
380
if self .flipped :
379
381
data [1 ] += 7
380
382
381
- # apply velocity curve
383
+ # velocity (or pressure if aftertouch)
382
384
vel = data [2 ] / 127
383
- if curve :
385
+ if curve and not aftertouch :
386
+ # apply curve
384
387
if self .has_velocity_settings ():
385
388
vel = self .velocity_curve (data [2 ] / 127 )
386
389
data [2 ] = clamp (
@@ -550,10 +553,10 @@ def cb_launchpad_in(self, event, timestamp):
550
553
x = event [1 ] % 10 - 1
551
554
state = self .launchpad_state [y ][x ]
552
555
self .launchpad_state [y ][x ] = event [2 ]
556
+ note = y * 8 + x
553
557
if state is None : # just pressed
554
- note = y * 8 + x
555
558
self .note_on ([144 , note , event [2 ]], timestamp , width = 8 , no_overlap = True , curve = False )
556
- # TODO: write pressure
559
+ self . note_on ([ 160 , note , event [ 2 ]], timestamp , width = 8 , no_overlap = True , curve = False )
557
560
elif event [0 ] == 176 :
558
561
if event == [176 , 93 , 127 , 0 ]:
559
562
self .transpose_board (- 1 )
@@ -592,26 +595,28 @@ def cb_launchpad_in(self, event, timestamp):
592
595
# with open('settings_temp.ini', 'w') as configfile:
593
596
# self.cfg.write(configfile)
594
597
595
- def init_launchpad (self ):
596
- pattern = [
597
- 'ggggbb' ,
598
- 'cggbbb' ,
599
- ]
600
-
601
- for y in range (1 , 9 ):
602
- for x in range (0 , 8 ):
603
- yy = y - 2
604
- xx = x
605
- yy -= 3
606
- xx -= (8 - yy - 1 )// 2
607
- col = pattern [yy % 2 ][xx % 6 ]
608
- if col == 'c' : #cyan
609
- col = [0 , 63 , 63 ]
610
- elif col == 'g' : #green
611
- col = [0 , 63 , 0 ]
612
- elif col == 'b' : #black
613
- col = [0 , 0 , 0 ]
614
- self .launchpad .LedCtrlXY (x , y , col [0 ], col [1 ], col [2 ])
598
+ # def init_launchpad(self):
599
+ # pattern = [
600
+ # 'ggggbb',
601
+ # 'cggbbb',
602
+ # ]
603
+
604
+ # self.launchpad.LedCtrlXY(x, y+1, lp_col[0], lp_col[1], lp_col[2])
605
+
606
+ # for y in range(1, 9):
607
+ # for x in range(0, 8):
608
+ # yy = y - 2
609
+ # xx = x
610
+ # yy -= 3
611
+ # xx -= (8-yy-1)//2
612
+ # col = pattern[yy%2][xx%6]
613
+ # if col == 'c': #cyan
614
+ # col = [0, 63, 63]
615
+ # elif col == 'g': #green
616
+ # col = [0, 63, 0]
617
+ # elif col == 'b': #black
618
+ # col = [0, 0, 0]
619
+ # self.launchpad.LedCtrlXY(x, y, col[0], col[1], col[2])
615
620
616
621
def __init__ (self ):
617
622
self .cfg = ConfigParser (allow_no_value = True )
@@ -932,7 +937,7 @@ def __init__(self):
932
937
mode = "lpx"
933
938
if mode is not None :
934
939
self .launchpad = lp
935
- self .init_launchpad ()
940
+ # self.init_launchpad()
936
941
937
942
self .done = False
938
943
0 commit comments