def get_device_component(self, num_params = 8, direct_bank = False, mono = True, shared = False, path = None, delayed_update = False, new_skin = False, *a, **k): self.log('get_device_component: num_params: ' + str(num_params)) if g_strip: self._device_component = DeviceComponent_Strip(self, num_params, direct_bank, mono, shared, path, delayed_update, new_skin, *a, **k) else: self._device_component = DeviceComponent(self, num_params, direct_bank, mono, shared, path, delayed_update, new_skin, *a, **k) return self._device_component
def __init__(self, matrix, top_buttons, side_buttons, config_button, osd, control_surface): #verify matrix dimentions assert isinstance(matrix, ButtonMatrixElement) assert ((matrix.width() == 8) and (matrix.height() == 8)) assert isinstance(top_buttons, tuple) assert (len(top_buttons) == 8) assert isinstance(side_buttons, tuple) assert (len(side_buttons) == 8) assert isinstance(config_button, ButtonElement) ModeSelectorComponent.__init__(self) #super constructor #inject ControlSurface and OSD components (M4L) self._osd = osd self._control_surface = control_surface #initialize index variables self._mode_index = 0 #Inherited from parent self._main_mode_index = 0 #LP original modes self._sub_mode_list = [0, 0, 0, 0] for index in range(4): self._sub_mode_list[index] = 0 self.set_mode_buttons(top_buttons[4:]) if Settings.SESSION__STOP_BUTTONS: #session with bottom stop buttons clip_stop_buttons = [] for column in range(8): clip_stop_buttons.append( matrix.get_button(column, matrix.height() - 1)) self._session = SpecialSessionComponent(matrix.width(), matrix.height() - 1, clip_stop_buttons, self._control_surface, self) else: #no stop buttons self._session = SpecialSessionComponent(matrix.width(), matrix.height(), None, self._control_surface, self) #initialize _session variables self._session.set_osd(self._osd) self._session.name = 'Session_Control' #initialize _zooming variables self._zooming = DeprecatedSessionZoomingComponent(self._session, enable_skinning=True) self._zooming.name = 'Session_Overview' self._zooming.set_empty_value("Default.Button.Off") self._matrix = matrix self._side_buttons = side_buttons #launch buttons self._nav_buttons = top_buttons[:4] #arrow buttons self._config_button = config_button #used to reset launchpad self._all_buttons = [] for button in self._side_buttons + self._nav_buttons: self._all_buttons.append(button) #SubSelector changes the Mode using side buttons (ie. Pan, Volume, Send1, Send2, Stop, Solo, Activate, Arm) self._sub_modes = SubSelectorComponent(matrix, side_buttons, self._session, self._control_surface) self._sub_modes.name = 'Mixer_Modes' self._sub_modes._mixer.set_osd(self._osd) self._sub_modes.set_update_callback(self._update_control_channels) #User2 stepSequencer (Drum & Melodic) self._stepseq = StepSequencerComponent(self._matrix, self._side_buttons, self._nav_buttons, self._control_surface) self._stepseq.set_osd(self._osd) #User2 stepSequencer (Retro style) self._stepseq2 = StepSequencerComponent2(self._matrix, self._side_buttons, self._nav_buttons, self._control_surface) self._stepseq2.set_osd(self._osd) #User1 Instrument controller (Scale) self._instrument_controller = InstrumentControllerComponent( self._matrix, self._side_buttons, self._nav_buttons, self._control_surface) self._instrument_controller.set_osd(self._osd) #self._instrument_controller = None #User1 Device controller (Fx or Instrument parameters) self._device_controller = DeviceComponent( control_surface=self._control_surface, matrix=self._matrix, side_buttons=self._side_buttons, top_buttons=self._nav_buttons) self._device_controller.set_osd(self._osd) self._init_session() self._all_buttons = tuple(self._all_buttons)
def __init__(self, matrix, top_buttons, side_buttons, config_button, osd, control_surface): assert isinstance(matrix, ButtonMatrixElement) assert ((matrix.width() == 8) and (matrix.height() == 8)) assert isinstance(top_buttons, tuple) assert (len(top_buttons) == 8) assert isinstance(side_buttons, tuple) assert (len(side_buttons) == 8) assert isinstance(config_button, ButtonElement) ModeSelectorComponent.__init__(self) self._osd = osd self._control_surface = control_surface self._mode_index = 0 self._previous_mode_index = -1 self._main_mode_index = 0 self._sub_mode_index = [0, 0, 0, 0] for index in range(4): self._sub_mode_index[index] = 0 self.set_mode_buttons(top_buttons[4:]) if Settings.SESSION__STOP_BUTTONS: #session with bottom stop buttons clip_stop_buttons = [] for column in range(8): clip_stop_buttons.append( matrix.get_button(column, matrix.height() - 1)) self._session = SpecialSessionComponent(matrix.width(), matrix.height() - 1, clip_stop_buttons, self._control_surface, self) else: #no stop buttons self._session = SpecialSessionComponent(matrix.width(), matrix.height(), None, self._control_surface, self) self._session.set_osd(self._osd) self._session.name = 'Session_Control' self._zooming = DeprecatedSessionZoomingComponent(self._session, enable_skinning=True) self._zooming.name = 'Session_Overview' self._zooming.set_empty_value("Default.Button.Off") self._matrix = matrix self._side_buttons = side_buttons self._nav_buttons = top_buttons[:4] self._config_button = config_button self._all_buttons = [] for button in self._side_buttons + self._nav_buttons: self._all_buttons.append(button) self._sub_modes = SubSelectorComponent(matrix, side_buttons, self._session, self._control_surface) self._sub_modes.name = 'Mixer_Modes' self._sub_modes._mixer.set_osd(self._osd) self._sub_modes.set_update_callback(self._update_control_channels) self._stepseq = StepSequencerComponent(self._matrix, self._side_buttons, self._nav_buttons, self._control_surface) self._stepseq.set_osd(self._osd) self._stepseq2 = StepSequencerComponent2(self._matrix, self._side_buttons, self._nav_buttons, self._control_surface) self._stepseq2.set_osd(self._osd) self._instrument_controller = InstrumentControllerComponent( self._matrix, self._side_buttons, self._nav_buttons, self._control_surface) self._instrument_controller.set_osd(self._osd) #self._instrument_controller = None self._device_controller = DeviceComponent( control_surface=self._control_surface, matrix=self._matrix, side_buttons=self._side_buttons, top_buttons=self._nav_buttons) self._device_controller.set_osd(self._osd) self._init_session() self._all_buttons = tuple(self._all_buttons)
def _create_device(self): self.log('_create_device', True) def make_button(identifier, name, midi_type=MIDI_CC_TYPE, skin=self._default_skin): return ButtonElement(True, midi_type, MIXER_MODE, identifier, name=name, skin=skin) def make_encoder(identifier, name, bit_14=True): if self._bit_14: self.log('make_encoder: ' + name + ', CC: ' + str(identifier) + ', 14_bit: ' + str(bit_14)) control = EncoderElement( MIDI_CC_TYPE, MIXER_MODE, identifier, Live.MidiMap.MapMode.absolute_14_bit if bit_14 else Live.MidiMap.MapMode.absolute, name=name) else: control = EncoderElement( MIDI_CC_TYPE, MIXER_MODE, identifier, Live.MidiMap.MapMode.absolute if not self._relative else Live.MidiMap.MapMode.relative_two_compliment, name=name) return control if self._bit_14: volume_cc = 0 sends_cc = 8 else: volume_cc = 1 sends_cc = 81 if self._use_32: self._device_encoders = ButtonMatrixElement( rows=[[ make_encoder(volume_cc + i, 'Volume_%d' % (i + 1)) for i in xrange(8) ], [ make_encoder(sends_cc + i, 'BCR_Device_0_%d' % (i + 1)) for i in xrange(8) ], [ make_encoder(sends_cc + 8 + i, 'BCR_Device_1_%d' % (i + 1)) for i in xrange(8) ], [ make_encoder(sends_cc + 16 + i, 'BCR_Device_2_%d' % (i + 1)) for i in xrange(8) ]]) self._send_encoders = self._device_encoders.submatrix[:8, 1:4] else: self._device_encoders = self._send_encoders if self._channel_strip: self._device = DeviceComponent_Strip( self, name='XL_Device', is_enabled=True, direct_bank=self._direct_bank, num_params=32 if self._use_32 else 24, path=self._my_path, delayed_update=True) else: self._device = DeviceComponent( self, name='XL_Device', is_enabled=True, direct_bank=self._direct_bank, num_params=32 if self._use_32 else 24, path=self._my_path, delayed_update=True) self.set_preditor_device_component(self._device) if self._direct_bank: device_layer = Layer(parameter_controls=self._device_encoders, device_select=self._top_buttons, device_enable=self._bottom_buttons, device_lock_button=self._track_fold_button, bank_up_button=self._bank_down_button, bank_down_button=self._bank_up_button, direct_bank=self._direct_bank_buttons) else: device_layer = Layer(parameter_controls=self._device_encoders, device_select=self._top_buttons, device_enable=self._bottom_buttons, device_lock_button=self._track_fold_button, bank_up_button=self._bank_down_button, bank_down_button=self._bank_up_button) device_settings_layer = Layer() self.device_mode = DeviceModeComponent(script=self, component=self._device, device_settings_mode=[ AddLayerMode( self._device, device_settings_layer) ], is_enabled=True) self.device_mode.layer = Layer( device_mode_button=self._device_engage_button) if self._has_pans: mixer_layer = Layer(volume_controls=self._volume_encoders, pan_controls=self._pan_encoders) else: mixer_layer = Layer(volume_controls=self._volume_encoders) self._modes.add_mode('device', [ AddLayerMode(self._device, device_layer), AddLayerMode(self._mixer, mixer_layer) ]) if self._channel_strip: if hasattr(self._device, 'enable_channel_strip'): strip_layer = Layer(parameter_controls=self._device_encoders) valid_opts = self._get_button_options(True) mixer_layer += Layer(**valid_opts) self._modes.add_mode('device_strip', [ AddLayerMode(self._device, strip_layer), AddLayerMode(self._mixer, mixer_layer), AddLayerMode( self._session, Layer(track_bank_left_button=self._left_button, track_bank_right_button=self._right_button)) ]) else: self._channel_strip = False