Skip to content

Commit

Permalink
fix for compact mode. disable clip coloring as it bugs on windows 8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
hdavid committed Oct 30, 2013
1 parent b9a3c46 commit c131737
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 30 deletions.
22 changes: 11 additions & 11 deletions InstrumentControllerComponent.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def __init__(self, matrix, side_buttons, top_buttons, parent):
self._side_buttons=side_buttons
self._remaining_buttons = []
self._track_controller = None
self.base_channel = 11

self._drum_group_device = None
self._octave_up_button = None
Expand Down Expand Up @@ -187,16 +188,15 @@ def _update_matrix(self):
pass
else:

BASE_CHANNEL = 11
FEEDBACK_CHANNELS = [11,12,13]
NON_FEEDBACK_CHANNEL = 14
self._parent._parent.set_feedback_channels(FEEDBACK_CHANNELS)
feedback_channels = [self.base_channel,self.base_channel+1,self.base_channel+2]
non_feedback_channel = self.base_channel+3
self._parent._parent.set_feedback_channels(feedback_channels)
self._parent._parent.set_controlled_track(self.song().view.selected_track)

# create array to keep last channel used for note.
note_channel = range(128)
for i in range(128):
note_channel[i]=BASE_CHANNEL
note_channel[i]=self.base_channel

#select drumrack device
self._get_drumrack_device()
Expand All @@ -209,7 +209,7 @@ def _update_matrix(self):

for button, (x, y) in self._matrix.iterbuttons():
button.use_default_message()
button.set_channel(NON_FEEDBACK_CHANNEL)
button.set_channel(non_feedback_channel)
button.force_next_send()

if self._scales.is_drumrack():
Expand All @@ -225,17 +225,17 @@ def _update_matrix(self):
if self._drum_group_device != None and self._drum_group_device.can_have_drum_pads and self._drum_group_device.has_drum_pads and self._drum_group_device.drum_pads[note].chains:
button.set_on_off_values(RED_FULL, GREEN_THIRD)
button.set_enabled(False)
button.set_channel(BASE_CHANNEL)
button.set_channel(self.base_channel)
button.set_identifier(note)
else:
button.set_on_off_values(GREEN_FULL, LED_OFF)
button.set_enabled(False)
button.set_channel(BASE_CHANNEL)
button.set_channel(self.base_channel)
button.set_identifier(note)
else:
button.set_on_off_values(LED_OFF, LED_OFF)
button.set_enabled(True)
button.set_channel(NON_FEEDBACK_CHANNEL)
button.set_channel(non_feedback_channel)
button.force_next_send()
button.turn_off()

Expand All @@ -254,7 +254,7 @@ def _update_matrix(self):
button.set_identifier(note_info.index)
note_channel[note_info.index]=note_channel[note_info.index]+1
else:
button.set_channel(NON_FEEDBACK_CHANNEL)
button.set_channel(non_feedback_channel)
button.set_on_off_values(LED_OFF, LED_OFF)
button.set_light(note_info.color)
button.set_enabled(True)
Expand All @@ -265,7 +265,7 @@ def _update_matrix(self):
for button in self._side_buttons:
button.use_default_message()
#button.turn_off()
button.set_channel(NON_FEEDBACK_CHANNEL)
button.set_channel(non_feedback_channel)
button.set_enabled(True)
#button.set_identifier(120+i)
button.force_next_send()
Expand Down
66 changes: 47 additions & 19 deletions MainSelectorComponent.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def __init__(self, matrix, top_buttons, side_buttons, config_button, parent):
assert isinstance(config_button, ButtonElement)
ModeSelectorComponent.__init__(self)
self._parent = parent
self._compact = False
self._session = SpecialSessionComponent(matrix.width(), matrix.height())
self._zooming = SessionZoomingComponent(self._session)
self._session.name = 'Session_Control'
Expand Down Expand Up @@ -125,26 +126,53 @@ def _update_mode_buttons(self):


def channel_for_current_mode(self):
if self._mode_index==0:
new_channel = 0 #session

elif self._mode_index==1:
if self._sub_mode_index[self._mode_index]==0:
new_channel= 11 #instrument controller 11,12,13,14
elif self._sub_mode_index[self._mode_index]==1:
new_channel = 3 #device controler
else :
new_channel = 4 #plain user mode 1

elif self._mode_index==2:
if self._sub_mode_index[self._mode_index]==0:
new_channel = 5 #user 2
else:
new_channel = 1 + self._sub_mode_index[self._mode_index] #step seq 1,2
if self._compact:

if self._mode_index==0:
new_channel = 2 #session

elif self._mode_index==1:
if self._sub_mode_index[self._mode_index]==0:
new_channel = 2 #instrument controller 11,12,13,14
if self._instrument_controller != None:
self._instrument_controller.base_channel = new_channel
elif self._sub_mode_index[self._mode_index]==1:
new_channel = 2 #device controler
else :
new_channel = 0 #plain user mode 1

elif self._mode_index==2:
if self._sub_mode_index[self._mode_index]==0:
new_channel = 1 #user 2
else:
new_channel = 2 + self._sub_mode_index[self._mode_index] #step seq 2,3

elif self._mode_index==3: #mixer modes
new_channel = 6 + self._sub_modes.mode() # 6,7,8,9,10
elif self._mode_index==3: #mixer modes
new_channel = 2 + self._sub_modes.mode() # 2,3,4,5,6

else:

if self._mode_index==0:
new_channel = 0 #session

elif self._mode_index==1:
if self._sub_mode_index[self._mode_index]==0:
new_channel = 11 #instrument controller 11,12,13,14
if self._instrument_controller != None:
self._instrument_controller.base_channel = new_channel
elif self._sub_mode_index[self._mode_index]==1:
new_channel = 3 #device controler
else :
new_channel = 4 #plain user mode 1

elif self._mode_index==2:
if self._sub_mode_index[self._mode_index]==0:
new_channel = 5 #user 2
else:
new_channel = 1 + self._sub_mode_index[self._mode_index] #step seq 1,2

elif self._mode_index==3: #mixer modes
new_channel = 6 + self._sub_modes.mode() # 6,7,8,9,10
return new_channel

def update(self):
Expand Down Expand Up @@ -363,7 +391,7 @@ def _init_session(self):
clip_slot.set_started_value(GREEN_FULL)
clip_slot.set_recording_value(RED_FULL)
clip_slot.set_record_button_value(RED_THIRD)
clip_slot.set_clip_palette(CLIP_COLOR_TABLE)
#clip_slot.set_clip_palette(CLIP_COLOR_TABLE)
#clip_slot.set_clip_rgb_table(RGB_COLOR_TABLE)
clip_slot.name = str(track_index) + '_Clip_Slot_' + str(scene_index)
self._all_buttons.append(self._matrix.get_button(track_index, scene_index))
Expand Down

0 comments on commit c131737

Please sign in to comment.