def _init_device(self): make_button = partial(make_launch_control_button, channel=10) make_encoder = partial(make_launch_control_encoder, channel=10) bottom_encoders, top_encoders = make_all_encoders( 'Device', make_encoder) parameter_controls = top_encoders[:4] + bottom_encoders[:4] bank_buttons = [ make_button(identifier, 'Device_Bank_Button_' + str(i), is_pad=True) for i, identifier in enumerate(pad_identifiers) ] for button in bank_buttons: button.set_on_off_values(Colors.LED_ON, Colors.LED_OFF) self._device_bank_registry = DeviceBankRegistry() self._device = DeviceComponent( device_bank_registry=self._device_bank_registry, name='Device') self._device.set_enabled(False) self._device.layer = Layer( parameter_controls=ButtonMatrixElement(rows=[parameter_controls]), bank_buttons=ButtonMatrixElement(rows=[bank_buttons])) self.set_device_component(self._device) self._device_navigation = DeviceNavigationComponent() self._device_navigation.set_enabled(False) self._device_navigation.name = 'Device_Navigation' self._device_navigation.layer = Layer( next_device_button=make_button(115, 'Next_Device_Button'), previous_device_button=make_button(114, 'Prev_Device_Button')) self._view_control = ViewControlComponent() self._view_control.set_enabled(False) self._view_control.name = 'View_Control' self._view_control.layer = Layer( next_track_button=make_button(117, 'Device_Next_Track_Button'), prev_track_button=make_button(116, 'Device_Prev_Track_Button'))
def _create_controls(self): make_color_button = partial(make_button, skin=self._skin) self._shift_button = make_button(0, 81, name='Shift_Button', num = 0, cs = self) self._matrix = ButtonMatrixElement(name='Button_Matrix') self._scene_launch_buttons_raw = [ make_color_button(0, index + 82, name='Scene_%d_Launch_Button' % index, num = index, cs = self) for index in xrange(SESSION_HEIGHT) ] self._track_stop_buttons = [ make_color_button(index, 52, name='Track_%d_Stop_Button' % index, num = index, cs = self) for index in xrange(SESSION_WIDTH) ] self._matrix_rows_raw = [] for scene_index in xrange(SESSION_HEIGHT): row = [ make_color_button(track_index, scene_index + 53, name='%d_Clip_%d_Button' % (track_index, scene_index), num = index, cs = self) for track_index in xrange(SESSION_WIDTH) ] self._matrix_rows_raw.append(row) self._matrix.add_row(row) self._selected_scene_launch_button = make_pedal_button(64, name='Selected_Scene_Launch_Button') self._scene_launch_buttons = ButtonMatrixElement(rows=[self._scene_launch_buttons_raw]) self._solo_buttons = [ make_button(track_index, 49, name='%d_Solo_Button' % track_index, num = track_index, cs = self) for track_index in xrange(MIXER_SIZE) ] self._mute_buttons = [ make_button(track_index, 50, name='%d_Mute_Button' % track_index, num = track_index, cs = self) for track_index in xrange(MIXER_SIZE) ] self._master_volume_control = make_slider(0, 14, name='Master_Volume_Control', num = 0, script = self) self._prehear_control = EncoderElement(MIDI_CC_TYPE, 0, 47, MapMode.relative_two_compliment, name='Prehear_Volume_Control', num = 0, script = self) self._master_select_button = make_button(0, 80, name='Master_Select_Button', num = index, cs = self) self._select_buttons = [ make_button(track_index, 51, name='%d_Select_Button' % track_index, num = track_index, cs = self ) for track_index in xrange(8) ] self._arm_buttons = [ make_button(track_index, 48, name='%d_Arm_Button' % track_index, num = track_index, cs = self) for track_index in xrange(8) ] self._sliders = [ make_slider(track_index, 7, name='%d_Volume_Control' % track_index, num = track_index, script = self) for track_index in xrange(8) ] self._monomod = ButtonMatrixElement(name = 'Monomod') for row in self._matrix_rows_raw: self._monomod.add_row(row) self._monomod.add_row(self._track_stop_buttons) self._monomod.add_row(self._select_buttons) self._monomod.add_row(self._mute_buttons) self._setup_monobridge() #had to put this here b/c the original author foolishly placed assignment methods inside of creation methods...argh.
def _setup_controls(self): is_momentary = True self._button = [ MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, FADERFOX_BUTTONS[index], name='Button_' + str(index), script=self, skin=self._skin, color_map=COLOR_MAP) for index in range(4) ] self._encoder = [ CodecEncoderElement(MIDI_CC_TYPE, CHANNEL, FADERFOX_ENCODERS[index], Live.MidiMap.MapMode.absolute, 'Encoder_' + str(index), FADERFOX_ENCODERS[index], self) for index in range(4) ] self._encoder_matrix = ButtonMatrixElement(name='Encoder_Matrix', rows=[self._encoder]) self._button_matrix = ButtonMatrixElement(name='Button_Matrix', rows=[self._button[2:]])
def _create_controls(self): make_color_button = partial(make_button, skin=self._skin) self._shift_button = make_button(0, 81, name='Shift_Button') self._matrix = ButtonMatrixElement(name='Button_Matrix') self._scene_launch_buttons = [ make_color_button(0, index + 82, name='Scene_%d_Launch_Button' % index) for index in xrange(SESSION_HEIGHT) ] self._track_stop_buttons = [ make_color_button(index, 52, name='Track_%d_Stop_Button' % index) for index in xrange(SESSION_WIDTH) ] for scene_index in xrange(SESSION_HEIGHT): row = [ make_color_button(track_index, scene_index + 53, name='%d_Clip_%d_Button' % (track_index, scene_index)) for track_index in xrange(SESSION_WIDTH) ] self._matrix.add_row(row) self._selected_scene_launch_button = make_pedal_button(64, name='Selected_Scene_Launch_Button') self._scene_launch_buttons = ButtonMatrixElement(name='Scene_Launch_Buttons', rows=[self._scene_launch_buttons]) self._solo_buttons = [ make_button(track_index, 49, name='%d_Solo_Button' % track_index) for track_index in xrange(MIXER_SIZE) ] self._mute_buttons = [ make_button(track_index, 50, name='%d_Mute_Button' % track_index) for track_index in xrange(MIXER_SIZE) ] self._master_volume_control = make_slider(0, 14, name='Master_Volume_Control') self._prehear_control = EncoderElement(MIDI_CC_TYPE, 0, 47, MapMode.relative_two_compliment, name='Prehear_Volume_Control') self._master_select_button = make_button(0, 80, name='Master_Select_Button') self._select_buttons = [ make_button(track_index, 51, name='%d_Select_Button' % track_index) for track_index in xrange(8) ] self._arm_buttons = [ make_button(track_index, 48, name='%d_Arm_Button' % track_index) for track_index in xrange(8) ] self._sliders = [ make_slider(track_index, 7, name='%d_Volume_Control' % track_index) for track_index in xrange(8) ] self._note_matrix = ButtonMatrixElement(name='Note_Button_Matrix') self._note_buttons = [ [ make_button(9, note + i, name='Note_%d_Button' % (note + i)) for i in xrange(4) ] for note in xrange(36, 75, 4) ] for row in self._note_buttons: for button in row: button.send_depends_on_forwarding = False self._note_matrix.add_row(row)
def _setup_session_control(self): is_momentary = True self._session = SpecialSessionComponent(NUM_TRACKS, NUM_SCENES) self._session.set_serato_interface(self._serato_interface) self._matrix = ButtonMatrixElement() self._scene_launch_buttons = [ ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 0) for index in range(NUM_SCENES) ] self._track_stop_buttons = [ ButtonElement(not is_momentary, MIDI_NOTE_TYPE, 0, 0) for index in range(NUM_TRACKS) ] stop_all_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 0) self._session.set_stop_all_clips_button(stop_all_button) self._session.set_stop_track_clip_buttons( tuple(self._track_stop_buttons)) for scene_index in range(NUM_SCENES): scene = self._session.scene(scene_index) button_row = [] scene.set_launch_button(self._scene_launch_buttons[scene_index]) scene.set_index(scene_index) scene.set_serato_interface(self._serato_interface) for track_index in range(NUM_TRACKS): button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 0) button_row.append(button) clip_slot = scene.clip_slot(track_index) clip_slot.set_launch_button(button) clip_slot.set_serato_interface(self._serato_interface) self._matrix.add_row(tuple(button_row))
def _setup_controls(self): self._pedal = [None for index in range(8)] for index in range(7): self._pedal[index] = DoublePressElement(MonoButtonElement(True, MIDI_CC_TYPE, 0, PEDAL_DEFS[index], 'Pedal_'+str(index), self)) #is_momentary, MIDI_NOTE_TYPE, CHANNEL, LIVID, 'Livid_Button', self self._pedal[index].name = 'Pedal_'+str(index) self._pedal[index]._report = False self._pedal[7] = LoopPedalExpressionElement(self, MIDI_CC_TYPE, 0, 1, Live.MidiMap.MapMode.absolute) self._pedal[7].name = 'Pedal_'+str(7) self._pedal[7]._report = False self._leds = [None for index in range(4)] for index in range(4): red_led = ButtonElement(True, MIDI_NOTE_TYPE, 0, LED_DEFS[index]) green_led = ButtonElement(True, MIDI_NOTE_TYPE, 0, LED_DEFS[index]+4) blue_led = ButtonElement(True, MIDI_NOTE_TYPE, 0, LED_DEFS[index]+8) self._leds[index] = RGB_LED(red_led, green_led, blue_led, True, MIDI_NOTE_TYPE, 0, index+13, 'LED_' + str(index), self) self._select_buttons = ButtonMatrixElement() self._select_buttons.name = 'SelectMatrix' self._select_buttons.add_row([self._pedal[6], self._pedal[5], self._pedal[4], self._pedal[3]]) self._doublepress_select_buttons = ButtonMatrixElement() self._doublepress_select_buttons.name = 'DoublepressSelectMatrix' self._doublepress_select_buttons.add_row([self._pedal[6].double_press, self._pedal[5].double_press, self._pedal[4].double_press, self._pedal[3].double_press]) self._record_button = self._pedal[1] self._mute_button = self._pedal[2] self._overdub_button = self._pedal[0]
def _setup_session_control(self): is_momentary = True self._shift_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 81) self._session = APCSessionComponent(8, 5) self._session.name = 'Session_Control' self._matrix = ButtonMatrixElement() self._matrix.name = 'Button_Matrix' scene_launch_buttons = [ ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, index + 82) for index in range(5) ] track_stop_buttons = [ ButtonElement(is_momentary, MIDI_NOTE_TYPE, index, 52) for index in range(8) ] for index in range(len(scene_launch_buttons)): scene_launch_buttons[index].name = 'Scene_' + str( index) + '_Launch_Button' for index in range(len(track_stop_buttons)): track_stop_buttons[index].name = 'Track_' + str( index) + '_Stop_Button' self._session.set_stop_track_clip_buttons(tuple(track_stop_buttons)) self._session.set_stop_track_clip_value(2) for scene_index in range(5): scene = self._session.scene(scene_index) scene.name = 'Scene_' + str(scene_index) button_row = [] scene.set_launch_button(scene_launch_buttons[scene_index]) scene.set_triggered_value(2) for track_index in range(8): button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, track_index, scene_index + 53) button.name = str(track_index) + '_Clip_' + str( scene_index) + '_Button' button_row.append(button) clip_slot = scene.clip_slot(track_index) clip_slot.name = str(track_index) + '_Clip_Slot_' + str( scene_index) clip_slot.set_triggered_to_play_value(2) clip_slot.set_triggered_to_record_value(4) clip_slot.set_stopped_value(5) clip_slot.set_started_value(1) clip_slot.set_recording_value(3) clip_slot.set_launch_button(button) self._matrix.add_row(tuple(button_row)) self._session.selected_scene().name = 'Selected_Scene' self._session.selected_scene().set_launch_button( ButtonElement(is_momentary, MIDI_CC_TYPE, 0, 64)) self._session_zoom = ShiftableZoomingComponent( self._session, tuple(track_stop_buttons)) self._session_zoom.name = 'Session_Overview' self._session_zoom.set_button_matrix(self._matrix) self._session_zoom.set_zoom_button(self._shift_button) self._session_zoom.set_scene_bank_buttons(tuple(scene_launch_buttons)) self._session_zoom.set_stopped_value(3) self._session_zoom.set_selected_value(5)
def setup_session(self): num_tracks = 7 num_scenes = 1 track_offset = 0 scene_offset = 0 # elements self.clip_launch_buttons = ButtonMatrixElement(rows=[[ ButtonElement(True, MIDI_NOTE_TYPE, 0, 76 + i) for i in range(num_tracks) ]]) self.clip_stop_buttons = [ ButtonElement(True, MIDI_NOTE_TYPE, 0, 68 + i) for i in range(num_tracks) ] self.scene_launch_buttons = ButtonMatrixElement(rows=[[ ButtonElement(True, MIDI_NOTE_TYPE, 0, 83 + i) for i in range(num_scenes) ]]) self.scene_stop_button = ButtonElement(True, MIDI_NOTE_TYPE, 0, 75) self.session_scene_nav_encoder = EncoderElement( MIDI_CC_TYPE, 0, 15, Live.MidiMap.MapMode.relative_binary_offset) # session self.session = SessionComponent(num_tracks, num_scenes) self.session.set_offsets(track_offset, scene_offset) self.session.add_offset_listener(self.on_session_offset_changed) self.set_highlighting_session_component(self.session) # clips self.session.set_clip_launch_buttons(self.clip_launch_buttons) self.session.set_stop_track_clip_buttons(self.clip_stop_buttons) self.session.set_scene_launch_buttons(self.scene_launch_buttons) self.session.set_stop_all_clips_button(self.scene_stop_button) # nav self.session_scene_nav_encoder.add_value_listener( self.on_session_scene_nav)
def _setup_controls(self): is_momentary = True self._monomod256 = ButtonMatrixElement() self._monomod256.name = 'Monomod256' self._square = [None for index in range(16)] for column in range(16): self._square[column] = [None for index in range(16)] for row in range(16): self._square[column][row] = OSCMonoButtonElement(is_momentary, MIDI_NOTE_TYPE, int(column/8) + 1, row + ((column%8) * 16), '256Grid_' + str(column) + '_' + str(row), self, osc = '/Grid_'+str(column)+'_'+str(row), osc_alt = '/Grid/set '+str(column)+' '+str(row), osc_name = None) for row in range(16): button_row = [] button_row2 =[] for column in range(16): button_row.append(self._square[column][row]) self._monomod256.add_row(tuple(button_row)) self._key_buttons = ButtonMatrixElement() self._bank_button = [None for index in range(2)] for index in range(2): self._bank_button[index] = OSCMonoButtonElement(is_momentary, MIDI_NOTE_TYPE, 15, index, '256Grid_Bank_' + str(index), self, osc = '/Shift_'+str(index), osc_alt = '/Shift/set '+str(index), osc_name = None) button_row = [] self._key_button = [None for index in range(8)] for index in range(8): self._key_button[index] = OSCMonoButtonElement(is_momentary, MIDI_NOTE_TYPE, 15, index+8, '256Grid_Key_' + str(index), self, osc = '/Keys_'+str(index), osc_alt = '/Keys/set '+str(index), osc_name = None) for index in range(8): button_row.append(self._key_button[index]) self._key_buttons.add_row(tuple(button_row))
def _setup_controls(self): faders = [ SliderElement(msg_type=MIDI_CC_TYPE, channel=FADER_CHANNEL, identifier=FADER_CC_START + idx) for idx in range(FADER_COUNT) ] buttons = [ ButtonElement(is_momentary=False, msg_type=MIDI_CC_TYPE, channel=BUTTON_CHANNEL, identifier=BUTTON_CC_START + idx) for idx in range(BUTTON_COUNT) ] self._faders = ButtonMatrixElement([faders]) self._buttons = ButtonMatrixElement([buttons]) self._backward_button = ButtonElement(True, MIDI_CC_TYPE, TRANSPORT_CHANNEL, TRANSPORT_BACKWARD) self._forward_button = ButtonElement(True, MIDI_CC_TYPE, TRANSPORT_CHANNEL, TRANSPORT_FORWARD) self._stop_button = ButtonElement(True, MIDI_CC_TYPE, TRANSPORT_CHANNEL, TRANSPORT_STOP) self._play_button = ButtonElement(True, MIDI_CC_TYPE, TRANSPORT_CHANNEL, TRANSPORT_PLAY) self._record_button = ButtonElement(True, MIDI_CC_TYPE, TRANSPORT_CHANNEL, TRANSPORT_RECORD) self._loop_button = ButtonElement(True, MIDI_CC_TYPE, TRANSPORT_CHANNEL, TRANSPORT_LOOP)
def _setup_controls(self): is_momentary = True self._monomod256 = ButtonMatrixElement() self._monomod256.name = 'Monomod256' self._square = [None for index in range(16)] for column in range(16): self._square[column] = [None for index in range(16)] for row in range(16): self._square[column][row] = OSCFlashingButtonElement(is_momentary, MIDI_NOTE_TYPE, int(column/8) + 1, row + ((column%8) * 16), '256Grid_' + str(column) + '_' + str(row), '/1/p_grid/'+str(column)+'/'+str(row), '/1/c_grid/'+str(column)+'/'+str(row), None, self) for row in range(16): button_row = [] for column in range(16): button_row.append(self._square[column][row]) self._monomod256.add_row(tuple(button_row)) #self._bank_buttons = ButtonMatrixElement() self._key_buttons = ButtonMatrixElement() self._bank_button = [None for index in range(2)] for index in range(2): self._bank_button[index] = OSCFlashingButtonElement(is_momentary, MIDI_NOTE_TYPE, 15, index, '256Grid_Bank_' + str(index), '/1/p_a/'+str(index), '/1/c_a/'+str(index), None, self) #button_row = [] #for index in range(2): # button_row.append(self._bank_button[index]) #self._bank_buttons.add_row(tuple(button_row)) button_row = [] self._key_button = [None for index in range(8)] for index in range(8): self._key_button[index] = OSCFlashingButtonElement(is_momentary, MIDI_NOTE_TYPE, 15, index+8, '256Grid_Key_' + str(index), '/1/p_s/'+str(index), '/1/c_s/'+str(index), None, self) for index in range(8): button_row.append(self._key_button[index]) self._key_buttons.add_row(tuple(button_row))
def __init__(self, matrix, session, zooming, stop_buttons, parent): assert isinstance(matrix, ButtonMatrixElement) ModeSelectorComponent.__init__(self) self._controls = None self._session = session self._session_zoom = zooming self._matrix = matrix self._track_stop_buttons = stop_buttons self._stop_button_matrix = ButtonMatrixElement( ) #new dummy matrix for stop buttons, to allow note mode/user mode switching button_row = [] for track_index in range(8): button = self._track_stop_buttons[track_index] button_row.append(button) self._stop_button_matrix.add_row(tuple(button_row)) self._nav_left_button = None self._nav_right_button = None self._mode_index = 0 self._last_mode = 0 self._parent = parent self._parent.set_pad_translations( PAD_TRANSLATIONS) #comment out to remove Drum Rack mapping self._vu = None self._shift_button = self._parent._shift_button self._shift_button.add_value_listener(self._shift_value)
def _create_controls(self): self._pad_leds = ButtonMatrixElement(rows=[[ SysexValueControl(message_prefix=SETUP_MSG_PREFIX + (WRITE_COMMAND, WORKING_MEMORY_ID, COLOR_PROPERTY, column + 112 + row * 8), default_value=(0, ), name='Pad_LED_%d' % (column, )) for column in xrange(8) ] for row in xrange(pages)], name='Pad_LED_Matrix') self._device_controls = ButtonMatrixElement(rows=[[ EncoderElement(MIDI_CC_TYPE, self.encoder_msg_channel, identifier, Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Encoder_%d_%d' % (column_index, row_index)) for column_index, identifier in enumerate(row) ] for row_index, row in enumerate((self.encoder_msg_ids[1:5], self.encoder_msg_ids[9:13]))]) self._horizontal_scroll_encoder = EncoderElement( MIDI_CC_TYPE, self.encoder_msg_channel, self.encoder_msg_ids[0], Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Horizontal_Scroll_Encoder') self._vertical_scroll_encoder = EncoderElement( MIDI_CC_TYPE, self.encoder_msg_channel, self.encoder_msg_ids[8], Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Vertical_Scroll_Encoder') pass
def _setup_controls(self): is_momentary = True self._monomod256 = ButtonMatrixElement() self._monomod256.name = "Monomod256" self._square = [None for index in range(16)] for column in range(16): self._square[column] = [None for index in range(16)] for row in range(16): self._square[column][row] = OSCFlashingButtonElement( is_momentary, MIDI_NOTE_TYPE, int(column / 8) + 1, row + ((column % 8) * 16), "256Grid_" + str(column) + "_" + str(row), "/Grid_" + str(column) + "_" + str(row), "/Grid/set " + str(column) + " " + str(row), None, self, ) for row in range(16): button_row = [] for column in range(16): button_row.append(self._square[column][row]) self._monomod256.add_row(tuple(button_row)) # self._bank_buttons = ButtonMatrixElement() self._key_buttons = ButtonMatrixElement() self._bank_button = [None for index in range(2)] for index in range(2): self._bank_button[index] = OSCFlashingButtonElement( is_momentary, MIDI_NOTE_TYPE, 15, index, "256Grid_Bank_" + str(index), "/Shift_" + str(index), "/Shift/set " + str(index), None, self, ) # button_row = [] # for index in range(2): # button_row.append(self._bank_button[index]) # self._bank_buttons.add_row(tuple(button_row)) button_row = [] self._key_button = [None for index in range(8)] for index in range(8): self._key_button[index] = OSCFlashingButtonElement( is_momentary, MIDI_NOTE_TYPE, 15, index + 8, "256Grid_Key_" + str(index), "/Keys_" + str(index), "/Keys/set " + str(index), None, self, ) for index in range(8): button_row.append(self._key_button[index]) self._key_buttons.add_row(tuple(button_row))
def _setup_controls(self): is_momentary = True self._dial = [None for index in range(DIALCOUNT)] self._trackbtns = [None for index in range(8)] self._modebtns = [None for index in range(5)] for index in range(DIALCOUNT): self._dial[index] = EncoderElement(MIDI_CC_TYPE, CH, matrix_nums[index], Live.MidiMap.MapMode.absolute) self._dial[index].name = 'Dial_' + str(index) self._dial[index].set_feedback_delay(-1) for index in range(8): self._trackbtns[index] = ButtonElement(is_momentary, MIDI_NOTE_TYPE, CH, track_select_notes[index]) self._trackbtns[index].name = 'Button_' + str(index) for index in range(5): self._modebtns[index] = ButtonElement(is_momentary, MIDI_NOTE_TYPE, CH, mode_select_notes[index]) self._modebtns[index].name = 'ModeButton_' + str(index) self._matrix = ButtonMatrixElement() self._matrix.name = 'Matrix' self._grid = [None for index in range(COLS)] for column in range(COLS): self._grid[column] = [None for index in range(COLS)] for row in range(ROWS): nn = 1+(column * ROWS) + row self._grid[column][row] = ButtonElement(is_momentary, MIDI_NOTE_TYPE, CH, nn) #comment out if you don't want clip launch self._grid[column][row].name = 'Grid_' + str(column) + '_' + str(row) for row in range(ROWS): button_row = [] for column in range(COLS): button_row.append(self._grid[column][row]) self._matrix.add_row(tuple(button_row))
def _set_up_session(self, mode_selector): is_momentary = True self._session = MaschineSessionComponent() self._session.set_color_manager(mode_selector.get_color_manager()) self.nav_buttons = ( self.create_gated_button(92, COLOR_HUE_NAV), self.create_gated_button(81, COLOR_HUE_NAV), self.create_gated_button(93, COLOR_HUE_NAV), self.create_gated_button(91, COLOR_HUE_NAV)) self._session.set_scene_bank_buttons(self.nav_buttons[0], self.nav_buttons[1]) self._session.set_track_bank_buttons(self.nav_buttons[2], self.nav_buttons[3]) track_stop_buttons = [ StateButton(is_momentary, MIDI_CC_TYPE, BASIC_CHANNEL, index + STOP_CC_OFF) for index in range(4) ] self._session.set_stop_track_clip_buttons(tuple(track_stop_buttons)) self._matrix = [] self._bmatrix = ButtonMatrixElement() for scene_index in range(4): button_row = [] for track_index in range(4): button = self.create_pad_button(scene_index, track_index, mode_selector) button_row.append(button) self._matrix.append(tuple(button_row)) self._bmatrix.add_row(tuple(button_row)) self._session.set_matrix(self._matrix) for button, (track_index, scene_index) in self._bmatrix.iterbuttons(): if button: scene = self._session.scene(scene_index) clip_slot = scene.clip_slot(track_index) clip_slot.set_launch_button(button) clip_slot.set_triggered_to_play_value(1) clip_slot.set_triggered_to_record_value(1) clip_slot.set_started_value(1) clip_slot.set_recording_value(1) clip_slot.set_stopped_value(1) self._session._link()
def _setup_controls(self): is_momentary = True self._monomod256 = ButtonMatrixElement() self._monomod256.name = 'Monomod256' self._square = [None for index in range(16)] for column in range(16): self._square[column] = [None for index in range(16)] for row in range(16): self._square[column][row] = OSCFlashingButtonElement(is_momentary, MIDI_NOTE_TYPE, int(column/8) + 1, row + ((column%8) * 16), '256Grid_' + str(column) + '_' + str(row), '/Grid_'+str(column)+'_'+str(row), '/Grid/set '+str(column)+' '+str(row), None, self) for row in range(16): button_row = [] for column in range(16): button_row.append(self._square[column][row]) self._monomod256.add_row(tuple(button_row)) #self._bank_buttons = ButtonMatrixElement() self._key_buttons = ButtonMatrixElement() self._bank_button = [None for index in range(2)] for index in range(2): self._bank_button[index] = OSCFlashingButtonElement(is_momentary, MIDI_NOTE_TYPE, 15, index, '256Grid_Bank_' + str(index), '/Shift_'+str(index), '/Shift/set '+str(index), None, self) #button_row = [] #for index in range(2): # button_row.append(self._bank_button[index]) #self._bank_buttons.add_row(tuple(button_row)) button_row = [] self._key_button = [None for index in range(8)] for index in range(8): self._key_button[index] = OSCFlashingButtonElement(is_momentary, MIDI_NOTE_TYPE, 15, index+8, '256Grid_Key_' + str(index), '/Keys_'+str(index), '/Keys/set '+str(index), None, self) for index in range(8): button_row.append(self._key_button[index]) self._key_buttons.add_row(tuple(button_row))
def __init__(self, *a, **k): super(Advance, self).__init__(*a, **k) with self.component_guard(): encoders = ButtonMatrixElement(rows=[[ make_encoder(index + 22, b'Encoder_%d' % index) for index in xrange(8) ]]) pads = ButtonMatrixElement(rows=[[ make_button(identifier, b'Pad_%d_%d' % (col, row)) for col, identifier in enumerate(row_ids) ] for row, row_ids in enumerate(PAD_IDS)]) device = DeviceComponent( is_enabled=False, layer=Layer(parameter_controls=encoders), device_selection_follows_track_selection=True) device.set_enabled(True) self.set_device_component(device) drums = DrumRackComponent(is_enabled=False, layer=Layer(pads=pads)) drums.set_enabled(True) play_button = make_button(118, b'Play_Button', MIDI_CC_TYPE, 0) stop_button = make_button(117, b'Stop_Button', MIDI_CC_TYPE, 0) record_button = make_button(119, b'Record_Button', MIDI_CC_TYPE, 0) loop_button = make_button(114, b'Loop_Button', MIDI_CC_TYPE, 0) transport = TransportComponent(is_enabled=False, layer=Layer( play_button=play_button, stop_button=stop_button, record_button=record_button, loop_button=loop_button)) transport.set_enabled(True)
def _setup_controls(self): is_momentary = True self._fader = [ None for index in range(8) ] self._dial = [ None for index in range(16) ] self._button = [ None for index in range(8) ] self._menu = [ None for index in range(6) ] for index in range(8): self._fader[index] = MonoEncoderElement(MIDI_CC_TYPE, CHANNEL, OHM_FADERS[index], Live.MidiMap.MapMode.absolute, 'Fader_' + str(index), index, self) for index in range(8): self._button[index] = MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, OHM_BUTTONS[index], 'Button_' + str(index), self) for index in range(16): self._dial[index] = MonoEncoderElement(MIDI_CC_TYPE, CHANNEL, OHM_DIALS[index], Live.MidiMap.MapMode.absolute, 'Encoder_' + str(index), index, self) self._knobs = [] for index in range(12): self._knobs.append(self._dial[index]) for index in range(6): self._menu[index] = MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, OHM_MENU[index], 'Menu_' + str(index), self) self._crossfader = EncoderElement(MIDI_CC_TYPE, CHANNEL, CROSSFADER, Live.MidiMap.MapMode.absolute) self._crossfader.name = 'Crossfader' self._livid = MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, LIVID, 'Livid_Button', self) self._shift_l = MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, SHIFT_L, 'Page_Button_Left', self) self._shift_r = MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, SHIFT_R, 'Page_Button_Right', self) self._matrix = ButtonMatrixElement() self._matrix.name = 'Matrix' self._grid = [ None for index in range(8) ] self._monomod = ButtonMatrixElement() self._monomod.name = 'Monomod' for column in range(8): self._grid[column] = [ None for index in range(8) ] for row in range(8): self._grid[column][row] = MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, column * 8 + row, 'Grid_' + str(column) + '_' + str(row), self) for row in range(5): button_row = [] for column in range(7): button_row.append(self._grid[column][row]) self._matrix.add_row(tuple(button_row)) for row in range(8): button_row = [] for column in range(8): button_row.append(self._grid[column][row]) self._monomod.add_row(tuple(button_row)) self._dial_matrix = ButtonMatrixElement() for row in range(3): dial_row = [] for column in range(4): dial_row.append(self._dial[column + (row*4)]) self._dial_matrix.add_row(tuple(dial_row)) self._menu_matrix = ButtonMatrixElement([self._menu])
def __init__(self, c_instance): ControlSurface.__init__(self, c_instance) self._monomod_version = 'b994' self.hosts = [] self._host_name = 'BlockPad' self._color_type = 'Monochrome' self._timer = 0 is_momentary = True self._suggested_input_port = 'block (Controls)' self._suggested_output_port = 'block (Controls)' self._wrote_user_byte = False matrix = ButtonMatrixElement() for row in range(8): button_row = [ FlashingButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, ((column * 8) + row), 'Button_'+str(column)+'_'+str(row), self) for column in range(8) ] matrix.add_row(tuple(button_row)) knobs = [ EncoderElement(MIDI_CC_TYPE, 0, KNOB_CC[index], Live.MidiMap.MapMode.absolute) for index in range(8) ] sliders = [ EncoderElement(MIDI_CC_TYPE, 0, SLIDER_CC[index], Live.MidiMap.MapMode.absolute) for index in range(2) ] self._config_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 0, 0) self._config_button.add_value_listener(self._config_value) top_buttons = [ FlashingButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, TOP_NOTES[index], 'Top_Button'+str(index), self) for index in range(8) ] side_buttons = [ FlashingButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, SIDE_NOTES[index], 'Side_Button'+str(index), self) for index in range(8) ] self._setup_monobridge() self._setup_monomod() self._selector = MainSelectorComponent(matrix, tuple(top_buttons), tuple(side_buttons), self._config_button, tuple(knobs), tuple(sliders), self) self._user_byte_write_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 0, 16) self._user_byte_value(1) self._user_byte_write_button.add_value_listener(self._user_byte_value) self.set_enabled(True) self.log_message("--------------= BlockPad log opened =--------------") #Create entry in log file self.refresh_state()
def _setup_controls(self): knobs = [[self._make_knob(row, col) for col in range(4)] for row in range(4)] buttons = [[self._make_button(row, col) for col in range(4)] for row in range(4)] self._knobs = ButtonMatrixElement(knobs) self._buttons = ButtonMatrixElement(buttons)
def _create_controls(self): super(MPD226, self)._create_controls() self._encoders = ButtonMatrixElement(rows=[[ make_encoder(identifier, 0 if index < 4 else 1, 'Encoder_%d' % index) for index, identifier in izip(xrange(8), cycle(xrange(22, 26))) ]]) self._sliders = ButtonMatrixElement(rows=[[ make_slider(identifier, 0 if index < 4 else 1, 'Slider_%d' % index) for index, identifier in izip(xrange(8), cycle(xrange(12, 16))) ]]) self._control_buttons = ButtonMatrixElement(rows=[[ make_button(identifier, 0 if index < 4 else 1, 'Control_Button_%d' % index) for index, identifier in izip(xrange(8), cycle(xrange(32, 36))) ]]) self._play_button = make_button(118, 0, 'Play_Button') self._stop_button = make_button(117, 0, 'Stop_Button') self._record_button = make_button(119, 0, 'Record_Button')
def _create_controls(self): self._create_pads() self._encoders = ButtonMatrixElement(rows=[[ make_encoder(identifier, 0, 'Encoder_%d' % index) for index, identifier in enumerate(xrange(22, 30)) ]]) self._sliders = ButtonMatrixElement(rows=[[ make_slider(identifier, 0, 'Slider_%d' % index) for index, identifier in enumerate(xrange(12, 20)) ]]) self._control_buttons = ButtonMatrixElement(rows=[[ make_button(identifier, 0, 'Control_Button_%d' % index) for index, identifier in enumerate(xrange(32, 40)) ]]) self._play_button = make_button(118, 0, 'Play_Button') self._stop_button = make_button(117, 0, 'Stop_Button') self._record_button = make_button(119, 0, 'Record_Button')
def __init__(self, c_instance): ControlSurface.__init__(self, c_instance) with self.component_guard(): self._suppress_send_midi = True self._suppress_session_highlight = True is_momentary = True self._suggested_input_port = 'Launchpad' self._suggested_output_port = 'Launchpad' self._control_is_with_automap = False self._user_byte_write_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 0, 16) self._user_byte_write_button.name = 'User_Byte_Button' self._user_byte_write_button.send_value(1) self._user_byte_write_button.add_value_listener(self._user_byte_value) self._wrote_user_byte = False self._challenge = Live.Application.get_random_int(0, 400000000) & 2139062143 matrix = ButtonMatrixElement() matrix.name = 'Button_Matrix' for row in range(8): button_row = [] for column in range(8): button = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, row * 16 + column) button.name = str(column) + '_Clip_' + str(row) + '_Button' button_row.append(button) matrix.add_row(tuple(button_row)) self._config_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 0, 0, optimized_send_midi=False) self._config_button.add_value_listener(self._config_value) top_buttons = [ ConfigurableButtonElement(is_momentary, MIDI_CC_TYPE, 0, 104 + index) for index in range(8) ] side_buttons = [ ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, SIDE_NOTES[index]) for index in range(8) ] top_buttons[0].name = 'Bank_Select_Up_Button' top_buttons[1].name = 'Bank_Select_Down_Button' top_buttons[2].name = 'Bank_Select_Left_Button' top_buttons[3].name = 'Bank_Select_Right_Button' top_buttons[4].name = 'Session_Button' top_buttons[5].name = 'User1_Button' top_buttons[6].name = 'User2_Button' top_buttons[7].name = 'Mixer_Button' side_buttons[0].name = 'Vol_Button' side_buttons[1].name = 'Pan_Button' side_buttons[2].name = 'SndA_Button' side_buttons[3].name = 'SndB_Button' side_buttons[4].name = 'Stop_Button' side_buttons[5].name = 'Trk_On_Button' side_buttons[6].name = 'Solo_Button' side_buttons[7].name = 'Arm_Button' self._selector = MainSelectorComponent(matrix, tuple(top_buttons), tuple(side_buttons), self._config_button, self) self._selector.name = 'Main_Modes' self._do_combine() for control in self.controls: if isinstance(control, ConfigurableButtonElement): control.add_value_listener(self._button_value) self.set_highlighting_session_component(self._selector.session_component()) self._suppress_session_highlight = False #self.set_suppress_rebuild_requests(False) self.log_message("LaunchPad95 Loaded !")
def _setup_session_control(self): is_momentary = True self._shift_button = AumPCMonoButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 98, 'Shift_Button', self) right_button = AumPCMonoButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 96, 'Right_Button', self) self._right_button = right_button left_button = AumPCMonoButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 97, 'Left_Button', self) self._left_button = left_button up_button = AumPCMonoButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 94, 'Up_Button', self) self._up_button = up_button down_button = AumPCMonoButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 95, 'Down_Button', self) self._down_button = down_button self._session = PedaledSessionComponent(8, 5) self._session.name = 'Session_Control' self._session.set_track_bank_buttons(right_button, left_button) self._session.set_scene_bank_buttons(down_button, up_button) matrix = ButtonMatrixElement() self._matrix = matrix # added a matrix.name = 'Button_Matrix' scene_launch_buttons = [ ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, (index + 82)) for index in range(5) ] track_stop_buttons = [ AumPCMonoButtonElement(is_momentary, MIDI_NOTE_TYPE, index, 52, 'Track_' + str(index) + '_Stop_Button', self) for index in range(8) ] self._track_stop_buttons = track_stop_buttons # added a for index in range(len(scene_launch_buttons)): scene_launch_buttons[index].name = 'Scene_'+ str(index) + '_Launch_Button' stop_all_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 81) stop_all_button.name = 'Stop_All_Clips_Button' self._session.set_stop_all_clips_button(stop_all_button) self._session.set_stop_track_clip_buttons(tuple(track_stop_buttons)) self._session.set_stop_track_clip_value(2) for scene_index in range(5): scene = self._session.scene(scene_index) scene.name = 'Scene_' + str(scene_index) button_row = [] scene.set_launch_button(scene_launch_buttons[scene_index]) scene.set_triggered_value(2) for track_index in range(8): button = AumPCMonoButtonElement(is_momentary, MIDI_NOTE_TYPE, track_index, (scene_index + 53), str(track_index) + '_Clip_' + str(scene_index) + '_Button', self) #button.name = str(track_index) + '_Clip_' + str(scene_index) + '_Button' button_row.append(button) clip_slot = scene.clip_slot(track_index) clip_slot.name = str(track_index) + '_Clip_Slot_' + str(scene_index) clip_slot.set_triggered_to_play_value(2) clip_slot.set_triggered_to_record_value(4) clip_slot.set_stopped_value(5) clip_slot.set_started_value(1) clip_slot.set_recording_value(3) clip_slot.set_launch_button(button) matrix.add_row(tuple(button_row)) self._session.set_slot_launch_button(ButtonElement(is_momentary, MIDI_CC_TYPE, 0, 67)) self._session.selected_scene().name = 'Selected_Scene' self._session.selected_scene().set_launch_button(ButtonElement(is_momentary, MIDI_CC_TYPE, 0, 64)) self._session_zoom = SessionZoomingComponent(self._session) self._session_zoom.name = 'Session_Overview' self._session_zoom.set_button_matrix(matrix) self._session_zoom.set_zoom_button(self._shift_button) self._session_zoom.set_nav_buttons(up_button, down_button, left_button, right_button) self._session_zoom.set_scene_bank_buttons(tuple(scene_launch_buttons)) self._session_zoom.set_stopped_value(3) self._session_zoom.set_selected_value(5)
def __init__(self, *a, **k): ControlSurface.__init__(self, *a, **k) with self.component_guard(): self._monomod_version = 'b996' self._host_name = 'LaunchMod' self._color_type = 'Launchpad' self._timer = 0 self._suppress_send_midi = True self._suppress_session_highlight = True self._suppress_highlight = False is_momentary = True self._suggested_input_port = 'Launchpad' self._suggested_output_port = 'Launchpad' self._control_is_with_automap = False self._user_byte_write_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 0, 16) self._user_byte_write_button.name = 'User_Byte_Button' self._user_byte_write_button.send_value(1) self._user_byte_write_button.add_value_listener(self._user_byte_value) self._wrote_user_byte = False self._challenge = Live.Application.get_random_int(0, 400000000) & 2139062143 matrix = ButtonMatrixElement() matrix.name = 'Button_Matrix' for row in range(8): button_row = [ ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, row * 16 + column, str(column) + '_Clip_' + str(row) + '_Button', self) for column in range(8) ] matrix.add_row(tuple(button_row)) self._config_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 0, 0, optimized_send_midi=False) self._config_button.add_value_listener(self._config_value) top_button_names = ['Bank_Select_Up_Button', 'Bank_Select_Down_Button', 'Bank_Select_Left_Button', 'Bank_Select_Right_Button', 'Session_Button', 'User1_Button', 'User2_Button', 'Mixer_Button'] side_button_names = ['Vol_Button', 'Pan_Button', 'SndA_Button', 'SndB_Button', 'Stop_Button', 'Trk_On_Button', 'Solo_Button', 'Arm_Button'] top_buttons = [ ConfigurableButtonElement(is_momentary, MIDI_CC_TYPE, 0, 104 + index, top_button_names[index], self) for index in range(8) ] side_buttons = [ ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, SIDE_NOTES[index], side_button_names[index], self) for index in range(8) ] self._side_buttons = ButtonMatrixElement() self._side_buttons.add_row(side_buttons) self._setup_monobridge() self._setup_mod() self._selector = MainSelectorComponent(self, matrix, tuple(top_buttons), tuple(side_buttons), self._config_button) self._selector.name = 'Main_Modes' for control in self.controls: isinstance(control, MonoButtonElement) and control.add_value_listener(self._button_value) self.set_highlighting_session_component(self._selector.session_component()) self._suppress_session_highlight = False self.log_message('--------------= ' + str(self._monomod_version) + ' log opened =--------------')
def __init__(self, c_instance): ControlSurface.__init__(self, c_instance) self._monomod_version = 'b994' self._host_name = 'LaunchMod' self._color_type = 'Launchpad' self.hosts = [] self._timer = 0 self.set_suppress_rebuild_requests(True) self._suppress_send_midi = True self._suppress_session_highlight = True is_momentary = True self._suggested_input_port = 'Launchpad' self._suggested_output_port = 'Launchpad' self._wrote_user_byte = False self._control_is_with_automap = False self._challenge = (Live.Application.get_random_int(0, 400000000) & 2139062143) matrix = ButtonMatrixElement() matrix.name = 'ButtonMatrix' for row in range(8): #button_row = [ ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, ((row * 16) + column)) for column in range(8) ] button_row = [ FlashingButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, ((row * 16) + column), 'Button_' + str(row) + '_' + str(column), self) for column in range(8) ] matrix.add_row(tuple(button_row)) self._config_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 0, 0) self._config_button.add_value_listener(self._config_value) top_buttons = [ FlashingButtonElement(is_momentary, MIDI_CC_TYPE, 0, (104 + index), 'Top_Button' + str(index), self) for index in range(8) ] side_buttons = [ FlashingButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, SIDE_NOTES[index], 'Side_Button' + str(index), self) for index in range(8) ] self._setup_monobridge() self._setup_monomod() self._selector = MainSelectorComponent(matrix, tuple(top_buttons), tuple(side_buttons), self._config_button, self) self._suppress_session_highlight = False self._suppress_send_midi = False self._user_byte_write_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 0, 16) self._user_byte_write_button.send_value(1) self._user_byte_write_button.add_value_listener(self._user_byte_value) self._suppress_send_midi = True self.set_suppress_rebuild_requests(False) self.log_message("--------------= LaunchMod log opened =--------------" ) #Create entry in log file self.refresh_state()
def __init__(self, w, h,hold,mode): #ButtonMatrixElement.__init__(self) self._matrix = ButtonMatrixElement() self._matrix.name = 'Launchpad_Main_Grid' self._width = w self._height = h self._hold = hold self.setup_button_arrays() self.set_grid_mapping_mode(mode)
def __init__(self, *a, **k): ControlSurface.__init__(self, *a, **k) self._skin = Skin(LaunchModColors) with self.component_guard(): self._monomod_version = 'b996' self._host_name = 'LaunchMod' self._color_type = 'Launchpad' self._timer = 0 self._suppress_send_midi = True self._suppress_session_highlight = True self._suppress_highlight = False is_momentary = True self._suggested_input_port = 'Launchpad' self._suggested_output_port = 'Launchpad' self._control_is_with_automap = False self._user_byte_write_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 0, 16) self._user_byte_write_button.name = 'User_Byte_Button' self._user_byte_write_button.send_value(1) self._user_byte_write_button.add_value_listener(self._user_byte_value) self._wrote_user_byte = False self._challenge = Live.Application.get_random_int(0, 400000000) & 2139062143 matrix = ButtonMatrixElement(name = 'Button_Matrix') for row in range(8): button_row = [ ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, row * 16 + column, str(column) + '_Clip_' + str(row) + '_Button', self, skin = self._skin) for column in range(8) ] matrix.add_row(tuple(button_row)) self._matrix = matrix self._config_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 0, 0, optimized_send_midi=False) self._config_button.add_value_listener(self._config_value) top_button_names = ['Bank_Select_Up_Button', 'Bank_Select_Down_Button', 'Bank_Select_Left_Button', 'Bank_Select_Right_Button', 'Session_Button', 'User1_Button', 'User2_Button', 'Mixer_Button'] side_button_names = ['Vol_Button', 'Pan_Button', 'SndA_Button', 'SndB_Button', 'Stop_Button', 'Trk_On_Button', 'Solo_Button', 'Arm_Button'] top_buttons = [ ConfigurableButtonElement(is_momentary, MIDI_CC_TYPE, 0, 104 + index, top_button_names[index], self, skin = self._skin) for index in range(8) ] self._top_buttons = top_buttons side_buttons = [ ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, SIDE_NOTES[index], side_button_names[index], self, skin = self._skin) for index in range(8) ] self._side_buttons = ButtonMatrixElement(name = 'SideButtons', rows = [side_buttons]) self._setup_monobridge() self._setup_mod() self._selector = MainSelectorComponent(self, matrix, tuple(top_buttons), tuple(side_buttons), self._config_button) self._selector.name = 'Main_Modes' for control in self.controls: isinstance(control, MonoButtonElement) and control.add_value_listener(self._button_value) self.set_highlighting_session_component(self._selector.session_component()) self._suppress_session_highlight = False self.log_message('--------------= ' + str(self._monomod_version) + ' log opened =--------------')
def __init__(self, c_instance): ControlSurface.__init__(self, c_instance) with self.component_guard(): self._suppress_send_midi = True self._suppress_session_highlight = True is_momentary = True self._suggested_input_port = 'Launchpad' self._suggested_output_port = 'Launchpad' self._control_is_with_automap = False self._user_byte_write_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 0, 16) self._user_byte_write_button.name = 'User_Byte_Button' self._user_byte_write_button.send_value(1) self._user_byte_write_button.add_value_listener(self._user_byte_value) self._wrote_user_byte = False self._challenge = Live.Application.get_random_int(0, 400000000) & 2139062143 matrix = ButtonMatrixElement() matrix.name = 'Button_Matrix' for row in range(8): button_row = [] for column in range(8): button = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, row * 16 + column) button.name = str(column) + '_Clip_' + str(row) + '_Button' button_row.append(button) matrix.add_row(tuple(button_row)) self._config_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 0, 0, optimized_send_midi=False) self._config_button.add_value_listener(self._config_value) top_buttons = [ ConfigurableButtonElement(is_momentary, MIDI_CC_TYPE, 0, 104 + index) for index in range(8) ] side_buttons = [ ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, SIDE_NOTES[index]) for index in range(8) ] top_buttons[0].name = 'Bank_Select_Up_Button' top_buttons[1].name = 'Bank_Select_Down_Button' top_buttons[2].name = 'Bank_Select_Left_Button' top_buttons[3].name = 'Bank_Select_Right_Button' top_buttons[4].name = 'Session_Button' top_buttons[5].name = 'User1_Button' top_buttons[6].name = 'User2_Button' top_buttons[7].name = 'Mixer_Button' side_buttons[0].name = 'Vol_Button' side_buttons[1].name = 'Pan_Button' side_buttons[2].name = 'SndA_Button' side_buttons[3].name = 'SndB_Button' side_buttons[4].name = 'Stop_Button' side_buttons[5].name = 'Trk_On_Button' side_buttons[6].name = 'Solo_Button' side_buttons[7].name = 'Arm_Button' self._selector = MainSelectorComponent(matrix, tuple(top_buttons), tuple(side_buttons), self._config_button) self._selector.name = 'Main_Modes' for control in self.controls: if isinstance(control, ConfigurableButtonElement): control.add_value_listener(self._button_value) self.set_highlighting_session_component(self._selector.session_component()) self._suppress_session_highlight = False
def __init__(self, c_instance): ControlSurface.__init__(self, c_instance) self.set_suppress_rebuild_requests(True) self._suppress_send_midi = True self._suppress_session_highlight = True is_momentary = True self._suggested_input_port = "Launchpad" self._suggested_output_port = "Launchpad" self._control_is_with_automap = False self._user_byte_write_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 0, 16) self._user_byte_write_button.name = "User_Byte_Button" self._user_byte_write_button.send_value(1) self._user_byte_write_button.add_value_listener(self._user_byte_value) self._wrote_user_byte = False self._challenge = (Live.Application.get_random_int(0, 400000000) & 2139062143) matrix = ButtonMatrixElement() matrix.name = "Button_Matrix" for row in range(8): button_row = [] for column in range(8): button = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, ((row * 16) + column)) button.name = (((str(column) + "_Clip_") + str(row)) + "_Button") button_row.append(button) matrix.add_row(tuple(button_row)) self._config_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 0, 0) self._config_button.add_value_listener(self._config_value) top_buttons = [ ConfigurableButtonElement(is_momentary, MIDI_CC_TYPE, 0, (104 + index)) for index in range(8) ] side_buttons = [ ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, SIDE_NOTES[index]) for index in range(8) ] top_buttons[0].name = "Bank_Select_Up_Button" top_buttons[1].name = "Bank_Select_Down_Button" top_buttons[2].name = "Bank_Select_Left_Button" top_buttons[3].name = "Bank_Select_Right_Button" top_buttons[4].name = "Session_Button" top_buttons[5].name = "User1_Button" top_buttons[6].name = "User2_Button" top_buttons[7].name = "Mixer_Button" side_buttons[0].name = "Vol_Button" side_buttons[1].name = "Pan_Button" side_buttons[2].name = "SndA_Button" side_buttons[3].name = "SndB_Button" side_buttons[4].name = "Stop_Button" side_buttons[5].name = "Trk_On_Button" side_buttons[6].name = "Solo_Button" side_buttons[7].name = "Arm_Button" self._selector = MainSelectorComponent(matrix, tuple(top_buttons), tuple(side_buttons), self._config_button, self) self._selector.name = "Main_Modes" for control in self.controls: if isinstance(control, ConfigurableButtonElement): control.add_value_listener(self._button_value) self._suppress_session_highlight = False self.set_suppress_rebuild_requests(False) self.log_message("LaunchPad85 Loaded !")
def __init__(self, script, mapper = None, is_push = False, num_params = 8, direct_bank = False, mono = True, shared = False, path = None, delayed_update = False, new_skin = False, *a, **k): self._script = script self._use_new_skin = new_skin self._mapper = mapper self._is_push = is_push self._is_osc = hasattr(self._script, '_osc_control') and self._script._osc_control if not self._is_osc: g_hud = False if is_push: self._bank_index = 0 self.log('DeviceComponentBase: num: ' + str(num_params) + ', path: ' + str(path) + ', HUD: ' + str(g_hud) + ', OSC: ' + str(self._is_osc) + ', is_push: ' + str(is_push) + ', mapper: ' + str(mapper != None)) self.bank_num = 0 self.max_bank = 0 self.num_devices = 0 self.track_num = 0 self.device_num = 0 self._enabled = False self._selected_track = None self._selected_device = None self._skip_racks = True self._devices_enable = [] self._device_locked = False self._locked_device = None self._allow_direct_select = True self._enable_or_select = True self._num_params = num_params self._direct_bank = direct_bank self._log_parameters = False self._current_device = None self._force_set_device = False self._delayed_update = delayed_update self._current_banks = {} self.my_parameters = [] self._assign_channel_strip = False self._channel_strip_bank = 0 self._channel_strip_rows = 3 self._iso_rack_enable = [] self._mono = mono self._shared_enable_select = shared def make_hud_encoder(index, name): control = HUDControlElement(self, self._hud_state_control, i) control.name = name + '_' + str(i) return control def make_osc_encoder(index, name, osc_msg): control = OSCControlElement(self, self._script.oscServer, i, osc_msg) control.name = name + '_' + str(i) return control if g_hud: self.log('Creating HUD notification', True) self._hud_state_control = self._script._create_notifying_control_element() self._hud_state_control.name = 'HUD_State' self._hud_controls = ButtonMatrixElement(rows=[[ make_osc_encoder(i, 'HUD_Control', '/hud') for i in xrange(8) ]]) self._hud_cs_controls = ButtonMatrixElement(rows=[[ make_osc_encoder(i, 'HUD_CS_Control', '/hudcs') for i in xrange(8) ]])
def _setup_controls(self): is_momentary = True self._fader = [MonoEncoderElement(MIDI_CC_TYPE, CHANNEL, DS1_FADERS[index], Live.MidiMap.MapMode.absolute, 'Fader_' + str(index), index, self) for index in range(8)] for fader in self._fader: fader._mapping_feedback_delay = -1 self._dial = [[MonoEncoderElement(MIDI_CC_TYPE, CHANNEL, DS1_DIALS[x][y], Live.MidiMap.MapMode.absolute, 'Dial_' + str(x) + '_' + str(y), x + (y*5), self) for x in range(8)] for y in range(5)] for row in self._dial: for dial in row: dial._mapping_feedback_delay = -1 self._side_dial = [MonoEncoderElement(MIDI_CC_TYPE, CHANNEL, DS1_SIDE_DIALS[x], Live.MidiMap.MapMode.absolute, 'Side_Dial_' + str(x), x, self) for x in range(4)] for dial in self._side_dial: dial._mapping_feedback_delay = -1 self._encoder = [MonoEncoderElement(MIDI_CC_TYPE, CHANNEL, DS1_ENCODERS[x], Live.MidiMap.MapMode.absolute, 'Encoder_' + str(x), x, self) for x in range(4)] for encoder in self._encoder: encoder._mapping_feedback_delay = -1 self._encoder_button = [MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, DS1_ENCODER_BUTTONS[index], 'EncoderButton_' + str(index), self, skin = self._skin) for index in range(4)] self._master_fader = MonoEncoderElement(MIDI_CC_TYPE, CHANNEL, DS1_MASTER, Live.MidiMap.MapMode.absolute, 'MasterFader', 0, self) self._button = [MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, DS1_BUTTONS[index], 'Button_' + str(index), self, skin = self._skin) for index in range(16)] self._grid = [[MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, DS1_GRID[x][y], 'Button_' + str(x) + '_' + str(y), self, skin = self._skin) for x in range(3)] for y in range(3)] self._dummy = [MonoEncoderElement(MIDI_CC_TYPE, CHANNEL, 120+x, Live.MidiMap.MapMode.absolute, 'Dummy_Dial_' + str(x), x, self) for x in range(5)] self._fader_matrix = ButtonMatrixElement(name = 'FaderMatrix', rows = [self._fader]) self._top_buttons = ButtonMatrixElement(name = 'TopButtonMatrix', rows = [self._button[:8]]) self._bottom_buttons = ButtonMatrixElement(name = 'BottomButtonMatrix', rows = [self._button[8:]]) self._dial_matrix = ButtonMatrixElement(name = 'DialMatrix', rows = self._dial) self._side_dial_matrix = ButtonMatrixElement(name = 'SideDialMatrix', rows = [self._side_dial]) self._encoder_matrix = ButtonMatrixElement(name = 'EncoderMatrix', rows = [self._encoder]) self._encoder_button_matrix = ButtonMatrixElement(name = 'EncoderButtonMatrix', rows = [self._encoder_button]) self._grid_matrix = ButtonMatrixElement(name = 'GridMatrix', rows = self._grid) self._selected_parameter_controls = ButtonMatrixElement(name = 'SelectedParameterControls', rows = [self._dummy + self._encoder[:1] + self._encoder[2:]])
def _create_user(self): def make_control_button(identifier, name, channel=0, is_pad=False): button = ButtonElement(True, MIDI_NOTE_TYPE if is_pad else MIDI_CC_TYPE, channel, identifier) button.name = name button.set_on_off_values(127, 0) return button def make_control_encoder(identifier, name, channel=0): encoder = EncoderElement( MIDI_CC_TYPE, channel, identifier, Live.MidiMap.MapMode.absolute if not self._relative else Live.MidiMap.MapMode.relative_two_compliment) encoder.reset = nop encoder.set_feedback_delay(-1) encoder.name = name return encoder def make_all_encoders(name_prefix='', make_encoder=make_control_encoder): return ([ make_encoder(13 + index, name_prefix + '_' + str(index) + '_0') for index in xrange(8) ], [ make_encoder(80 + index, name_prefix + '_' + str(index) + '_1') for index in xrange(8) ], [ make_encoder(88 + index, name_prefix + '_' + str(index) + '_2') for index in xrange(8) ], [ make_encoder(96 + index, name_prefix + '_' + str(index) + '_3') for index in xrange(8) ]) make_button = partial(make_control_button, channel=USER_MODE) make_encoder = partial(make_control_encoder, channel=USER_MODE) encoders_row_1, encoders_row_2, encoders_row_3, encoders_row_4 = make_all_encoders( 'User_Encoder', make_encoder) buttons_0 = [ make_button(pad_identifiers[i], 'User_Button_Matrix_' + str(i) + '_0', is_pad=True) for i in xrange(8) ] buttons_1 = [ make_button(pad_identifiers[i + 8], 'User_Button_Matrix_' + str(i) + '_1', is_pad=True) for i in xrange(8) ] self._matrix = ButtonMatrixElement() self._matrix.name = 'User_Button_Matrix' self._matrix.add_row(tuple(buttons_0)) self._matrix.add_row(tuple(buttons_1)) self.request_rebuild_midi_map()
def _setup_session_control(self): """SESSION ViEW""" global session session = SessionComponent(GRIDSIZE[0], GRIDSIZE[1]) session.name = 'Session_Control' matrix = ButtonMatrixElement() matrix.name = 'Button_Matrix' up_button = ButtonElement(True, MIDI_CC_TYPE, CHANNEL, UP_BUTTON) down_button = ButtonElement(True, MIDI_CC_TYPE, CHANNEL, DOWN_BUTTON) left_button = ButtonElement(True, MIDI_CC_TYPE, CHANNEL, LEFT_BUTTON) right_button = ButtonElement(True, MIDI_CC_TYPE, CHANNEL, RIGHT_BUTTON) session_zoom = SessionZoomingComponent(session) session_zoom.set_nav_buttons(up_button, down_button, left_button, right_button) session_stop_buttons = [] self.log("SETTING UP GRID") for row in xrange(GRIDSIZE[1]): button_row = [] self.log("CZ ROW") self.log(str(row)) scene = session.scene(row) scene.name = 'Scene_' + str(row) scene.set_launch_button( ButtonElement(True, MIDI_NOTE_TYPE, CHANNEL, SCENE_BUTTONS[row])) scene.set_triggered_value(2) for column in xrange(GRIDSIZE[0]): self.log("CZ COLUMN") self.log(str(column)) button = ConfigurableButtonElement(True, MIDI_NOTE_TYPE, CHANNEL, LAUNCH_BUTTONS[row][column]) button.name = str(column) + '_Clip_' + str(row) + '_Button' button_row.append(button) clip_slot = scene.clip_slot(column) clip_slot.name = str(column) + '_Clip_Slot_' + str(row) clip_slot.set_launch_button(button) matrix.add_row(tuple(button_row)) for column in xrange(GRIDSIZE[0]): session_stop_buttons.append( (ButtonElement(True, MIDI_NOTE_TYPE, CHANNEL, TRACK_STOPS[column]))) self._suppress_session_highlight = False self._suppress_send_midi = False self.set_highlighting_session_component(session) session.set_stop_track_clip_buttons(tuple(session_stop_buttons)) session.set_mixer(mixer)
def make_button_row(identifier_sequence, element_factory, name, ch=0, skin=None): if skin != None: return ButtonMatrixElement(rows=[[ element_factory(identifier, name + '_%d' % index, ch=ch, skin=skin) ] for index, identifier in enumerate(identifier_sequence)]) return ButtonMatrixElement( rows=[[element_factory(identifier, name + '_%d' % index, ch=ch)] for index, identifier in enumerate(identifier_sequence)])
def _setup_session_control(self): num_tracks = 7 num_scenes = 4 session_nav_button = [ ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, SESSION_NAV_BUTTONS[index]) for index in range(2) ] session_stop_button = [] matrix = ButtonMatrixElement() matrix.name = 'Button_Matrix' global session session = SessionComponent(num_tracks, num_scenes) session.name = 'Session_Control' session.set_offsets(0, 0) session.set_scene_bank_buttons(session_nav_button[1], session_nav_button[0]) #session.set_track_bank_buttons(session_nav_button[3], session_nav_button[2]) for row in xrange(num_scenes): scene_launch_button = ButtonElement(True, MIDI_NOTE_TYPE, CHANNEL, SCENE_LAUNCH_BUTTONS[row]) session_row = [] scene = session.scene(row) scene.name = 'Scene' + str(row) scene.set_launch_button(scene_launch_button) scene.set_triggered_value(2) #scene_launch_button._set_skin_light(68) for column in xrange(num_tracks): clip_launch_button = ButtonElement( is_momentary, MIDI_NOTE_TYPE, CHANNEL, CLIP_LAUNCH_BUTTONS[row][column]) clip_launch_button.name = str(column) + '_Clip_' + str( row) + '_Button' session_row.append(clip_launch_button) clip_slot = scene.clip_slot(column) clip_slot.name = str(column) + '_ClipSlot_' + str(row) clip_slot.set_launch_button(clip_launch_button) #clip_launch_button._set_skin_light(76) matrix.add_row(tuple(session_row)) for column in xrange(num_tracks): session_stop_button.append( ButtonElement(True, MIDI_NOTE_TYPE, CHANNEL, SESSION_STOP_BUTTONS[column])) self._supress_session_highlight = False self._supress_send_midi = False self.set_highlighting_session_component(session) session.set_stop_track_clip_buttons(tuple(session_stop_button))
def __init__(self, script): ButtonMatrixElement.__init__(self) self.bridge = 'None' self._script = script self._page_str = '/2' self._elapsed_events = 0 self._threshold = 50 self._buffer = [] self._script._register_timer_callback(self._send_buffer) self._device = None self._device_parent = None self._connected = False
def _setup_session_control(self): is_momentary = True self._session = SpecialSessionComponent(NUM_TRACKS, NUM_SCENES) self._session.set_serato_interface(self._serato_interface) self._matrix = ButtonMatrixElement() self._scene_launch_buttons = [ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 0) for index in range(NUM_SCENES)] self._track_stop_buttons = [ ButtonElement(not is_momentary, MIDI_NOTE_TYPE, 0, 0) for index in range(NUM_TRACKS) ] stop_all_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 0) self._session.set_stop_all_clips_button(stop_all_button) self._session.set_stop_track_clip_buttons(tuple(self._track_stop_buttons)) for scene_index in range(NUM_SCENES): scene = self._session.scene(scene_index) button_row = [] scene.set_launch_button(self._scene_launch_buttons[scene_index]) scene.set_index(scene_index) scene.set_serato_interface(self._serato_interface) for track_index in range(NUM_TRACKS): button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 0) button_row.append(button) clip_slot = scene.clip_slot(track_index) clip_slot.set_launch_button(button) clip_slot.set_serato_interface(self._serato_interface) self._matrix.add_row(tuple(button_row))
def _setup_controls(self): is_momentary = True self._grid = [None for index in range(8)] for column in range(8): self._grid[column] = [TweakerMonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, column + (row * 8) + 1, 'Grid_' + str(column) + '_' + str(row), self) for row in range(4)] self._button = [TweakerMonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, TWEAKER_BUTTONS[index], 'Button_' + str(index), self) for index in range(len(TWEAKER_BUTTONS))] self._nav = [TweakerMonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, TWEAKER_NAVS[index], 'Nav_' + str(index), self) for index in range(len(TWEAKER_NAVS))] self._encoder_button = [TweakerMonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, TWEAKER_ENCODER_BUTTONS[index], 'Encoder_Button_' + str(index), self) for index in range(len(TWEAKER_ENCODER_BUTTONS))] self._dial = [EncoderElement(MIDI_CC_TYPE, CHANNEL, TWEAKER_DIALS[index], Live.MidiMap.MapMode.absolute) for index in range(len(TWEAKER_DIALS))] self._fader = [EncoderElement(MIDI_CC_TYPE, CHANNEL, TWEAKER_FADERS[index], Live.MidiMap.MapMode.absolute) for index in range(len(TWEAKER_FADERS))] self._crossfader = EncoderElement(MIDI_CC_TYPE, CHANNEL, CROSSFADER, Live.MidiMap.MapMode.absolute) self._encoder = [EncoderElement(MIDI_CC_TYPE, CHANNEL, TWEAKER_ENCODERS[index], Live.MidiMap.MapMode.absolute) for index in range(len(TWEAKER_ENCODERS))] self._pad = [TweakerMonoButtonElement(False, MIDI_NOTE_TYPE, CHANNEL, TWEAKER_PADS[index], 'Pad_' + str(index), self) for index in range(len(TWEAKER_PADS))] for index in range(4): self._pad[index].set_enabled(False) self._pad[index].set_channel(PAD_CHANNEL) self._pad[index].set_identifier(index + 4) self._pad[index+4].set_enabled(False) self._pad[index+4].set_channel(PAD_CHANNEL) self._pad[index+4].set_identifier(index) self._pad_pressure = [EncoderElement(MIDI_CC_TYPE, CHANNEL, TWEAKER_PAD_PRESSURES[index], Live.MidiMap.MapMode.absolute) for index in range(len(TWEAKER_PADS))] for index in range(8): self._pad_pressure[index]._last_sent = 0 self._matrix = ButtonMatrixElement() self._matrix.name = 'Matrix' for row in range(4): button_row = [] for column in range(7): button_row.append(self._grid[column][row]) self._matrix.add_row(tuple(button_row)) self._send_midi(tuple([240,0,1,106,01,07,21,21,247])) #set all pots to walk mode self._send_midi(tuple([240, 0, 1, 106, 1, 6, 127 , 127, 25, 0, 15, 0, 9, PAD_SENSITIVITY, 247])) #set pads to sensitivity set in Map file
class MiniLab(ArturiaControlSurface): def __init__(self, *a, **k): super(MiniLab, self).__init__(*a, **k) with self.component_guard(): self._create_controls() self._create_device() self._create_session() self._create_mixer() def _create_controls(self): self._device_controls = ButtonMatrixElement(rows=[ [ EncoderElement(MIDI_CC_TYPE, 0, identifier, Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Encoder_%d_%d' % (column_index, row_index)) for column_index, identifier in enumerate(row) ] for row_index, row in enumerate((ENCODER_MSG_IDS[:4], ENCODER_MSG_IDS[8:12])) ]) self._horizontal_scroll_encoder = EncoderElement(MIDI_CC_TYPE, 0, 75, Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Horizontal_Scroll_Encoder') self._vertical_scroll_encoder = EncoderElement(MIDI_CC_TYPE, 0, 72, Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Vertical_Scroll_Encoder') self._volume_encoder = EncoderElement(MIDI_CC_TYPE, 0, 91, Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Volume_Encoder') self._pan_encoder = EncoderElement(MIDI_CC_TYPE, 0, 17, Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Pan_Encoder') self._send_a_encoder = EncoderElement(MIDI_CC_TYPE, 0, 77, Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Send_A_Encoder') self._send_b_encoder = EncoderElement(MIDI_CC_TYPE, 0, 93, Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Send_B_Encoder') self._send_encoders = ButtonMatrixElement(rows=[[self._send_a_encoder, self._send_b_encoder]]) self._return_a_encoder = EncoderElement(MIDI_CC_TYPE, 0, 73, Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Return_A_Encoder') self._return_b_encoder = EncoderElement(MIDI_CC_TYPE, 0, 79, Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Return_B_Encoder') self._return_encoders = ButtonMatrixElement(rows=[[self._return_a_encoder, self._return_b_encoder]]) self._pads = ButtonMatrixElement(rows=[ [ ButtonElement(True, MIDI_NOTE_TYPE, PAD_CHANNEL, col + 36 + 8 * row, name='Pad_%d_%d' % (col, row)) for col in xrange(8) ] for row in xrange(2) ]) def _create_device(self): self._device = DeviceComponent(name='Device', is_enabled=False, layer=Layer(parameter_controls=self._device_controls)) self._device.set_enabled(True) self.set_device_component(self._device) self._device_selection_follows_track_selection = True def _create_session(self): self._session = SessionComponent(num_tracks=self._pads.width(), num_scenes=self._pads.height(), name='Session', is_enabled=False, layer=Layer(clip_launch_buttons=self._pads, scene_select_control=self._vertical_scroll_encoder)) self._session.set_enabled(True) def _create_mixer(self): self._mixer = MixerComponent(name='Mixer', is_enabled=False, num_returns=2, layer=Layer(track_select_encoder=self._horizontal_scroll_encoder, selected_track_volume_control=self._volume_encoder, selected_track_pan_control=self._pan_encoder, selected_track_send_controls=self._send_encoders, return_volume_controls=self._return_encoders)) self._mixer.set_enabled(True) def _collect_setup_messages(self): for cc_id, encoder_id in izip(ENCODER_MSG_IDS, HARDWARE_ENCODER_IDS): self._setup_hardware_encoder(encoder_id, cc_id) for index, pad_id in enumerate(HARDWARE_BUTTON_IDS): identifier = index + PAD_IDENTIFIER_OFFSET channel = PAD_CHANNEL self._setup_hardware_button(pad_id, identifier, channel)
def _setup_controls(self): is_momentary = True self._fader = [None for index in range(8)] self._dial = [None for index in range(8)] self._button = [None for index in range(8)] self._menu = [None for index in range(6)] for index in range(2): self._fader[index] = MonoEncoderElement(MIDI_CC_TYPE, CHANNEL, SLIDER_CC[index], Live.MidiMap.MapMode.absolute, 'Fader_' + str(index), index, self) #for index in range(8): # self._button[index] = MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, OHM_BUTTONS[index], 'Button_' + str(index), self) for index in range(8): self._dial[index] = MonoEncoderElement(MIDI_CC_TYPE, CHANNEL, KNOB_CC[index], Live.MidiMap.MapMode.absolute, 'Dial_' + str(index), index + 8, self) for index in range(4): self._menu[index] = MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, FUNCTION_NOTES[index], 'Menu_' + str(index), self) #self._livid = MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, LIVID, 'Livid_Button', self) self._livid = DoublePressElement(MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, LIVID, 'Livid_Button', self)) self._shift_l = MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, SHIFT_L, 'Shift_Button_Left', self) self._shift_r = MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, SHIFT_R, 'Shift_Button_Right', self) self._matrix = ButtonMatrixElement() self._matrix.name = 'Matrix' self._monomod = ButtonMatrixElement() self._monomod.name = 'Monomod' self._grid = [None for index in range(8)] for column in range(8): self._grid[column] = [None for index in range(8)] for row in range(8): self._grid[column][row] = MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, (column * 8) + row, 'Grid_' + str(column) + '_' + str(row), self) for row in range(5): button_row = [] for column in range(7): button_row.append(self._grid[column][row]) self._matrix.add_row(tuple(button_row)) for row in range(8): button_row = [] for column in range(8): button_row.append(self._grid[column][row]) self._monomod.add_row(tuple(button_row)) self._dummy_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 15, 125) self._dummy_button.name = 'Dummy1' self._dummy_button2 = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 15, 126) self._dummy_button2.name = 'Dummy2' self._dummy_button3 = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 15, 127) self._dummy_button2.name = 'Dummy3' self._dial_matrix = ButtonMatrixElement() self._dial_matrix.add_row(self._dial)
def _setup_controls(self): is_momentary = True self._livid = FlashingButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, LIVID, "Livid_Button", self) self._dial = [None for index in range(8)] for column in range(8): self._dial[column] = [None for index in range(4)] for row in range(4): self._dial[column][row] = CodecEncoderElement( MIDI_CC_TYPE, CHANNEL, CODE_DIALS[row][column], Live.MidiMap.MapMode.absolute, "Dial_" + str(column) + "_" + str(row), (column + (row * 8)), self, ) # CODE_DIALS[row][column] self._button = [None for index in range(8)] for column in range(8): self._button[column] = [None for index in range(4)] for row in range(4): self._button[column][row] = FlashingButtonElement( is_momentary, MIDI_NOTE_TYPE, CHANNEL, CODE_BUTTONS[row][column], "Button_" + str(column) + "_" + str(row), self, ) self._column_button = [None for index in range(8)] for index in range(8): self._column_button[index] = FlashingButtonElement( is_momentary, MIDI_NOTE_TYPE, CHANNEL, CODE_COLUMN_BUTTONS[index], "Column_Button_" + str(index), self ) self._row_button = [None for index in range(4)] for index in range(4): self._row_button[index] = FlashingButtonElement( is_momentary, MIDI_NOTE_TYPE, CHANNEL, CODE_ROW_BUTTONS[index], "Row_Button_" + str(index), self ) self._dial_matrix = EncoderMatrixElement(self) self._dial_matrix.name = "Encoder_Matrix" for row in range(4): dial_row = tuple([self._dial[column][row] for column in range(8)]) self._dial_matrix.add_row(dial_row) self._button_matrix = ButtonMatrixElement() self._button_matrix.name = "Button_Matrix" for row in range(4): button_row = [self._button[column][row] for column in range(8)] button_row.append(self._row_button[row]) self._button_matrix.add_row(tuple(button_row)) self._button_matrix.add_row(tuple(self._column_button + [self._livid]))
def _setup_session_control(self): is_momentary = True num_tracks = 4 num_scenes = 4 self.session = SessionComponent(num_tracks, num_scenes) self.session.name = 'MaschinAble_session_control' matrix = ButtonMatrixElement() self.session.set_offsets(0, 0) up_button = ButtonElement(is_momentary, 1, 1, 108) down_button = ButtonElement(is_momentary, 1, 1, 109) left_button = ButtonElement(is_momentary, 1, 1, 110) right_button = ButtonElement(is_momentary, 1, 1, 111) self.session.set_track_bank_buttons(right_button, left_button) self.session.set_scene_bank_buttons(down_button, up_button) launch_notes_start_from = 112 launch_notes = range(launch_notes_start_from, launch_notes_start_from + 16) current_scene = list( self.song().scenes).index(self.song().view.selected_scene) current_track = list( self.song().tracks).index(self.song().view.selected_track) for scene_index in range(num_scenes): button_row = [] for track_index in range(num_tracks): clip_slot = self.session.scene(num_scenes - 1 - scene_index + current_scene).clip_slot(track_index + current_track) button = ButtonElement(is_momentary, 0, 1, launch_notes[track_index+(4*scene_index)]) button_row.append(button) if clip_slot.has_clip: clip_slot.set_stopped_value(1) else: clip_slot.set_stopped_value(0) clip_slot.set_triggered_to_play_value(2) clip_slot.set_triggered_to_record_value(2) clip_slot.set_launch_button(button) matrix.add_row(tuple(button_row))
def _create_controls(self): self._device_controls = ButtonMatrixElement(rows=[ [ EncoderElement(MIDI_CC_TYPE, 0, identifier, Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Encoder_%d_%d' % (column_index, row_index)) for column_index, identifier in enumerate(row) ] for row_index, row in enumerate((ENCODER_MSG_IDS[:4], ENCODER_MSG_IDS[8:12])) ]) self._horizontal_scroll_encoder = EncoderElement(MIDI_CC_TYPE, 0, 75, Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Horizontal_Scroll_Encoder') self._vertical_scroll_encoder = EncoderElement(MIDI_CC_TYPE, 0, 72, Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Vertical_Scroll_Encoder') self._volume_encoder = EncoderElement(MIDI_CC_TYPE, 0, 91, Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Volume_Encoder') self._pan_encoder = EncoderElement(MIDI_CC_TYPE, 0, 17, Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Pan_Encoder') self._send_a_encoder = EncoderElement(MIDI_CC_TYPE, 0, 77, Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Send_A_Encoder') self._send_b_encoder = EncoderElement(MIDI_CC_TYPE, 0, 93, Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Send_B_Encoder') self._send_encoders = ButtonMatrixElement(rows=[[self._send_a_encoder, self._send_b_encoder]]) self._return_a_encoder = EncoderElement(MIDI_CC_TYPE, 0, 73, Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Return_A_Encoder') self._return_b_encoder = EncoderElement(MIDI_CC_TYPE, 0, 79, Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Return_B_Encoder') self._return_encoders = ButtonMatrixElement(rows=[[self._return_a_encoder, self._return_b_encoder]]) self._pads = ButtonMatrixElement(rows=[ [ ButtonElement(True, MIDI_NOTE_TYPE, PAD_CHANNEL, col + 36 + 8 * row, name='Pad_%d_%d' % (col, row)) for col in xrange(8) ] for row in xrange(2) ])
def _create_controls(self): self._device_controls = ButtonMatrixElement(rows=[ [ EncoderElement(MIDI_CC_TYPE, self.encoder_msg_channel, identifier, Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Encoder_%d_%d' % (column_index, row_index)) for column_index, identifier in enumerate(row) ] for row_index, row in enumerate((self.encoder_msg_ids[:4], self.encoder_msg_ids[8:12])) ]) self._horizontal_scroll_encoder = EncoderElement(MIDI_CC_TYPE, self.encoder_msg_channel, self.encoder_msg_ids[7], Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Horizontal_Scroll_Encoder') self._vertical_scroll_encoder = EncoderElement(MIDI_CC_TYPE, self.encoder_msg_channel, self.encoder_msg_ids[15], Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Vertical_Scroll_Encoder') self._volume_encoder = EncoderElement(MIDI_CC_TYPE, self.encoder_msg_channel, self.encoder_msg_ids[13], Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Volume_Encoder') self._pan_encoder = EncoderElement(MIDI_CC_TYPE, self.encoder_msg_channel, self.encoder_msg_ids[12], Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Pan_Encoder') self._send_a_encoder = EncoderElement(MIDI_CC_TYPE, self.encoder_msg_channel, self.encoder_msg_ids[4], Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Send_A_Encoder') self._send_b_encoder = EncoderElement(MIDI_CC_TYPE, self.encoder_msg_channel, self.encoder_msg_ids[5], Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Send_B_Encoder') self._send_encoders = ButtonMatrixElement(rows=[[self._send_a_encoder, self._send_b_encoder]]) self._return_a_encoder = EncoderElement(MIDI_CC_TYPE, self.encoder_msg_channel, self.encoder_msg_ids[6], Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Return_A_Encoder') self._return_b_encoder = EncoderElement(MIDI_CC_TYPE, self.encoder_msg_channel, self.encoder_msg_ids[14], Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Return_B_Encoder') self._return_encoders = ButtonMatrixElement(rows=[[self._return_a_encoder, self._return_b_encoder]]) self._pads = ButtonMatrixElement(rows=[ [ ButtonElement(True, MIDI_NOTE_TYPE, self.pad_channel, col + 36 + 8 * row, name='Pad_%d_%d' % (col, row)) for col in xrange(8) ] for row in xrange(2) ])
def _create_controls(self): self._encoders = ButtonMatrixElement(rows=[[ make_encoder(identifier, name='Encoder_%d' % (index,)) for index, identifier in enumerate(xrange(21, 29)) ]]) self._top_pad_row = ButtonMatrixElement(rows=[[ make_button(identifier, name='Pad_0_%d' % (index,)) for index, identifier in enumerate(xrange(96, 104)) ]]) self._bottom_pad_row_raw = [ make_button(identifier, name='Pad_1_%d' % (index,)) for index, identifier in enumerate(xrange(112, 120)) ] self._bottom_pad_row = ButtonMatrixElement(rows=[self._bottom_pad_row_raw]) self._top_launch_button = make_button(104, name='Scene_Launch_Button') self._bottom_launch_button = make_button(120, name='Stop_All_Clips_Button') self._scene_up_button = make_button(112, MIDI_CC_TYPE, name='Scene_Up_Button') self._scene_down_button = make_button(113, MIDI_CC_TYPE, name='Scene_Down_Button') self._stop_button = make_button(114, MIDI_CC_TYPE, name='Stop_Button') self._play_button = make_button(115, MIDI_CC_TYPE, name='Play_Button') self._loop_button = make_button(116, MIDI_CC_TYPE, name='Loop_Button') self._record_button = make_button(117, MIDI_CC_TYPE, name='Record_Button') self._sliders = ButtonMatrixElement(rows=[[ make_slider(identifier, name='Slider_%d' % (index,)) for index, identifier in enumerate(xrange(41, 49)) ]]) self._master_slider = make_slider(7, name='Master_Slider') self._25_key_slider = make_slider(7, name='Slider', channel=0) self._mute_buttons_raw = [ make_button(identifier, MIDI_CC_TYPE, name='Mute_Button_%d' % (index,)) for index, identifier in enumerate(xrange(51, 59)) ] self._mute_buttons = ButtonMatrixElement(rows=[self._mute_buttons_raw]) self._master_button = make_button(59, MIDI_CC_TYPE, name='Master_Button') self._track_left_button = make_button(102, MIDI_CC_TYPE, name='Track_Left_Button') self._track_right_button = make_button(103, MIDI_CC_TYPE, name='Track_Right_Button') self._device_mode_button = self._bottom_pad_row_raw[0] self._pan_mode_button = self._bottom_pad_row_raw[1] self._send_mode_buttons = dict() for index in xrange(consts.MAX_SENDS): setattr(self, '_send_%d_button' % (index,), self._bottom_pad_row_raw[index + 2]) self._send_mode_buttons['send_%d_mode_button' % (index,)] = getattr(self, '_send_%d_button' % (index,)) self._extended_mode_button = make_button(12, name='Dummy_Extended_Mode_Button') self._extended_mode_button.add_value_listener(nop) self._encoder_incontrol_button = make_button(13, is_momentary=False, name='Encoder_InControl_Button') self._encoder_incontrol_button.add_value_listener(nop) self._slider_incontrol_button = make_button(14, is_momentary=False, name='Fader_InControl_Button') self._slider_incontrol_button.add_value_listener(nop) self._pad_incontrol_button = make_button(15, is_momentary=False, name='Pad_InControl_Button') self._pad_incontrol_button.add_value_listener(self._update_pads) self._encoder_incontrol_button2 = make_button(16, name='Encoder_InControl_Button') self._pad_in_control_status_button = make_button(11, name='Dummy_InControl_Button')
def __init__(self, c_instance): ControlSurface.__init__(self, c_instance) self._monomod_version = 'b994' self._host_name = 'LaunchMod' self._color_type = 'Launchpad' self.hosts = [] self._timer = 0 self.set_suppress_rebuild_requests(True) self._suppress_send_midi = True self._suppress_session_highlight = True is_momentary = True self._suggested_input_port = 'Launchpad' self._suggested_output_port = 'Launchpad' self._wrote_user_byte = False self._control_is_with_automap = False self._challenge = (Live.Application.get_random_int(0, 400000000) & 2139062143) matrix = ButtonMatrixElement() matrix.name = 'ButtonMatrix' for row in range(8): #button_row = [ ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, ((row * 16) + column)) for column in range(8) ] button_row = [ FlashingButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, ((row * 16) + column), 'Button_'+str(row)+'_'+str(column), self) for column in range(8) ] matrix.add_row(tuple(button_row)) self._config_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 0, 0) self._config_button.add_value_listener(self._config_value) top_buttons = [ FlashingButtonElement(is_momentary, MIDI_CC_TYPE, 0, (104 + index), 'Top_Button'+str(index), self) for index in range(8) ] side_buttons = [ FlashingButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, SIDE_NOTES[index], 'Side_Button'+str(index), self) for index in range(8) ] self._setup_monobridge() self._setup_monomod() self._selector = MainSelectorComponent(matrix, tuple(top_buttons), tuple(side_buttons), self._config_button, self) self._suppress_session_highlight = False self._suppress_send_midi = False self._user_byte_write_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 0, 16) self._user_byte_write_button.send_value(1) self._user_byte_write_button.add_value_listener(self._user_byte_value) self._suppress_send_midi = True self.set_suppress_rebuild_requests(False) self.log_message("--------------= LaunchMod log opened =--------------") #Create entry in log file self.refresh_state()
def _setup_session_control(self): is_momentary = True self._shift_button = AumPCMonoButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 81, 'Shift_Button', self) self._session = APCSessionComponent(8, 5) self._session.name = 'Session_Control' self._matrix = ButtonMatrixElement() self._matrix.name = 'Button_Matrix' scene_launch_buttons = [ AumPCMonoButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, (index + 82), 'Scene_' + str(index) + '_Launch_Button', self) for index in range(5) ] self._scene_launch_buttons = scene_launch_buttons track_stop_buttons = [ AumPCMonoButtonElement(is_momentary, MIDI_NOTE_TYPE, index, 52, 'Track_' + str(index) + '_Stop_Button', self) for index in range(8) ] self._track_stop_buttons = track_stop_buttons for index in range(len(scene_launch_buttons)): scene_launch_buttons[index].name = 'Scene_' + str(index) + '_Launch_Button' for index in range(len(track_stop_buttons)): track_stop_buttons[index].name = 'Track_' + str(index) + '_Stop_Button' self._session.set_stop_track_clip_buttons(tuple(track_stop_buttons)) self._session.set_stop_track_clip_value(2) for scene_index in range(5): scene = self._session.scene(scene_index) scene.name = 'Scene_' + str(scene_index) button_row = [] scene.set_launch_button(scene_launch_buttons[scene_index]) scene.set_triggered_value(2) for track_index in range(8): button = AumPCMonoButtonElement(is_momentary, MIDI_NOTE_TYPE, track_index, (scene_index + 53), '_Clip_' + str(scene_index) + '_Button', self) button.name = str(track_index) + '_Clip_' + str(scene_index) + '_Button' button_row.append(button) clip_slot = scene.clip_slot(track_index) clip_slot.name = str(track_index) + '_Clip_Slot_' + str(scene_index) clip_slot.set_triggered_to_play_value(2) clip_slot.set_triggered_to_record_value(4) clip_slot.set_stopped_value(5) clip_slot.set_started_value(1) clip_slot.set_recording_value(3) clip_slot.set_launch_button(button) self._matrix.add_row(tuple(button_row)) self._session.selected_scene().name = 'Selected_Scene' self._session.selected_scene().set_launch_button(ButtonElement(is_momentary, MIDI_CC_TYPE, 0, 64)) self._session_zoom = ShiftableZoomingComponent(self._session, tuple(track_stop_buttons)) self._session_zoom.name = 'Session_Overview' self._session_zoom.set_button_matrix(self._matrix) self._session_zoom.set_zoom_button(self._shift_button) self._session_zoom.set_scene_bank_buttons(tuple(scene_launch_buttons)) self._session_zoom.set_stopped_value(3) self._session_zoom.set_selected_value(5)
def _setup_controls(self): self._pedal = [None for index in range(12)] for index in range(9): self._pedal[index] = DoublePressElement(MonoButtonElement(True, MIDI_NOTE_TYPE, 0, PEDAL_DEFS[index], 'Pedal_'+str(index), self)) #is_momentary, MIDI_NOTE_TYPE, CHANNEL, LIVID, 'Livid_Button', self self._pedal[index].name = 'Pedal_'+str(index) self._pedal[index]._report = False self._pedal[9] = LoopPedalExpressionElement(self, MIDI_CC_TYPE, 0, 3, Live.MidiMap.MapMode.absolute) self._pedal[9].name = 'Pedal_'+str(9) self._pedal[9]._report = False self._pedal[10] = LoopPedalExpressionElement(self, MIDI_CC_TYPE, 0, 1, Live.MidiMap.MapMode.absolute) self._pedal[10].name = 'Pedal_'+str(10) self._pedal[10]._report = False self._pedal[11] = LoopPedalExpressionElement(self, MIDI_CC_TYPE, 0, 2, Live.MidiMap.MapMode.absolute) self._pedal[11].name = 'Pedal_'+str(11) self._pedal[11]._report = False self._leds = [self._pedal[6], self._pedal[5], self._pedal[4], self._pedal[3]] self._side_buttons = [MonoButtonElement(True, MIDI_NOTE_TYPE, 0, SIDE_DEFS[index], 'Side_Button_'+str(index), self) for index in range(4)] self._select_buttons = ButtonMatrixElement() self._select_buttons.name = 'SelectMatrix' self._select_buttons.add_row([self._pedal[6], self._pedal[5], self._pedal[4], self._pedal[3]]) self._doublepress_select_buttons = ButtonMatrixElement() self._doublepress_select_buttons.name = 'DoublepressSelectMatrix' self._doublepress_select_buttons.add_row([self._pedal[6].double_press, self._pedal[5].double_press, self._pedal[4].double_press, self._pedal[3].double_press]) self._record_button = self._pedal[1] self._mute_button = self._pedal[2] self._overdub_button = self._pedal[0] self._clear_button = self._pedal[7] self._reverse_button = self._pedal[8] self._record_button.turn_off() self._mute_button.turn_off() self._overdub_button.turn_off() self._clear_button.turn_off() self._reverse_button.turn_off()
def _create_controls(self): self._device_encoders = ButtonMatrixElement(rows=[ [ EncoderElement(MIDI_CC_TYPE, ENCODER_CHANNEL, identifier, Live.MidiMap.MapMode.relative_smooth_binary_offset, name='Device_Encoder_%d_%d' % (col_index, row_index)) for col_index, identifier in enumerate(row) ] for row_index, row in enumerate((ENCODER_MSG_IDS[:4], ENCODER_MSG_IDS[4:8])) ]) self._horizontal_scroll_encoder = EncoderElement(MIDI_CC_TYPE, ENCODER_CHANNEL, ENCODER_MSG_IDS[-2], Live.MidiMap.MapMode.relative_smooth_binary_offset, name='Horizontal_Scroll_Encoder') self._vertical_scroll_encoder = EncoderElement(MIDI_CC_TYPE, ENCODER_CHANNEL, ENCODER_MSG_IDS[-1], Live.MidiMap.MapMode.relative_smooth_binary_offset, name='Vertical_Scroll_Encoder') self._volume_sliders = ButtonMatrixElement(rows=[[ SliderElement(MIDI_CC_TYPE, ENCODER_CHANNEL, identifier) for identifier in SLIDER_MSG_IDS[:-1] ]]) self._master_slider = SliderElement(MIDI_CC_TYPE, ENCODER_CHANNEL, SLIDER_MSG_IDS[-1]) def make_keylab_button(name): button = ButtonElement(True, MIDI_CC_TYPE, 0, get_button_identifier_by_name(name), name=name.title()) return button for button_name in BUTTON_HARDWARE_AND_MESSAGE_IDS.keys(): setattr(self, '_' + button_name, make_keylab_button(button_name)) self._pads = ButtonMatrixElement(rows=[ [ ButtonElement(True, MIDI_CC_TYPE, PAD_CHANNEL, col_index + row_offset, name='Pad_%d_%d' % (col_index, row_index)) for col_index in xrange(4) ] for row_index, row_offset in enumerate(xrange(48, 35, -4)) ])
def setup_matrix(self, matrix): self.button_matrix = ButtonMatrixElement() for scene_index, row in enumerate(matrix): scene = self.scene(scene_index) scene.name = 'Scene_' + str(scene_index) button_row = [self.button(cc, blink_on = True, off_color = OFF) for cc in row] for i, cc in enumerate(row): clip_slot = scene.clip_slot(i) clip_slot.set_triggered_to_play_value(YELLOW) clip_slot.set_triggered_to_record_value(PURPLE) clip_slot.set_stopped_value(CYAN) clip_slot.set_started_value(GREEN) clip_slot.set_launch_button(button_row[i]) self.button_matrix.add_row(tuple(button_row))
def _set_up_buttons(self): self._bmatrix = ButtonMatrixElement() for scene_index in range(4): button_row = [] scene = self._session.scene(scene_index) for track_index in range(4): button = self._matrix[scene_index][track_index] clip_slot = scene.clip_slot(track_index) clip_slot.set_launch_button(button) clip_slot.set_triggered_to_play_value(1) clip_slot.set_triggered_to_record_value(1) clip_slot.set_started_value(1) clip_slot.set_recording_value(1) clip_slot.set_stopped_value(1) self._bmatrix.add_row(tuple(button_row))