def add_fader_mode(name, bank, add_layer_mode, static_color=None): self._mixer_modes.add_mode(name, ( add_layer_mode, AddLayerMode(self._mixer, Layer(track_select_buttons='track_select_buttons')), partial(self._mixer._update_send_control_colors), partial(self._mixer.set_static_color_value, static_color), partial(switch_to_fader_layout, bank)), behaviour=ReenterBehaviour(on_reenter=reselect_track_select_mode))
def add_track_select_button_mode(name, control=None, component=self._mixer): control_key = control if control else u'{}_buttons'.format(name) control_dict = {control_key: u'track_select_buttons'} self._mixer_modes.add_mode( name, (AddLayerMode(component, Layer(**control_dict)), DelayMode(restore_main_layout, delay=0.1)), behaviour=ReenterBehaviour( on_reenter=reselect_track_select_mode))
def add_fader_mode(name, color, is_pan=False): control_dict = {'{}_controls'.format(name): 'button_faders'} if is_pan: control_dict[ 'track_color_controls'] = 'button_fader_color_elements' else: control_dict[ 'static_color_controls'] = 'button_fader_color_elements' self._mixer_modes.add_mode( name, (partial( self._elements.button_fader_setup_element.send_value, sysex.FADER_HORIZONTAL_ORIENTATION if is_pan else sysex.FADER_VERTICAL_ORIENTATION, sysex.FADER_BIPOLAR if is_pan else sysex.FADER_UNIPOLAR), partial(self._mixer.set_static_color_value, color), self._clear_send_cache_of_button_fader_color_elements, AddLayerMode(self._mixer, Layer(**control_dict)), button_fader_layout_mode), behaviour=ReenterBehaviour(on_reenter=select_none_mode))
def _create_modes(self): self._encoder_modes = DisplayingSkinableModesComponent( name=u'Encoder_Modes') self._encoder_modes.add_mode(u'devices', [ partial(self._switch_display_layout, sysex.BOX_SCREEN_LAYOUT_BYTE), AddLayerMode( self._encoder_modes, Layer(mode_display=self._elements.text_display_line_5, mode_color_fields=self._elements.color_field_line_2, mode_selection_fields=self._elements. selection_field_line_2)), LayerMode( self._device_navigation, Layer(select_buttons=u'pads_flattened', device_color_fields=u'color_field_lines_0_1_flattened', device_name_display_1=u'text_display_line_0', device_name_display_2=u'text_display_line_2', device_bank_name_display_1=u'text_display_line_1', device_bank_name_display_2=u'text_display_line_3', device_selection_fields= u'selection_field_lines_0_1_flattened', selected_device_name_display=u'center_display_1')), SetAttributeMode(self._device_navigation, u'scroll_left_layer', Layer(button=u'up_button')), SetAttributeMode(self._device_navigation, u'scroll_right_layer', Layer(button=u'down_button')), LayerMode( self._device, Layer(prev_bank_button=u'display_up_button', next_bank_button=u'display_down_button')), AddLayerMode( self._mixer, Layer(selected_track_color_field=u'center_color_field', selected_track_name_display=u'center_display_1')), AddLayerMode( self._background, Layer(center_display_2=u'center_display_2', scene_launch_buttons=u'scene_launch_buttons', encoders=u'encoders')), AddLayerMode( self._actions, Layer(actions_display=u'text_display_line_5_with_shift', actions_selection_fields= u'selection_field_line_2_with_shift')) ]) self._encoder_modes.add_mode(u'pan', [ partial(self._switch_display_layout, sysex.KNOB_SCREEN_LAYOUT_BYTE), AddLayerMode( self._encoder_modes, Layer(mode_display=self._elements.text_display_line_3, mode_color_fields=self._elements.color_field_line_2, mode_selection_fields=self._elements. selection_field_line_1, selected_mode_color_field=u'center_color_field')), AddLayerMode( self._mixer, Layer(pan_controls=u'encoders', track_names_display=u'text_display_line_0', pan_value_display=u'text_display_line_1', pan_encoder_color_fields=u'encoder_color_fields', track_color_fields=u'color_field_line_0', mixer_display=u'center_display_1', pan_display=u'center_display_2')), AddLayerMode( self._background, Layer(display_up_button=u'display_up_button', display_down_button=u'display_down_button')), AddLayerMode( self._actions, Layer(actions_display=u'text_display_line_3_with_shift', actions_selection_fields= u'selection_field_line_1_with_shift')) ]) self._encoder_modes.add_mode(u'sends', [ partial(self._switch_display_layout, sysex.KNOB_SCREEN_LAYOUT_BYTE), AddLayerMode( self._encoder_modes, Layer(mode_display=self._elements.text_display_line_3, mode_color_fields=self._elements.color_field_line_2, mode_selection_fields=self._elements. selection_field_line_1, selected_mode_color_field=u'center_color_field')), AddLayerMode( self._mixer, Layer(send_controls=u'encoders', send_up_button=u'display_up_button', send_down_button=u'display_down_button', track_names_display=u'text_display_line_0', track_color_fields=u'color_field_line_0', mixer_display=u'center_display_1', send_index_display=u'center_display_2', send_value_display=u'text_display_line_1', send_encoder_color_fields=u'encoder_color_fields')), AddLayerMode( self._actions, Layer(actions_display=u'text_display_line_3_with_shift', actions_selection_fields= u'selection_field_line_1_with_shift')) ]) self._pad_modes = ModesComponent(name=u'Pad_Modes') self._pad_modes.add_mode( u'drum', LayerMode( self._drum_group, Layer(matrix=u'pads_quadratic', scroll_up_button=u'up_button', scroll_down_button=u'down_button'))) self._pad_modes.add_mode( u'disabled', AddLayerMode( self._background, Layer(matrix=u'pads_quadratic', scroll_up_button=u'up_button', scroll_down_button=u'down_button'))) self._main_modes = ModesComponent(name=u'Encoder_Modes') set_main_mode = partial(setattr, self._main_modes, u'selected_mode') self._main_modes.add_mode(u'device_control', [ partial(self._switch_display_layout, sysex.KNOB_SCREEN_LAYOUT_BYTE), AddLayerMode( self._mixer, Layer(track_select_buttons=u'select_buttons', track_names_display=u'text_display_line_3', track_color_fields=u'color_field_line_2', track_selection_fields=u'selection_field_line_1', selected_track_color_field=u'center_color_field')), LayerMode( self._device_parameters, Layer(parameter_controls=u'encoders', name_display_line=u'text_display_line_0', value_display_line=u'text_display_line_1', parameter_color_fields=u'color_field_line_0', encoder_color_fields=u'encoder_color_fields')), LayerMode( self._session_navigation, Layer(up_button=u'up_button', down_button=u'down_button')), LayerMode( self._device, Layer(prev_bank_button=u'display_up_button', next_bank_button=u'display_down_button')), LayerMode( self._device_navigation, Layer(selected_device_name_display=u'center_display_1', selected_device_bank_name_display=u'center_display_2')), AddLayerMode( self._actions, Layer(actions_display=u'text_display_line_3_with_shift', actions_selection_fields= u'selection_field_line_1_with_shift')) ]) self._main_modes.add_mode( u'options', [ self._encoder_modes, LayerMode( self._encoder_modes, Layer(devices_button=u'select_buttons_raw[0]', pan_button=u'select_buttons_raw[1]', sends_button=u'select_buttons_raw[2]')), SetAttributeMode(self._encoder_modes, u'selected_mode', u'devices'), AddLayerMode( self._background, Layer(select_button_3=u'select_buttons_raw[3]', select_button_4=u'select_buttons_raw[4]', select_button_5=u'select_buttons_raw[5]', select_button_6=u'select_buttons_raw[6]', select_button_7=u'select_buttons_raw[7]')) ], behaviour=ReenterBehaviour( on_reenter=partial(set_main_mode, u'device_control'))) self._main_modes.add_mode(u'grid', [ partial(self._switch_display_layout, sysex.KNOB_SCREEN_LAYOUT_BYTE), self._pad_modes, AddLayerMode( self._mixer, Layer(track_select_buttons=u'select_buttons', track_names_display=u'text_display_line_3', track_color_fields=u'color_field_line_2', track_selection_fields=u'selection_field_line_1', selected_track_color_field=u'center_color_field')), self._select_grid_mode, LayerMode( self._device_parameters, Layer(parameter_controls=u'encoders', name_display_line=u'text_display_line_0', value_display_line=u'text_display_line_1', parameter_color_fields=u'color_field_line_0', encoder_color_fields=u'encoder_color_fields')), LayerMode( self._device, Layer(prev_bank_button=u'display_up_button', next_bank_button=u'display_down_button')), LayerMode( self._device_navigation, Layer(selected_device_name_display=u'center_display_1', selected_device_bank_name_display=u'center_display_2')), AddLayerMode(self._background, Layer(scene_launch_buttons=u'scene_launch_buttons')), AddLayerMode( self._actions, Layer(actions_display=u'text_display_line_3_with_shift', actions_selection_fields= u'selection_field_line_1_with_shift')) ], behaviour=ReenterBehaviour( on_reenter=partial( set_main_mode, u'device_control'))) self._main_modes.layer = Layer(options_button=u'options_button', grid_button=u'grid_button') self._main_modes.selected_mode = u'device_control'
def _create_mixer_modes(self): self._mixer_modes = ModesComponent( name='Mixer_Modes', is_enabled=False, enable_skinning=True, layer=Layer( volume_button=(self._elements.scene_launch_buttons_raw[0]), pan_button=(self._elements.scene_launch_buttons_raw[1]), send_a_button=(self._elements.scene_launch_buttons_raw[2]), send_b_button=(self._elements.scene_launch_buttons_raw[3]), stop_button=(self._elements.scene_launch_buttons_raw[4]), mute_button=(self._elements.scene_launch_buttons_raw[5]), solo_button=(self._elements.scene_launch_buttons_raw[6]), arm_button=(self._elements.scene_launch_buttons_raw[7]))) bottom_row = self._elements.clip_launch_matrix.submatrix[:, 7:8] select_none_mode = partial(setattr, self._mixer_modes, 'selected_mode', 'none') self._mixer_modes.add_mode('none', self._session_layout_mode) button_fader_layout_mode = partial( self._elements.layout_switch.send_value, sysex.FADERS_LAYOUT_BYTE) def add_fader_mode(name, color, is_pan=False): control_dict = {'{}_controls'.format(name): 'button_faders'} if is_pan: control_dict[ 'track_color_controls'] = 'button_fader_color_elements' else: control_dict[ 'static_color_controls'] = 'button_fader_color_elements' self._mixer_modes.add_mode( name, (partial( self._elements.button_fader_setup_element.send_value, sysex.FADER_HORIZONTAL_ORIENTATION if is_pan else sysex.FADER_VERTICAL_ORIENTATION, sysex.FADER_BIPOLAR if is_pan else sysex.FADER_UNIPOLAR), partial(self._mixer.set_static_color_value, color), self._clear_send_cache_of_button_fader_color_elements, AddLayerMode(self._mixer, Layer(**control_dict)), button_fader_layout_mode), behaviour=ReenterBehaviour(on_reenter=select_none_mode)) add_fader_mode('volume', Rgb.GREEN.midi_value) add_fader_mode('pan', 0, True) add_fader_mode('send_a', Rgb.VIOLET.midi_value) add_fader_mode('send_b', Rgb.DARK_BLUE.midi_value) self._mixer_modes.add_mode( 'stop', (self._session_layout_mode, AddLayerMode(self._session, Layer(stop_track_clip_buttons=bottom_row))), behaviour=ReenterBehaviour(on_reenter=select_none_mode)) self._mixer_modes.add_mode( 'mute', (self._session_layout_mode, AddLayerMode(self._mixer, Layer(mute_buttons=bottom_row))), behaviour=ReenterBehaviour(on_reenter=select_none_mode)) self._mixer_modes.add_mode( 'solo', (self._session_layout_mode, AddLayerMode(self._mixer, Layer(solo_buttons=bottom_row))), behaviour=ReenterBehaviour(on_reenter=select_none_mode)) self._mixer_modes.add_mode( 'arm', (self._session_layout_mode, AddLayerMode(self._mixer, Layer(arm_buttons=bottom_row))), behaviour=ReenterBehaviour(on_reenter=select_none_mode)) self._mixer_modes.selected_mode = 'none'