def create_slider(identifier, name, **k): slider = SliderElement(MIDI_CC_TYPE, BUTTON_FADER_MAIN_CHANNEL, identifier, name=name, **k) slider.set_needs_takeover(False) return slider
def _create_controls(self): self._hardware_live_mode_switch = SysexElement(send_message_generator=lambda b: sysex.LIVE_MODE_MESSAGE_HEADER + ( b, sysex.END_BYTE), default_value=sysex.OFF_VALUE, name=b'Hardware_Live_Mode_Switch') self._memory_preset_switch = SysexElement(send_message_generator=lambda b: sysex.MEMORY_PRESET_SWITCH_MESSAGE_HEADER + ( b, sysex.END_BYTE), sysex_identifier=sysex.MEMORY_PRESET_SWITCH_MESSAGE_HEADER, name=b'Memory_Preset_Switch') self._memory_preset_select_mode_switch = SysexElement(sysex_identifier=sysex.MEMORY_PRESET_SELECT_MODE_MESSAGE_HEADER, name=b'Memory_Preset_Select_Mode') self._play_button = create_button(94, b'Play_Button') self._stop_button = create_button(93, b'Stop_Button') self._punch_in_button = create_button(87, b'Punch_In_Button') self._punch_out_button = create_button(88, b'Punch_Out_Button') self._metronome_button = create_button(89, b'Metronome_Button') self._loop_button = create_button(86, b'Loop_Button') self._rwd_button = create_button(91, b'Rewind_Button') self._ff_button = create_button(92, b'Fast_Forward_Button') self._record_button = create_button(95, b'Record_Button') self._undo_button = create_button(81, b'Undo_Button') self._bank_left_button = create_button(46, b'Bank_Left_Button') self._bank_right_button = create_button(47, b'Bank_Right_Button') self._left_button = create_button(48, b'Left_Button') self._right_button = create_button(49, b'Right_Button') self._left_arrow_button = create_button(98, b'Left_Arrow_Button') self._right_arrow_button = create_button(99, b'Right_Arrow_Button') self._marker_button = create_button(84, b'Marker_Button') self._pads = ButtonMatrixElement(rows=[ [ create_button(col + 36, b'Pad_%d' % (col,), channel=10) for col in xrange(8) ]], name=b'Pad_Matrix') self._pad_leds = ButtonMatrixElement(rows=[ [ create_pad_led(column + 112, b'Pad_LED_%d' % (column,)) for column in xrange(8) ]], name=b'Pad_LED_Matrix') self._faders = ButtonMatrixElement(rows=[ [ SliderElement(msg_type=MIDI_PB_TYPE, channel=index, identifier=None, name=b'Fader_%d' % (index,)) for index in xrange(8) ]], name=b'Faders') self._master_fader = SliderElement(MIDI_PB_TYPE, 8, identifier=None, name=b'Master_Fader') self._encoders = ButtonMatrixElement(rows=[ [ create_ringed_encoder(index + 16, index + 48, b'Encoder_%d' % (index,)) for index in xrange(8) ]]) self._jogwheel = EncoderElement(MIDI_CC_TYPE, 0, 60, Live.MidiMap.MapMode.relative_smooth_signed_bit, name=b'Jogwheel') return
def create_slider_element(identifier, name): return SliderElement(MIDI_CC_TYPE, MIDI_CHANNEL, identifier, name=name)
def make_slider(channel, name): return SliderElement(MIDI_PB_TYPE, channel, 0, name=name)
def __init__(self, product_id=None, skin=None, *a, **k): super(Elements, self).__init__(*a, **k) self._product_id = product_id self._skin = skin volume_encoder_touch_elements = [ self._make_note_button(13, index, (b'Volume_Encoder_Touch_Element_{}').format(index)) for index in xrange(NUM_TRACK_CONTROLS) ] tui_volume_sliders = [ SliderElement(MIDI_CC_TYPE, index + 1, 0, name=(b'TUI_Volume_Slider_{}').format(index)) for index in xrange(NUM_TRACK_CONTROLS) ] for slider in tui_volume_sliders: slider.set_feedback_delay(1) physical_volume_encoders = [ TouchEncoderElement(MIDI_CC_TYPE, 13, index, Live.MidiMap.MapMode.relative_smooth_two_compliment, name=(b'Physical_Volume_Encoder_{}').format(index), touch_element=volume_encoder_touch_elements[index]) for index in xrange(NUM_TRACK_CONTROLS) ] for encoder in physical_volume_encoders: encoder.set_feedback_delay(1) self.volume_sliders = ButtonMatrixElement(rows=[ [ MultiElement(tui_volume_sliders[index], physical_volume_encoders[index]) for index in xrange(NUM_TRACK_CONTROLS) ]], name=b'Volume_Controls') self.pan_sliders = ButtonMatrixElement(rows=[ [ SliderElement(MIDI_CC_TYPE, index + 1, 1, name=(b'TUI_Pan_Slider_{}').format(index)) for index in xrange(NUM_TRACK_CONTROLS) ]], name=b'TUI_Pan_Sliders') tui_device_controls = [ SliderElement(MIDI_CC_TYPE, 9, index, name=(b'TUI_Device_Control_{}').format(index)) for index in xrange(NUM_PARAM_CONTROLS) ] for slider in tui_device_controls: slider.set_feedback_delay(1) self.tui_device_controls = ButtonMatrixElement(rows=[ tui_device_controls], name=b'TUI_Device_Controls') self.physical_device_control_touch_elements = ButtonMatrixElement(rows=[ [ self._make_note_button(13, index + 8, (b'Physical_Device_Control_Touch_Element_{}').format(index)) for index in xrange(NUM_PARAM_CONTROLS) ]], name=b'Physical_Device_Control_Touch_Elements') physical_device_controls = [ EncoderElement(MIDI_CC_TYPE, 13, index + 8, Live.MidiMap.MapMode.relative_smooth_two_compliment, name=(b'Physical_Device_Control_{}').format(index)) for index in xrange(NUM_PARAM_CONTROLS) ] for encoder in physical_device_controls: encoder.set_feedback_delay(1) self.physical_device_controls = ButtonMatrixElement(rows=[ physical_device_controls], name=b'Physical_Device_Controls') self.device_parameter_enable_controls = ButtonMatrixElement(rows=[ [ self._make_note_button(9, index + 112, (b'Device_Parameter_Enable_Control_{}').format(index)) for index in xrange(NUM_PARAM_CONTROLS) ]], name=b'Device_Parameter_Enable_Controls') self.solo_buttons_raw = [ MultiElement(self._make_note_button(index + 1, 0, (b'TUI_Solo_Button_{}').format(index)), name=(b'Solo_Button_{}').format(index)) for index in xrange(NUM_TRACK_CONTROLS) ] self.solo_buttons = ButtonMatrixElement(rows=[ self.solo_buttons_raw], name=b'Solo_Buttons') self.mute_buttons_raw = [ MultiElement(self._make_note_button(index + 1, 1, (b'TUI_Mute_Button_{}').format(index)), name=(b'Mute_Button_{}').format(index)) for index in xrange(NUM_TRACK_CONTROLS) ] self.mute_buttons = ButtonMatrixElement(rows=[ self.mute_buttons_raw], name=b'Mute_Buttons') self.solo_mute_buttons_raw = [ MultiElement(self._make_note_button(index + 1, 2, (b'TUI_Solo_Mute_Button_{}').format(index)), name=(b'Solo_Mute_Button_{}').format(index)) for index in xrange(NUM_TRACK_CONTROLS) ] self.solo_mute_buttons = ButtonMatrixElement(rows=[ self.solo_mute_buttons_raw], name=b'Solo_Mute_Buttons') self.arm_buttons_raw = [ MultiElement(self._make_note_button(index + 1, 5, (b'TUI_Arm_Button_{}').format(index)), name=(b'Arm_Button_{}').format(index)) for index in xrange(NUM_TRACK_CONTROLS) ] self.arm_buttons = ButtonMatrixElement(rows=[ self.arm_buttons_raw], name=b'Arm_Buttons') self.clip_stop_buttons_raw = [ MultiElement(self._make_note_button(0, index + 16, (b'Clip_Stop_TUI_Button_{}').format(index)), name=(b'Clip_Stop_Button_{}').format(index)) for index in xrange(NUM_TRACK_CONTROLS) ] self.clip_stop_buttons = ButtonMatrixElement(rows=[ self.clip_stop_buttons_raw], name=b'Clip_Stop_Buttons') self.stop_all_clips_button = MultiElement(self._make_note_button(12, 89, name=b'Physical_Stop_All_Clips_Button'), self._make_note_button(10, 20, name=b'TUI_Stop_All_Clips_Button'), name=b'Stop_All_Clips_Button') self.send_encoders = ButtonMatrixElement(rows=[ [ EncoderElement(MIDI_CC_TYPE, row_index + 1, col_index + 3, Live.MidiMap.MapMode.absolute, name=(b'TUI_Send_Encoder_{}_{}').format(row_index, col_index)) for col_index in xrange(MAX_NUM_SENDS) ] for row_index in xrange(NUM_TRACK_CONTROLS) ], name=b'TUI_Send_Encoders') self.send_value_displays = ButtonMatrixElement(rows=[ [ self._create_text_display_element((1, row_index + col_index * NUM_TRACK_CONTROLS + 24), (b'Send_Value_Display_{}_{}').format(row_index, col_index)) for col_index in xrange(MAX_NUM_SENDS) ] for row_index in xrange(NUM_TRACK_CONTROLS) ], name=b'Send_Value_Displays') self.track_type_controls = ButtonMatrixElement(rows=[ [ self._make_note_button(0, index + 8, (b'Track_Type_Control_{}').format(index)) for index in xrange(NUM_TRACK_CONTROLS) ]], name=b'Track_Type_Controls') self.mute_button = self._make_note_button(12, 100, b'Mute_Button') self.solo_button = self._make_note_button(12, 101, b'Solo_Button') self.rec_arm_button = self._make_note_button(12, 102, b'Rec_Arm_Button') self.clip_stop_button = self._make_note_button(12, 103, b'Clip_Stop_Button') self.meter_controls_left = ButtonMatrixElement(rows=[ [ SliderElement(MIDI_CC_TYPE, index + 1, 124, send_should_depend_on_forwarding=False, name=(b'Output_Meter_Display_Left_{}').format(index)) for index in xrange(NUM_TRACK_CONTROLS) ]], name=b'Output_Meter_Displays_Left') self.meter_controls_right = ButtonMatrixElement(rows=[ [ SliderElement(MIDI_CC_TYPE, index + 1, 125, send_should_depend_on_forwarding=False, name=(b'Output_Meter_Display_Right_{}').format(index)) for index in xrange(NUM_TRACK_CONTROLS) ]], name=b'Output_Meter_Displays_Right') self._tui_track_select_buttons_raw = [ self._make_note_button(0, index, (b'TUI_Track_Select_Button_{}').format(index)) for index in xrange(NUM_TRACK_CONTROLS) ] self.track_name_displays = ButtonMatrixElement(rows=[ [ self._create_text_display_element((0, index), (b'Track_Name_Display_{}').index) for index in xrange(NUM_TRACK_CONTROLS) ]], name=b'Track_Name_Display') self.num_sends_control = ButtonElement(True, MIDI_CC_TYPE, 1, 2, name=b'Num_Sends_Control', send_should_depend_on_forwarding=False) self.tui_track_color_controls = ButtonMatrixElement(rows=[ [ ButtonElement(True, MIDI_CC_TYPE, 0, index + 16, skin=skin, name=(b'TUI_Track_Color_Control_{}').format(index)) for index in xrange(NUM_TRACK_CONTROLS) ]], name=b'TUI_Track_Color_Controls') self.oled_display_style_controls_bank_1 = ButtonMatrixElement(rows=[ [ self._make_note_button(13, index + 16, (b'OLED_Display_Style_Control_{}').format(index)) for index in xrange(NUM_TRACK_CONTROLS) ]], name=b'OLED_Display_Style_Controls_Bank_1') self.oled_display_style_controls_bank_2 = ButtonMatrixElement(rows=[ [ self._make_note_button(13, index + 24, (b'OLED_Display_Style_Control_{}').format(index + NUM_PARAM_CONTROLS)) for index in xrange(NUM_PARAM_CONTROLS) ]], name=b'OLED_Display_Style_Controls_Bank_2') self.track_name_or_volume_value_displays = ButtonMatrixElement(rows=[ [ self._create_text_display_element((18, index + 16), (b'Track_Name_Or_Volume_Value_Display_{}').format(index)) for index in xrange(NUM_TRACK_CONTROLS) ]], name=b'Track_Name_Or_Volume_Value_Displays') self.device_parameter_name_or_value_displays = ButtonMatrixElement(rows=[ [ self._create_text_display_element((18, index + 24), (b'Device_Parameter_Name_Or_Value_Display_{}').format(index)) for index in xrange(NUM_PARAM_CONTROLS) ]], name=b'Device_Parameter_Name_Or_Value_Displays') self.crossfade_assign_controls = ButtonMatrixElement(rows=[ [ self._make_note_button(index + 1, 4, name=(b'Crossfade_Assign_Controk_{}').format(index)) for index in xrange(NUM_TRACK_CONTROLS) ]], name=b'Crossfade_Assign_Controls') self.crossfader = SliderElement(MIDI_CC_TYPE, 13, 16, name=b'Crossfader') self.physical_clip_launch_buttons_raw = [ [ self._make_note_button(12, col_index + self.physical_clip_launch_button_id_offset + row_index * NUM_TRACK_CONTROLS, (b'Physical_Clip_Launch_Button_{}_{}').format(col_index, row_index)) for col_index in xrange(NUM_TRACK_CONTROLS) ] for row_index in xrange(NUM_SCENE_CONTROLS) ] self.clip_launch_buttons_raw = [ [ MultiElement(self._make_note_button(0, col_index + 24 + row_index * NUM_TRACK_CONTROLS, (b'TUI_Clip_Launch_Button_{}_{}').format(col_index, row_index)), name=(b'Clip_Launch_Button_{}_{}').format(col_index, row_index)) for col_index in xrange(NUM_TRACK_CONTROLS) ] for row_index in xrange(NUM_SCENE_CONTROLS) ] self.clip_launch_buttons = ButtonMatrixElement(rows=self.clip_launch_buttons_raw, name=b'Clip_Launch_Buttons') self.scene_launch_buttons = ButtonMatrixElement(rows=[ [ self._make_note_button(0, index + 88, name=(b'TUI_Scene_Launch_Button_{}').format(index)) for index in xrange(NUM_SCENE_CONTROLS) ]], name=b'TUI_Scene_Launch_Buttons') self.clip_name_displays = ButtonMatrixElement(rows=[ [ self._create_text_display_element((0, row_index + 16 + col_index * NUM_SCENE_CONTROLS), (b'Clip_Name_Display_{}_{}').format(col_index, row_index)) for col_index in xrange(NUM_TRACK_CONTROLS) ] for row_index in xrange(NUM_SCENE_CONTROLS) ]) self.scene_name_displays = ButtonMatrixElement(rows=[ [ self._create_text_display_element((0, index + 80), (b'Scene_Name_Display_{}').format(index)) for index in xrange(NUM_SCENE_CONTROLS) ]], name=b'Scene_Name_Displays') self.tui_scene_color_controls = ButtonMatrixElement(rows=[ [ ButtonElement(True, MIDI_CC_TYPE, 0, index + 88, skin=skin, name=(b'TUI_Scene_Color_Control_{}').format(index)) for index in xrange(NUM_SCENE_CONTROLS) ]], name=b'TUI_Scene_Color_Controls') self.physical_clip_color_controls_raw = [ [ ButtonElement(True, MIDI_CC_TYPE, 12, row_index + self.pad_identifier_offset + col_index * NUM_SCENE_CONTROLS, skin=skin, name=(b'Physical_Clip_Color_Control_{}_{}').format(col_index, row_index)) for col_index in xrange(NUM_TRACK_CONTROLS) ] for row_index in xrange(NUM_SCENE_CONTROLS) ] self.clip_color_controls_raw = [ [ MultiElement(ButtonElement(True, MIDI_CC_TYPE, 0, row_index + 24 + col_index * NUM_SCENE_CONTROLS, skin=skin, name=(b'TUI_Clip_Color_Control_{}_{}').format(col_index, row_index)), name=(b'Clip_Color_Control_{}_{}').format(col_index, row_index)) for col_index in xrange(NUM_TRACK_CONTROLS) ] for row_index in xrange(NUM_SCENE_CONTROLS) ] self.clip_color_controls = ButtonMatrixElement(rows=self.clip_color_controls_raw, name=b'Clip_Color_Controls') self.playing_position_controls = ButtonMatrixElement(rows=[ [ SliderElement(MIDI_CC_TYPE, 0, index, send_should_depend_on_forwarding=False, name=(b'Playing_Position_Control_{}').format(index)) for index in xrange(NUM_TRACK_CONTROLS) ]], name=b'Playing_Position_Controls') self.shift_button = self._make_note_button(12, self.shift_button_id, b'Shift_Button', resource_type=PrioritizedResource) self.up_button = self._make_note_button(12, self.up_button_id, b'Up_Button') self.down_button = self._make_note_button(12, self.down_button_id, b'Down_Button') self.left_button = self._make_note_button(12, self.left_button_id, b'Left_Button') self.right_button = self._make_note_button(12, self.right_button_id, b'Right_Button') self.up_button_with_shift = ComboElement(self.up_button, modifier=[self.shift_button], name=b'Up_Button_With_Shift') self.down_button_with_shift = ComboElement(self.down_button, modifier=[self.shift_button], name=b'Down_Button_With_Shift') self.left_button_with_shift = ComboElement(self.left_button, modifier=[self.shift_button], name=b'Left_Button_With_Shift') self.right_button_with_shift = ComboElement(self.right_button, modifier=[ self.shift_button], name=b'Right_Button_With_Shift') self.scene_selection_controls = ButtonMatrixElement(rows=[ [ self._make_note_button(0, index + 96, (b'Scene_Selection_Control_{}').format(index)) for index in xrange(NUM_SCENE_CONTROLS) ]], name=b'Scene_Selection_Controls') self.duplicate_button = self._make_note_button(12, self.duplicate_button_id, b'Duplicate_Button') self.undo_button = self._make_note_button(12, self.undo_button_id, b'Undo_Button') self.redo_button = ComboElement(self.undo_button, modifier=[self.shift_button], name=b'Redo_Button') self.tui_device_parameter_name_displays = ButtonMatrixElement(rows=[ [ self._create_text_display_element((2, index + 16), (b'TUI_Device_Parameter_Name_Display_{}').format(index)) for index in xrange(NUM_PARAM_CONTROLS) ]], name=b'TUI_Device_Parameter_Name_Displays') self.tui_device_parameter_value_displays = ButtonMatrixElement(rows=[ [ self._create_text_display_element((2, index + 32), (b'TUI_Device_Parameter_Value_Display_{}').format(index)) for index in xrange(NUM_PARAM_CONTROLS) ]], name=b'TUI_Device_Parameter_Value_Displays') self.tui_arrangement_position_display = self._create_text_display_element((3, 16), b'TUI_Arrangement_Position_Display') self.tui_loop_start_display = self._create_text_display_element((3, 17), b'TUI_Loop_Start_Display') self.tui_loop_length_display = self._create_text_display_element((3, 18), b'TUI_Loop_Length_Display') self.tui_arrangement_position_control = EncoderElement(MIDI_CC_TYPE, 10, 0, Live.MidiMap.MapMode.relative_smooth_two_compliment, name=b'TUI_Arrangement_Position_Control') self.tui_loop_start_control = EncoderElement(MIDI_CC_TYPE, 10, 1, Live.MidiMap.MapMode.relative_smooth_two_compliment, name=b'TUI_Loop_Start_Control') self.tui_loop_length_control = EncoderElement(MIDI_CC_TYPE, 10, 2, Live.MidiMap.MapMode.relative_smooth_two_compliment, name=b'TUI_Loop_Length_Control') tempo_control_identifier = (3, 0) self.tempo_display = self._create_text_display_element(tempo_control_identifier, b'Tempo_Display') self.tempo_control = SysexElement(sysex_identifier=sysex.SYSEX_MSG_HEADER + (self._product_id, sysex.TEXT_MSG_TYPE) + tempo_control_identifier, name=b'Tempo_Control') self.play_button = self._make_note_button(12, self.play_button_id, b'Play_Button') self.stop_button = self._make_note_button(12, self.stop_button_id, b'Stop_Button') self.session_record_button = self._make_note_button(12, self.session_record_button_id, b'Session_Record_Button') self.tap_tempo_button = self._make_note_button(12, self.tap_tempo_button_id, b'Tap_Tempo_Button') self._tui_prev_device_button = self._make_note_button(9, 1, b'TUI_Prev_Device_Button') self._tui_next_device_button = self._make_note_button(9, 2, b'TUI_Next_Device_Button') self.device_lock_button = self._make_note_button(10, 10, b'Device_Lock_Button', is_momentary=False) self.num_devices_control = ButtonElement(True, MIDI_CC_TYPE, 9, 16, name=b'Num_Devices_Control') self.device_index_control = ButtonElement(True, MIDI_CC_TYPE, 9, 17, name=b'Device_Index_Control') self.device_name_display = self._create_text_display_element((2, 1), b'Device_Name_Display') self.device_enable_button = self._make_note_button(9, 0, b'Device_Enable_Button', is_momentary=False) self._tui_prev_bank_button = self._make_note_button(9, 3, b'TUI_Prev_Bank_Button') self._tui_next_bank_button = self._make_note_button(9, 4, b'TUI_Next_Bank_Button') self.device_bank_name_display = self._create_text_display_element((2, 0), b'Device_Bank_Name_Display') self._tui_phase_nudge_down_button = self._make_note_button(10, 12, b'TUI_Phase_Nudge_Down_Button') self._tui_phase_nudge_up_button = self._make_note_button(10, 13, b'TUI_Phase_Nudge_Up_Button') self.tui_metronome_button = self._make_note_button(10, 0, b'TUI_Metronome_Button', is_momentary=False) self.tui_automation_arm_button = self._make_note_button(10, 4, b'TUI_Automation_Arm_Button', is_momentary=False) self.loop_button = self._make_note_button(10, 5, b'Loop_Button', is_momentary=False) self.arrangement_overdub_button = self._make_note_button(10, 3, b'Arrangement_Overdub_Button', is_momentary=False) self.follow_song_button = self._make_note_button(10, 8, b'Follow_Song_Button', is_momentary=False) self.quantization_value_control = self._make_note_button(10, 15, b'Quantization_Value_Control') self._tui_quantize_button = self._make_note_button(10, 16, b'TUI_Quantize_Button') self.clip_trigger_quantization_control = self._make_note_button(10, 6, b'Clip_Trigger_Quantization_Control') self.delete_button = MultiElement(self._make_note_button(10, 14, b'TUI_Delete_Button'), self._make_note_button(12, self.delete_button_id, b'Physical_Delete_Button'), name=b'Delete_Button') self.volume_value_displays = ButtonMatrixElement(rows=[ [ self._create_text_display_element((1, index), (b'Volume_Value_Display_{}').format(index)) for index in xrange(NUM_TRACK_CONTROLS) ]], name=b'Volume_Value_Displays') self.pan_value_displays = ButtonMatrixElement(rows=[ [ self._create_text_display_element((1, 16 + index), (b'Pan_Value_Display_{}').format(index)) for index in xrange(NUM_TRACK_CONTROLS) ]], name=b'Pan_Value_Displays') self.tui_arrangement_record_button = self._make_note_button(10, 22, b'TUI_Arrangement_Record_Button', False) self.insert_scene_button = self._make_note_button(10, 21, b'Insert_Scene_Button') self.launch_mode_switch = self._make_note_button(10, 23, b'Launch_Mode_Switch')