@@ -574,9 +574,9 @@ def note_on(self, data, timestamp, width=None, curve=True, mpe=None, octave=0, t
574
574
x = col
575
575
midinote = row_offset * y + column_offset * x
576
576
midinote += 32
577
+ midinote += 12 * octave
577
578
if self .flipped :
578
579
midinote += 7
579
- data [1 ] = midinote
580
580
581
581
# print(x, y, midinote)
582
582
# return
@@ -606,11 +606,25 @@ def note_on(self, data, timestamp, width=None, curve=True, mpe=None, octave=0, t
606
606
# data[1] += BASE_OFFSET
607
607
# midinote = data[1] - 24 + self.transpose * 2
608
608
col_full = x + (left_width if within_hardware_split else 0 )
609
+
610
+ # figure out if note is on left or right side
609
611
side = self .channel_from_split (col_full , row , force = True )
612
+
613
+ # if the note is on the right side, we shift by the current octave split
614
+ if side == 1 :
615
+ octave_split = self .options .octave_split
616
+ if octave_split != 0 :
617
+ midinote += 12 * octave_split
618
+
619
+ # if we have a split set up, set the side found above to split_chan,
620
+ # otherwise everything should be in the same region
610
621
if self .is_split ():
611
622
split_chan = side
612
623
else :
613
624
split_chan = 0
625
+
626
+ data [1 ] = midinote
627
+
614
628
if not aftertouch :
615
629
self .mark (midinote - 24 , 1 , only_row = row )
616
630
# data[1] += self.out_octave * 12 + self.transpose * 2
@@ -663,6 +677,7 @@ def note_on(self, data, timestamp, width=None, curve=True, mpe=None, octave=0, t
663
677
else :
664
678
self .midi_write (self .split_out , data , timestamp )
665
679
else :
680
+ # print(data[1]) # midi note number
666
681
self .midi_write (self .midi_out , data , timestamp )
667
682
668
683
def note_off (self , data , timestamp , width = None , mpe = None , octave = 0 , transpose = 0 , force_channel = None ):
@@ -758,17 +773,27 @@ def note_off(self, data, timestamp, width=None, mpe=None, octave=0, transpose=0,
758
773
x = col
759
774
midinote = row_offset * y + column_offset * x
760
775
midinote += 32
776
+ midinote += 12 * octave
761
777
if self .flipped :
762
778
midinote += 7
763
779
# print('off', x, y, midinote)
764
- data [1 ] = midinote
765
780
766
781
col_full = x + (left_width if within_hardware_split else 0 )
767
782
side = self .channel_from_split (col_full , y , force = True )
783
+
784
+ # if the note is on the right side, we shift by the current octave split
785
+ if side == 1 :
786
+ octave_split = self .options .octave_split
787
+ if octave_split != 0 :
788
+ midinote += 12 * octave_split
789
+
768
790
if self .is_split ():
769
791
split_chan = side
770
792
else :
771
793
split_chan = 0
794
+
795
+ data [1 ] = midinote
796
+
772
797
self .mark (midinote - 24 , 0 , only_row = y )
773
798
# data[1] += self.out_octave * 12 + self.transpose * 2
774
799
# if self.flipped:
@@ -1354,6 +1379,9 @@ def __init__(self):
1354
1379
print ("Invalid sustain split value. Settings: left, right, both." )
1355
1380
sys .exit (1 )
1356
1381
1382
+ self .options .octave_separation = get_option (opts , "octave_separation" , DEFAULT_OPTIONS .octave_separation )
1383
+ self .options .octave_split = get_option (opts , "octave_split" , DEFAULT_OPTIONS .octave_split )
1384
+
1357
1385
hardware_split = False
1358
1386
self .options .size = get_option (opts , "size" , DEFAULT_OPTIONS .size )
1359
1387
if self .options .size == 128 :
@@ -1682,7 +1710,7 @@ def __init__(self):
1682
1710
lp = launchpad .LaunchpadPro ()
1683
1711
if lp .Check (0 ):
1684
1712
if lp .Open (0 ):
1685
- self .launchpads += [Launchpad (lp , "pro" )]
1713
+ self .launchpads += [Launchpad (lp , "pro" , 0 )]
1686
1714
if launchpad .LaunchpadProMk3 ().Check (0 ):
1687
1715
lp = launchpad .LaunchpadProMk3 ()
1688
1716
if lp .Open (0 ):
@@ -1694,7 +1722,7 @@ def __init__(self):
1694
1722
if launchpad .LaunchpadLPX ().Check (3 ):
1695
1723
lp = launchpad .LaunchpadLPX ()
1696
1724
if lp .Open (3 ): # second
1697
- self .launchpads += [Launchpad (lp , "lpx" , 1 , 1 )]
1725
+ self .launchpads += [Launchpad (lp , "lpx" , 1 , self . options . octave_separation )]
1698
1726
1699
1727
if self .launchpads :
1700
1728
print ('Launchpads:' , len (self .launchpads ))
0 commit comments