@@ -574,9 +574,9 @@ def note_on(self, data, timestamp, width=None, curve=True, mpe=None, octave=0, t
574574 x = col
575575 midinote = row_offset * y + column_offset * x
576576 midinote += 32
577+ midinote += 12 * octave
577578 if self .flipped :
578579 midinote += 7
579- data [1 ] = midinote
580580
581581 # print(x, y, midinote)
582582 # return
@@ -606,11 +606,25 @@ def note_on(self, data, timestamp, width=None, curve=True, mpe=None, octave=0, t
606606 # data[1] += BASE_OFFSET
607607 # midinote = data[1] - 24 + self.transpose * 2
608608 col_full = x + (left_width if within_hardware_split else 0 )
609+
610+ # figure out if note is on left or right side
609611 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
610621 if self .is_split ():
611622 split_chan = side
612623 else :
613624 split_chan = 0
625+
626+ data [1 ] = midinote
627+
614628 if not aftertouch :
615629 self .mark (midinote - 24 , 1 , only_row = row )
616630 # 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
663677 else :
664678 self .midi_write (self .split_out , data , timestamp )
665679 else :
680+ # print(data[1]) # midi note number
666681 self .midi_write (self .midi_out , data , timestamp )
667682
668683 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,
758773 x = col
759774 midinote = row_offset * y + column_offset * x
760775 midinote += 32
776+ midinote += 12 * octave
761777 if self .flipped :
762778 midinote += 7
763779 # print('off', x, y, midinote)
764- data [1 ] = midinote
765780
766781 col_full = x + (left_width if within_hardware_split else 0 )
767782 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+
768790 if self .is_split ():
769791 split_chan = side
770792 else :
771793 split_chan = 0
794+
795+ data [1 ] = midinote
796+
772797 self .mark (midinote - 24 , 0 , only_row = y )
773798 # data[1] += self.out_octave * 12 + self.transpose * 2
774799 # if self.flipped:
@@ -1354,6 +1379,9 @@ def __init__(self):
13541379 print ("Invalid sustain split value. Settings: left, right, both." )
13551380 sys .exit (1 )
13561381
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+
13571385 hardware_split = False
13581386 self .options .size = get_option (opts , "size" , DEFAULT_OPTIONS .size )
13591387 if self .options .size == 128 :
@@ -1682,7 +1710,7 @@ def __init__(self):
16821710 lp = launchpad .LaunchpadPro ()
16831711 if lp .Check (0 ):
16841712 if lp .Open (0 ):
1685- self .launchpads += [Launchpad (lp , "pro" )]
1713+ self .launchpads += [Launchpad (lp , "pro" , 0 )]
16861714 if launchpad .LaunchpadProMk3 ().Check (0 ):
16871715 lp = launchpad .LaunchpadProMk3 ()
16881716 if lp .Open (0 ):
@@ -1694,7 +1722,7 @@ def __init__(self):
16941722 if launchpad .LaunchpadLPX ().Check (3 ):
16951723 lp = launchpad .LaunchpadLPX ()
16961724 if lp .Open (3 ): # second
1697- self .launchpads += [Launchpad (lp , "lpx" , 1 , 1 )]
1725+ self .launchpads += [Launchpad (lp , "lpx" , 1 , self . options . octave_separation )]
16981726
16991727 if self .launchpads :
17001728 print ('Launchpads:' , len (self .launchpads ))
0 commit comments