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, 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 __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, *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) 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 _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 _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, c_instance): ControlSurface.__init__(self, c_instance) with self.component_guard(): self._suppress_send_midi = True self._suppress_session_highlight = True self._control_is_with_automap = False is_momentary = True self._suggested_input_port = 'Akai MPD26' self._suggested_output_port = 'Akai MPD26' """SESSION ViEW""" session = SessionComponent(4,4) session.name = 'Session_Control' matrix = ButtonMatrixElement() matrix.name = 'Button_Matrix' up_button = ButtonElement(False, MIDI_CC_TYPE, 0, 115) down_button = ButtonElement(False, MIDI_CC_TYPE, 0, 116) up_button.name = 'Bank_Select_Up_Button' down_button.name = 'Bank_Select_Down_Button' session.set_scene_bank_buttons(down_button, up_button) for row in range(4): button_row = [] button_notes = [48, 44, 40, 36] scene = session.scene(row) scene.name = 'Scene_' + str(row) for column in range(4): button = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, button_notes[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)) self._suppress_session_highlight = False self._suppress_send_midi = False self.set_highlighting_session_component(session) #self._set_session_highlight(0,session._scene_offset,4,4,False) """TRANSPORT CONTROLS""" stop_button = ButtonElement(False, MIDI_CC_TYPE, 0, 117) play_button = ButtonElement(False, MIDI_CC_TYPE, 0, 118) transport = TransportComponent() transport.set_stop_button(stop_button) transport.set_play_button(play_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 = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 87) right_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 0, 107) #78 left_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 0, 106) #77 right_button.name = 'Bank_Select_Right_Button' left_button.name = 'Bank_Select_Left_Button' global session session = SessionComponent(8, 40) session.name = 'Session_Control' session.set_track_bank_buttons(right_button, left_button) matrix = ButtonMatrixElement() matrix.name = 'Button_Matrix' scene_launch_notes = [56, 57, 58, 59, 60, 61, 62, 63] scene_launch_buttons = [ ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, scene_launch_notes[index]) for index in range(8) ] track_stop_buttons = [ ButtonElement(is_momentary, MIDI_CC_TYPE, CHANNEL, (index + 28)) 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' session.set_stop_track_clip_buttons(tuple(track_stop_buttons)) for scene_index in range(8): scene = 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(7): button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, (track_index * 8) + scene_index) button.name = str(track_index) + '_Clip_' + str( scene_index) + '_Button' button_row.append(button) clip_slot = scene.clip_slot(track_index) clip_slot.set_stopped_value(0) clip_slot.set_started_value(64) 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)) session.selected_scene().name = 'Selected_Scene' #session.selected_scene().set_launch_button(ButtonElement(is_momentary, MIDI_CC_TYPE, 0, 64)) #session_zoom = SessionZoomingComponent(session) #session_zoom.name = 'Session_Overview' #session_zoom.set_button_matrix(matrix) #session_zoom.set_zoom_button(self._shift_button) #session_zoom.set_nav_buttons(up_button, down_button, left_button, right_button) #session_zoom.set_scene_bank_buttons(tuple(scene_launch_buttons)) #session_zoom.set_stopped_value(0) #session_zoom.set_selected_value(127) session.set_mixer(mixer) return None #return session
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): live = Live.Application.get_application() self._live_major_version = live.get_major_version() self._live_minor_version = live.get_minor_version() self._live_bugfix_version = live.get_bugfix_version() self._mk2 = Settings.DEVICE == 'Launchpad mk2' if self._mk2: self._skin = Skin('Launchpad mk2') self._side_notes = (89, 79, 69, 59, 49, 39, 29, 19) self._drum_notes = (20, 30, 31, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126) else: self._skin = Skin('Launchpad') self._side_notes = (8, 24, 40, 56, 72, 88, 104, 120) self._drum_notes = (41, 42, 43, 44, 45, 46, 47, 57, 58, 59, 60, 61, 62, 63, 73, 74, 75, 76, 77, 78, 79, 89, 90, 91, 92, 93, 94, 95, 105, 106, 107) ControlSurface.__init__(self, c_instance) with self.component_guard(): self._suppress_send_midi = True self._suppress_session_highlight = True is_momentary = True if self._mk2: self._suggested_input_port = 'Launchpad' self._suggested_output_port = 'Launchpad' else: self._suggested_input_port = 'Launchpad MK2' self._suggested_output_port = 'Launchpad MK2' 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): if self._mk2: # for mk2 buttons are assigned "top to bottom" midi_note = (81 - (10 * row)) + column else: midi_note = row * 16 + column button = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, midi_note, self._skin.off) 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, self._skin.off) for index in range(8)] side_buttons = [ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, self._side_notes[index], self._skin.off) 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._osd = M4LInterface() self._osd.name = "OSD" self._selector = MainSelectorComponent(matrix, tuple(top_buttons), tuple(side_buttons), self._config_button, self._osd, self, self._skin) 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.log_message("LaunchPad95 Loaded !")
def _setup_session_control(self): self.session = CustomSessionComponent(self.box_width, self.box_height, self) # subclass from _Framework is_momentary = True # what exactly does this do in the _Framework? if up_button_note_number >= 0 and down_button_note_number >= 0: # opt in enable UP/DOWN nav up_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, midi_channel, up_button_note_number) up_button.name = 'Bank_Select_Up_Button' # sure, why not down_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, midi_channel, down_button_note_number) down_button.name = 'Bank_Select_Down_Button' #sure, why not self.session.set_scene_bank_buttons(down_button, up_button) if right_button_note_number >= 0 and left_button_note_number >= 0: # opt in enable LEFT/RIGHT nav right_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, midi_channel, right_button_note_number) right_button.name = 'Bank_Select_Right_Button' #sure, why not left_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, midi_channel, left_button_note_number) left_button.name = 'Bank_Select_Left_Button' #sure, why not self.session.set_track_bank_buttons(right_button, left_button) self.session.name = 'Session_Control' #sure, why not matrix = ButtonMatrixElement() # @todo subclass this via established new patterns matrix.name = 'Button_Matrix' #sure, why not # I loop a little different. The goal is readbility, flexibility, and the web app...incase you did not notice yet if len(scene_launch_notes) > 0 and len(scene_launch_notes) == self.box_height: # logic check have launch notes and scene = box height for index in range(self.box_height): self.session.scene(index).set_launch_button(ButtonElement(is_momentary, MIDI_NOTE_TYPE, midi_channel, scene_launch_notes[index])) else : self.log_message("..::|| Scene launch not in use or error on case of use. Modern.DJ ||::..") if len(stop_track_buttons) >0 and len(stop_track_buttons) == self.box_width: #logic check have track stop assignments and track_stop_buttons = [ ButtonElement(is_momentary, MIDI_NOTE_TYPE, midi_channel, stop_track_buttons[index]) for index in range(len(stop_track_buttons))] for index in range(len(track_stop_buttons)): track_stop_buttons[index].name = 'Track_' + str(index) + '_Stop_Button' # sure, why not self.session.set_stop_track_clip_buttons(tuple(track_stop_buttons)) else : self.log_message("..::|| Stop notes not in use or error found Modern.DJ ||::..") # Check for stop all clips option if stop_all_clips >=0 : self.session.set_stop_all_clips_button(ButtonElement(is_momentary, MIDI_NOTE_TYPE, midi_channel, stop_all_clips)) # creating the matrix of buttons from the launch_button_list (tuple) launch_button_list_len = len(launch_button_list) # var used multiple times. This is a performance modification if (self.box_height*self.box_width) == launch_button_list_len : # check box size against number of button vars sent launch_ctr = launch_button_list_len -1 # decrement for zero offset in list/tuple launch_button_list.reverse() #reverse list from human readable for decrement use (performance tweak) ## check for use of RGB if use_velocity_for_RGB != 1: # if not enabled use these defaults self.log_message("..::|| RGB not in effect assigning defaults ||::..") self.clip_loaded_stopped = 1 self.clip_currently_playing = 127 self.clip_triggered_to_play = 64 else: # yes RGB in effect...assign per the parameters script self.clip_loaded_stopped = clip_loaded_stopped self.clip_currently_playing = clip_currently_playing self.clip_triggered_to_play = clip_triggered_to_play for scene_index in range(self.box_height): # loop on the notes matrix scene = self.session.scene(scene_index) # part of the martix built, think rows scene.name = 'Scene_' + str(scene_index) # sure, why not button_row = [] # create recepticle # loop across the tracks for track_index in range(self.box_width): button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, midi_channel, launch_button_list[launch_ctr]) # button instance for _Framework launch_ctr = launch_ctr -1# decrement is faster than increment button.name = str(track_index) + '_Clip_' + str(scene_index) + '_Button' # sure, why not button_row.append(button) # add to our growing list clip_slot = scene.clip_slot(track_index) # clips slot and buttons are not the same thing, this aligns these ideas in the red box clip_slot.name = str(track_index) + '_Clip_Slot_' + str(scene_index) # sure, why not # assign the button and and status in th refrech update clip_slot.set_stopped_value(self.clip_loaded_stopped ) # this number is sent back to the machine allowing diff colors for stopped clip_slot.set_started_value(self.clip_currently_playing) # this number is sent back to the machine allowing diff colors for started/is-playing clip_slot.set_triggered_to_play_value(self.clip_triggered_to_play) # this number is sent back to the machine allowing diff colors for cued, will play next clip_slot.set_launch_button(button) # part of the slit+button = go time paradigm matrix.add_row(tuple(button_row)) # close out the matrix build. @todo - possible subclass here? else : # log message self.log_message("..::|| Number of notes defined does not match box height and width Modern.DJ ||::..") ''' live 9 only self.set_highlighting_session_component(self.session) # new for live9 -- this is for the box. via aumhaa/bitnomad ''' return None
def _setup_session_control(self): is_momentary = True right_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHAN, 43) left_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHAN, 42) up_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHAN, 44) down_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHAN, 45) right_button.name = 'Bank_Select_Right_Button' left_button.name = 'Bank_Select_Left_Button' up_button.name = 'Bank_Select_Up_Button' down_button.name = 'Bank_Select_Down_Button' global session session = SessionComponent(4, 4) session.name = 'Session_Control' session.set_track_bank_buttons(right_button, left_button) session.set_scene_bank_buttons(down_button, up_button) self._session = session matrix = ButtonMatrixElement() matrix.name = 'Button_Matrix' scene_launch_notes = [33,34,35,36] scene_launch_buttons = [ ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHAN, scene_launch_notes[index]) for index in range(4) ] #track_stop_buttons = [ ButtonElement(is_momentary, MIDI_NOTE_TYPE, index, 52) for index in range(4) ] 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' #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_clip_value(2) button_notes = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32] for scene_index in range(4): scene = 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(4): button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHAN, (track_index * 4) + scene_index + 1) 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(0) clip_slot.set_started_value(64) #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)) session.selected_scene().name = 'Selected_Scene' #session.selected_scene().set_launch_button(ButtonElement(is_momentary, MIDI_CC_TYPE, 0, 64)) #session_zoom = SessionZoomingComponent(session) #session_zoom.name = 'Session_Overview' #session_zoom.set_button_matrix(matrix) #session_zoom.set_zoom_button(self._shift_button) #session_zoom.set_nav_buttons(up_button, down_button, left_button, right_button) #session_zoom.set_scene_bank_buttons(tuple(scene_launch_buttons)) #session_zoom.set_stopped_value(0) #session_zoom.set_selected_value(127) self.set_highlighting_session_component(session) session.set_mixer(mixer) return None #return session
def __init__(self, c_instance): live = Live.Application.get_application() self._live_major_version = live.get_major_version() self._live_minor_version = live.get_minor_version() self._live_bugfix_version = live.get_bugfix_version() self._mk2_rgb = Settings.DEVICE == 'Launchpad mk2' if self._mk2_rgb: self._skin = Skin('launchpad mk2') self._side_notes = (89, 79, 69, 59, 49, 39, 29, 19) self._drum_notes = (20, 30, 31, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126) else: self._skin = Skin('launchpad') self._side_notes = (8, 24, 40, 56, 72, 88, 104, 120) self._drum_notes = (41, 42, 43, 44, 45, 46, 47, 57, 58, 59, 60, 61, 62, 63, 73, 74, 75, 76, 77, 78, 79, 89, 90, 91, 92, 93, 94, 95, 105, 106, 107) ControlSurface.__init__(self, c_instance) with self.component_guard(): self._suppress_send_midi = True self._suppress_session_highlight = True is_momentary = True if self._mk2_rgb: self._suggested_input_port = ("Launchpad", "Launchpad Mini", "Launchpad S") self._suggested_output_port = ("Launchpad", "Launchpad Mini", "Launchpad S") else: self._suggested_input_port = "Launchpad MK2" self._suggested_output_port = "Launchpad MK2" 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): if self._mk2_rgb: # for mk2 buttons are assigned "top to bottom" midi_note = (81 - (10 * row)) + column else: midi_note = row * 16 + column button = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, midi_note, self._skin.off) 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, self._skin.off) for index in range(8) ] side_buttons = [ ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, self._side_notes[index], self._skin.off) 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._osd = M4LInterface() self._osd.name = "OSD" self._selector = MainSelectorComponent(matrix, tuple(top_buttons), tuple(side_buttons), self._config_button, self._osd, 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.log_message("LaunchPad95 Loaded !")
def __init__(self, c_instance): ControlSurface.__init__(self, c_instance) with self.component_guard(): self._monomod_version = "b995" self._host_name = "LaunchMod" self._color_type = "Launchpad" self.hosts = [] self._timer = 0 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 = [ 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._setup_monobridge() self._setup_monomod() 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, MonoButtonElement): 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 =--------------" ) # Create entry in log file
def _setup_session_control(self): is_momentary = True self._shift_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 98) right_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 96) left_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 97) up_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 94) down_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 95) right_button.name = 'Bank_Select_Right_Button' left_button.name = 'Bank_Select_Left_Button' up_button.name = 'Bank_Select_Up_Button' down_button.name = 'Bank_Select_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() matrix.name = 'Button_Matrix' self.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(self.scene_launch_buttons)): self.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.stop_all_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 81) self.stop_all_button.name = 'Stop_All_Clips_Button' self._session.set_stop_all_clips_button(self.stop_all_button) self._session.set_stop_track_clip_buttons(tuple(track_stop_buttons)) self._session.set_stop_track_clip_value(2) ## Quirksmode self.newZoom_buttons = [] for scene_index in range(5): scene = self._session.scene(scene_index) scene.name = 'Scene_' + str(scene_index) button_row = [] scene.set_launch_button(self.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)) ## Quirksmode - This moves the zoomer to allow for scene launch customisation (Currently not working 100%) if(track_index == 4): self.newZoom_buttons.append(button) 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(3) 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(self.newZoom_buttons)) self._session_zoom.set_stopped_value(3) self._session_zoom.set_selected_value(5) return None #return session
def __init__(self, c_instance): ControlSurface.__init__(self, c_instance) with self.component_guard(): #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" """ TRACKFINDER TEST track_index = 0 for track in self.song().tracks: if track_index < 8: button_row = [] if track.is_foldable: for column in range(8): log("right one: " + str(track_index)) button = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, ((track_index * 16) + column)) #@UndefinedVariable button.name = (((str(column) + "_Clip_") + str(track_index)) + "_Button") button_row.append(button) track_index = track_index + 1 else: for column in range(8): log("wrong one: " + str(track_index)) button = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 99, True) #@UndefinedVariable button.name = (str(column) + "_Clip_Button-DUMMY") button_row.append(button) matrix.add_row(tuple(button_row)) log("done")""" """ ORIGINAL CODE """ 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._device_selection_follows_track_selection = True with self.component_guard(): self._suppress_send_midi = True self._suppress_session_highlight = True self._control_is_with_automap = False is_momentary = True self._suggested_input_port = 'Akai MPD26' self._suggested_output_port = 'Akai MPD26' self.log("BEFORE mixer") self._setup_mixer_control() self._setup_device_control() # self.clipcontrol(8) self.log("AFTER MIXER") """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_NOTE_TYPE, CHANNEL, UP_BUTTON) down_button = ButtonElement(True, MIDI_NOTE_TYPE, CHANNEL, DOWN_BUTTON) left_button = ButtonElement(True, MIDI_NOTE_TYPE, CHANNEL, LEFT_BUTTON) right_button = ButtonElement(True, MIDI_NOTE_TYPE, CHANNEL, RIGHT_BUTTON) # session.set_scene_bank_buttons(down_button, up_button) #enabling these and disabling the below zoom buttons will move one scene/track per button press # session.set_track_bank_buttons(right_button, left_button) # session_zoom = SessionZoomingComponent(session) session_zoom.set_nav_buttons( up_button, down_button, left_button, right_button ) #these make it so you move the maximum number of scenes/tracks per button press. much more useful than moving by single scenes/tracks session_stop_buttons = [] for row in range(GRIDSIZE[0]): button_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) session_stop_buttons.append( (ButtonElement(True, MIDI_NOTE_TYPE, CHANNEL, TRACK_STOPS[row]))) for column in range(GRIDSIZE[1]): 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)) self._suppress_session_highlight = False self._suppress_send_midi = False self.set_highlighting_session_component(session) session.set_mixer(mixer) session.set_stop_track_clip_buttons(tuple(session_stop_buttons))
def __init__(self, c_instance): live = Live.Application.get_application() self._live_major_version = live.get_major_version() self._live_minor_version = live.get_minor_version() self._live_bugfix_version = live.get_bugfix_version() ControlSurface.__init__(self, c_instance) #self._device_selection_follows_track_selection = True 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) # Apparently this CC is used to enable feedback, ie lighting up buttons that you pressed 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, (7-row) * 8 + column) # APCmini rows are in reverse order from Launchpad 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) # Control goes through here on LP, no real equivalent in APCmini (I don't think) self._config_button.add_value_listener(self._config_value) top_buttons = [ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 64 + 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._osd = M4LInterface() self._osd.name = "OSD" self._selector = MainSelectorComponent(matrix, tuple(top_buttons), tuple(side_buttons), self._config_button, self._osd, 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.log_message("LaunchPad95 Loaded !")
def init(self): #skip init if already done. if self._init_done: return self._init_done = True # second part of the __init__ after model has been identified using its challenge response if self._mk2_rgb: from SkinMK2 import make_skin self._skin = make_skin() self._side_notes = (89, 79, 69, 59, 49, 39, 29, 19) #self._drum_notes = (20, 30, 31, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126) self._drum_notes = (20, 30, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126) else: from SkinMK1 import make_skin self._skin = make_skin() self._side_notes = (8, 24, 40, 56, 72, 88, 104, 120) self._drum_notes = (41, 42, 43, 44, 45, 46, 47, 57, 58, 59, 60, 61, 62, 63, 73, 74, 75, 76, 77, 78, 79, 89, 90, 91, 92, 93, 94, 95, 105, 106, 107) with self.component_guard(): is_momentary = True self._config_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 0, 0, optimized_send_midi=False) self._config_button.add_value_listener(self._config_value) 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) matrix = ButtonMatrixElement() matrix.name = 'Button_Matrix' for row in range(8): button_row = [] for column in range(8): if self._mk2_rgb: # for mk2 buttons are assigned "top to bottom" midi_note = (81 - (10 * row)) + column else: midi_note = row * 16 + column button = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, midi_note, skin = self._skin, control_surface = self) button.name = str(column) + '_Clip_' + str(row) + '_Button' button_row.append(button) matrix.add_row(tuple(button_row)) top_buttons = [ConfigurableButtonElement(is_momentary, MIDI_CC_TYPE, 0, 104 + index, skin = self._skin) for index in range(8)] side_buttons = [ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, self._side_notes[index], skin = self._skin) 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._osd = M4LInterface() self._osd.name = "OSD" self._selector = MainSelectorComponent(matrix, tuple(top_buttons), tuple(side_buttons), self._config_button, self._osd, 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 # due to our 2 stage init, we need to rebuild midi map self.request_rebuild_midi_map() # and request update self._selector.update() if self._mk2_rgb: self.log_message("LaunchPad95 (mk2) Loaded !") else: self.log_message("LaunchPad95 Loaded !")
def _setup_session_control(self): is_momentary = True self._shift_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 98) right_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 96) left_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 97) up_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 94) down_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 95) right_button.name = 'Bank_Select_Right_Button' left_button.name = 'Bank_Select_Left_Button' up_button.name = 'Bank_Select_Up_Button' down_button.name = 'Bank_Select_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() 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' 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 = 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) 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 _setup_session_control(self): is_momentary = True self._shift_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 98) right_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 96) left_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 97) up_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 94) down_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 95) right_button.name = "Bank_Select_Right_Button" left_button.name = "Bank_Select_Left_Button" up_button.name = "Bank_Select_Up_Button" down_button.name = "Bank_Select_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() matrix.name = "Button_Matrix" scene_launch_buttons = [ ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, (index + 82)) for index in range(5) ] self._double_buttons = [ ConfigurableButtonElement(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" 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 = 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(3) clip_slot.set_started_value(1) clip_slot.set_recording_value(5) 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) scene_user_mode = SceneUserModeComponent(self._session, self._session_zoom, self) return None # return session
def __init__(self, c_instance): ControlSurface.__init__(self, c_instance) self._device_selection_follows_track_selection = True with self.component_guard(): self._suppress_send_midi = True self._suppress_session_highlight = True self._control_is_with_automap = False is_momentary = True self._suggested_input_port = 'Akai MPK26' self._suggested_output_port = 'Akai MPK26' self.log("BEFORE mixer") self._setup_mixer_control() self._setup_device_control() # self.clipcontrol(8) self.log("AFTER MIXER") """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_MIXER, UP_BUTTON) down_button = ButtonElement(True, MIDI_CC_TYPE, CHANNEL_MIXER, DOWN_BUTTON) left_button = ButtonElement(True, MIDI_CC_TYPE, CHANNEL_MIXER, LEFT_BUTTON) right_button = ButtonElement(True, MIDI_CC_TYPE, CHANNEL_MIXER, RIGHT_BUTTON) session.set_scene_bank_buttons(down_button, up_button) session.set_track_bank_buttons(right_button, left_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_MIXER, 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_MIXER, 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 _setup_session_control(self): is_momentary = True self._shift_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 87) right_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 67) left_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 66) up_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 71) down_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 68) right_button.name = 'Bank_Select_Right_Button' left_button.name = 'Bank_Select_Left_Button' up_button.name = 'Bank_Select_Up_Button' down_button.name = 'Bank_Select_Down_Button' global session session = SessionComponent(7, 8) session.name = 'Session_Control' session.set_track_bank_buttons(right_button, left_button) session.set_scene_bank_buttons(down_button, up_button) matrix = ButtonMatrixElement() matrix.name = 'Button_Matrix' scene_launch_notes = [56,57,58,59,60,61,62,63] scene_launch_buttons = [ ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, scene_launch_notes[index]) for index in range(8) ] #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' #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) #button_notes = [0,8,16,24,32,40,48,56,1,9,17,25,33,41,49,57,2,10,18,26,34,42,50,58,3,11,19,27,35,43,51,59,4,12,20,28,36,44,52,60,5,13,21,29,37,45,53,61,6,14,22,30,38,46,54,62] for scene_index in range(8): scene = 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(7): button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, (track_index * 8) + scene_index) 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(0) clip_slot.set_started_value(64) #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)) session.selected_scene().name = 'Selected_Scene' #session.selected_scene().set_launch_button(ButtonElement(is_momentary, MIDI_CC_TYPE, 0, 64)) #session_zoom = SessionZoomingComponent(session) #session_zoom.name = 'Session_Overview' #session_zoom.set_button_matrix(matrix) #session_zoom.set_zoom_button(self._shift_button) #session_zoom.set_nav_buttons(up_button, down_button, left_button, right_button) #session_zoom.set_scene_bank_buttons(tuple(scene_launch_buttons)) #session_zoom.set_stopped_value(0) #session_zoom.set_selected_value(127) session.set_mixer(mixer) self.set_highlighting_session_component(session) return None #return session
def __init__(self, c_instance): ControlSurface.__init__(self, c_instance) with self.component_guard(): #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" """ TRACKFINDER TEST track_index = 0 for track in self.song().tracks: if track_index < 8: button_row = [] if track.is_foldable: for column in range(8): log("right one: " + str(track_index)) button = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, ((track_index * 16) + column)) #@UndefinedVariable button.name = (((str(column) + "_Clip_") + str(track_index)) + "_Button") button_row.append(button) track_index = track_index + 1 else: for column in range(8): log("wrong one: " + str(track_index)) button = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 99, True) #@UndefinedVariable button.name = (str(column) + "_Clip_Button-DUMMY") button_row.append(button) matrix.add_row(tuple(button_row)) log("done")""" """ ORIGINAL CODE """ 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 _setup_session_control(self): is_momentary = True self._shift_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 87) right_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 78) left_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 77) up_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 71) down_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 79) right_button.name = 'Bank_Select_Right_Button' left_button.name = 'Bank_Select_Left_Button' up_button.name = 'Bank_Select_Up_Button' down_button.name = 'Bank_Select_Down_Button' global session session = SessionComponent(7, 8) session.name = 'Session_Control' session.set_track_bank_buttons(right_button, left_button) session.set_scene_bank_buttons(down_button, up_button) matrix = ButtonMatrixElement() matrix.name = 'Button_Matrix' scene_launch_notes = [56,57,58,59,60,61,62,63] scene_launch_buttons = [ ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, scene_launch_notes[index]) for index in range(8) ] #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' #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) #button_notes = [0,8,16,24,32,40,48,56,1,9,17,25,33,41,49,57,2,10,18,26,34,42,50,58,3,11,19,27,35,43,51,59,4,12,20,28,36,44,52,60,5,13,21,29,37,45,53,61,6,14,22,30,38,46,54,62] for scene_index in range(8): scene = 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(7): button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, (track_index * 8) + scene_index) 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(0) clip_slot.set_started_value(64) #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)) session.selected_scene().name = 'Selected_Scene' #session.selected_scene().set_launch_button(ButtonElement(is_momentary, MIDI_CC_TYPE, 0, 64)) #session_zoom = SessionZoomingComponent(session) #session_zoom.name = 'Session_Overview' #session_zoom.set_button_matrix(matrix) #session_zoom.set_zoom_button(self._shift_button) #session_zoom.set_nav_buttons(up_button, down_button, left_button, right_button) #session_zoom.set_scene_bank_buttons(tuple(scene_launch_buttons)) #session_zoom.set_stopped_value(0) #session_zoom.set_selected_value(127) session.set_mixer(mixer) return None #return session