Exemplo n.º 1
0
	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 !")
Exemplo n.º 2
0
	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 !")
Exemplo n.º 3
0
    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 create_configurable_button(identifier,
                               name,
                               send_channel_offset=0,
                               identifier_send_offset=0,
                               send_msg_type=None):
    button = ConfigurableButtonElement(
        IS_MOMENTARY, MIDI_CC_TYPE, GLOBAL_CHANNEL, identifier,
        GLOBAL_SEND_CHANNEL + send_channel_offset, identifier_send_offset,
        send_msg_type)
    button.name = name
    return button
Exemplo n.º 5
0
    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 create_configurable_button(identifier, name, send_channel_offset=0, identifier_send_offset=0, send_msg_type=None):
    button = ConfigurableButtonElement(
        IS_MOMENTARY,
        MIDI_CC_TYPE,
        GLOBAL_CHANNEL,
        identifier,
        GLOBAL_SEND_CHANNEL + send_channel_offset,
        identifier_send_offset,
        send_msg_type,
    )
    button.name = name
    return button
Exemplo n.º 7
0
    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)
Exemplo n.º 8
0
    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))
Exemplo n.º 9
0
    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)
Exemplo n.º 10
0
	def __init__(self, c_instance):
		ControlSurface.__init__(self, c_instance)
		with self.component_guard(): # this line allows you to instanciate framework classes
			is_momentary = True # all our controlls will be momentary
			self._suggested_input_port = 'px700'
			self._suggested_output_port = 'px700'

			"definition of buttons represented by the keyboard notes"
			launch_buttons = [] # row of buttons launching the clips of a track
			for index in range(16):
				button = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, index)
				button.name = '_Clip_' + str(index) + '_Button'
				launch_buttons.append(button)

			"buttons A, B, C, D are the buttons choosing he mode"
			mode_buttons = [ ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 16+index) for index in range(4) ]
			mode_buttons[0].name = 'A_mode'
			mode_buttons[1].name = 'B_mode'
			mode_buttons[2].name = 'C_mode'
			mode_buttons[3].name = 'D_mode'

			"pad controls definition"
			select_button = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 20)
			select_button.name = '_Select_Button' 
			translate_button = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 21)
			translate_button.name = '_Translate_Button'
			mute_button = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 22)
			mute_button.name = '_Mute_Button'
			solo_button = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 23)
			solo_button.name = '_Solo_Button'
			copy_button = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 28)
			copy_button.name = '_Copy_Button'
			erase_button = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 29)
			erase_button.name = '_Erase_Button'
			rewind_button = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 36)
			rewind_button.name = '_Rewind_Button'
			forward_button = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 37)
			forward_button.name = '_Forward_Button'

			"pads definition"
			pads = []
			for index in range(8):
				pad = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 60+index)
				pad.name = '_Clip_' + str(index) + '_Button'
				pads.append(pad)

			"transport buttons"
			transport_buttons = []
			for index in range(4):
				button = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 24+index)
				button.name = '_Transport_Button_'+str(index)
				transport_buttons.append(button)

			"knobs definition"
			tempo_control = EncoderElement(MIDI_CC_TYPE, 0, 48, Live.MidiMap.MapMode.relative_binary_offset)
			tempo_control.name = "_Tempo_controller_"
			volume_control = EncoderElement(MIDI_CC_TYPE, 0, 47, Live.MidiMap.MapMode.relative_binary_offset)
			tempo_control.name = "_Volume_controller_"
			param_controls = []
			for index in range(3):
				control = EncoderElement(MIDI_CC_TYPE, 0, 49+index, Live.MidiMap.MapMode.relative_binary_offset)
				control.name = "_Param_"+str(index)+"_control"
				param_controls.append(control)

			"browser knob definition"
			browser_control = EncoderElement(MIDI_CC_TYPE, 0, 54, Live.MidiMap.MapMode.relative_binary_offset)
			browser_control.name = "_Browser_controller_"

			"browser button definition"
			browser_button = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 56)
			browser_button.name = "_Browser_button_"
			"pattern leds definition"
			pattern_leds = []
			for index in range(4):
				led = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 41+index)
				led.name = str(index) + 'Pattern_Led'
				pattern_leds.append(led)

			"divide knob definition"
			divide_control = EncoderElement(MIDI_CC_TYPE, 0, 52, Live.MidiMap.MapMode.relative_binary_offset)
			divide_control.name = "_divide_controller_"

			"move knob definition"
			move_control = EncoderElement(MIDI_CC_TYPE, 0, 53, Live.MidiMap.MapMode.relative_binary_offset)
			move_control.name = "_move_controller_"

			"track leds definition"
			track_leds = []
			for index in range(8):
				led = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 68+index)
				led.name = str(index) + 'Track_Led'
				track_leds.append(led)

			self._selector = MainSelectorComponent(tuple(launch_buttons), tuple(mode_buttons), tuple(pads), tuple(transport_buttons), select_button, translate_button, mute_button, solo_button, tempo_control, volume_control, tuple(param_controls), copy_button, erase_button, rewind_button, forward_button, browser_control, browser_button, tuple(pattern_leds), tuple(track_leds), divide_control, move_control, self)
			self._selector.name = 'Main_Modes'
			self.set_highlighting_session_component(self._selector._session)

			self.log_message("SparkLE Loaded !")
Exemplo n.º 11
0
	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 make_launch_control_button(identifier, name, channel = 0, is_pad = False):
    button = ConfigurableButtonElement(True, MIDI_NOTE_TYPE if is_pad else MIDI_CC_TYPE, channel, identifier)
    button.name = name
    button.set_on_off_values(Colors.LED_ON, Colors.LED_OFF)
    return button
Exemplo n.º 13
0
def make_launch_control_button(identifier, name, channel = 0, is_pad = False):
    button = ConfigurableButtonElement(True, MIDI_NOTE_TYPE if is_pad else MIDI_CC_TYPE, channel, identifier)
    button.name = name
    button.set_on_off_values(Colors.LED_ON, Colors.LED_OFF)
    return button
Exemplo n.º 14
0
    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 _setup_session_control(self):
        is_momentary = True
        self._shift_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 98)
        self._right_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 96)
        self._left_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 97)
        self._up_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 94)
        self._down_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 95)
        self._right_button.name = 'Bank_Select_Right_button'
        self._left_button.name = 'Bank_Select_Left_button'
        self._up_button.name = 'Bank_Select_Up_button'
        self._down_button.name = 'Bank_Select_Down_button'
        self._session = PedaledSessionComponent(8, 5)
        self._session.name = 'Session_Control'
        self._session.set_track_bank_buttons(self._right_button, self._left_button)
        self._session.set_scene_bank_buttons(self._down_button, self._up_button)
        self._matrix = ButtonMatrixElement()
        self._matrix.name = 'Button_Matrix'
        self._scene_launch_buttons = [ ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, index + 82) for index in range(5) ]
        self._track_stop_buttons = [ ConfigurableButtonElement(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(self._track_stop_buttons)):
            self._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(self._track_stop_buttons))
        self._session.set_stop_clip_value(0)
        self._session.set_stop_clip_triggered_value(2)

        self._button_rows = []
        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 = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, track_index, (scene_index + 53))
                button.name = str(track_index) + '_Clip_' + str(scene_index) + '_Button'
                button_row.append(button)
                clip_slot = scene.clip_slot(track_index)
                clip_slot.name = str(track_index) + '_Clip_Slot_' + str(scene_index)
                clip_slot.set_triggered_to_play_value(2)
                clip_slot.set_triggered_to_record_value(4)
                clip_slot.set_stopped_value(5)
                clip_slot.set_started_value(1)
                clip_slot.set_recording_value(3)
                clip_slot.set_launch_button(button)
            self._matrix.add_row(tuple(button_row))
            self._button_rows.append(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 = ShiftableZoomingComponent(self._session, tuple(self._track_stop_buttons))
        self._session_zoom.name = 'Session_Overview'
        self._session_zoom.set_button_matrix(self._matrix)
        self._session_zoom.set_zoom_button(self._shift_button)
        self._session_zoom.set_nav_buttons(self._up_button, self._down_button, self._left_button, self._right_button)
        self._session_zoom.set_scene_bank_buttons(tuple(self._scene_launch_buttons))
        self._session_zoom.set_stopped_value(3)
        self._session_zoom.set_selected_value(5)
Exemplo n.º 16
0
	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 !")
Exemplo n.º 17
0
 def _setup_session_control(self):
     is_momentary = True
     self._shift_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 98)
     self._right_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 96)
     self._left_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 97)
     self._up_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 94)
     self._down_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 95)
     self._right_button.name = 'Bank_Select_Right_button'
     self._left_button.name = 'Bank_Select_Left_button'
     self._up_button.name = 'Bank_Select_Up_button'
     self._down_button.name = 'Bank_Select_Down_button'
     self._session = PedaledSessionComponent(8, 5)
     self._session.name = 'Session_Control'
     self._session.set_track_bank_buttons(self._right_button,
                                          self._left_button)
     self._session.set_scene_bank_buttons(self._down_button,
                                          self._up_button)
     self._matrix = ButtonMatrixElement()
     self._matrix.name = 'Button_Matrix'
     self._scene_launch_buttons = [
         ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, index + 82)
         for index in range(5)
     ]
     self._track_stop_buttons = [
         ConfigurableButtonElement(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(self._track_stop_buttons)):
         self._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(self._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(self._scene_launch_buttons[scene_index])
         scene.set_triggered_value(2)
         for track_index in range(8):
             button = ConfigurableButtonElement(is_momentary,
                                                MIDI_NOTE_TYPE, track_index,
                                                (scene_index + 53))
             button.name = str(track_index) + '_Clip_' + str(
                 scene_index) + '_Button'
             button_row.append(button)
             clip_slot = scene.clip_slot(track_index)
             clip_slot.name = str(track_index) + '_Clip_Slot_' + str(
                 scene_index)
             clip_slot.set_triggered_to_play_value(2)
             clip_slot.set_triggered_to_record_value(4)
             clip_slot.set_stopped_value(5)
             clip_slot.set_started_value(1)
             clip_slot.set_recording_value(3)
             clip_slot.set_launch_button(button)
         self._matrix.add_row(tuple(button_row))
     self._session.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 = ShiftableZoomingComponent(
         self._session, tuple(self._track_stop_buttons))
     self._session_zoom.name = 'Session_Overview'
     self._session_zoom.set_button_matrix(self._matrix)
     self._session_zoom.set_zoom_button(self._shift_button)
     self._session_zoom.set_nav_buttons(self._up_button, self._down_button,
                                        self._left_button,
                                        self._right_button)
     self._session_zoom.set_scene_bank_buttons(
         tuple(self._scene_launch_buttons))
     self._session_zoom.set_stopped_value(3)
     self._session_zoom.set_selected_value(5)
Exemplo n.º 18
0
    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)
        self._matrix = ButtonMatrixElement() #was: matrix = ButtonMatrixElement()
        self._matrix.name = 'Button_Matrix' #was: matrix.name = 'Button_Matrix'
        scene_launch_buttons = [ ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, (index + 82)) for index in range(5) ]
        #self._track_stop_buttons = [ ButtonElement(is_momentary, MIDI_NOTE_TYPE, index, 52) for index in range(8) ]
        self._track_stop_buttons = [ ConfigurableButtonElement(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(self._track_stop_buttons)):
            self._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(self._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 = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, track_index, (scene_index + 53)) #use Launchpad configurable button instead
                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)
            self._matrix.add_row(tuple(button_row)) #matrix.add_row(tuple(button_row))

        # Removing the launch selected clip footpedal option
        #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) #use APC20 Zooming instead      
        self._session_zoom.name = 'Session_Overview'
        self._session_zoom.set_button_matrix(self._matrix) #was: self._session_zoom.set_button_matrix(matrix)
        self._session_zoom.set_zoom_button(self._shift_button) #set in MatrixModesComponent instead
        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)
        return None
Exemplo n.º 19
0
	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 !")
Exemplo n.º 20
0
    def __init__(self, c_instance):
        ControlSurface.__init__(self, c_instance)
        with self.component_guard():  # this line allows you to instanciate framework classes
            is_momentary = True  # all our controlls will be momentary
            self._suggested_input_port = "px700"
            self._suggested_output_port = "px700"

            "definition of buttons represented by the keyboard notes"
            select_buttons = []  # row of buttons launching the clips of a track
            for index in range(10):
                button = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 20 + index)
                button.name = "_Clip_" + str(index) + "_Button"
                select_buttons.append(button)

            "buttons sound and multi are the buttons choosing he mode"
            mode_buttons = [
                ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 118 + index) for index in range(2)
            ]
            mode_buttons[0].name = "Sound_Mode"
            mode_buttons[1].name = "Multi_Mode"

            "knobs definition"
            bank1_controls = []
            for index in range(10):
                control = EncoderElement(MIDI_CC_TYPE, 0, 74 + index, Live.MidiMap.MapMode.relative_binary_offset)
                control.name = "_Param_" + str(index) + "_control"
                bank1_controls.append(control)

            bank2_controls = []
            for index in range(10):
                control = EncoderElement(MIDI_CC_TYPE, 0, 74 + index, Live.MidiMap.MapMode.relative_binary_offset)
                control.name = "_Param_" + str(index) + "_control"
                bank2_controls.append(control)

            bank1_faders = []
            for index in range(4):
                control = EncoderElement(MIDI_CC_TYPE, 0, 73 + index, Live.MidiMap.MapMode.absolute)
                control.name = "_Param_" + str(index) + "_control"
                bank1_faders.append(control)
            for index in range(5):
                control = EncoderElement(MIDI_CC_TYPE, 0, 80 + index, Live.MidiMap.MapMode.absolute)
                control.name = "_Param_" + str(index) + "_control"
                bank1_faders.append(control)

            bank2_faders = []
            for index in range(4):
                control = EncoderElement(MIDI_CC_TYPE, 0, 67 + index, Live.MidiMap.MapMode.absolute)
                control.name = "_Param_" + str(index) + "_control"
                bank2_faders.append(control)
            for index in range(5):
                control = EncoderElement(MIDI_CC_TYPE, 0, 87 + index, Live.MidiMap.MapMode.absolute)
                control.name = "_Param_" + str(index) + "_control"
                bank2_faders.append(control)

            self._selector = MainSelectorComponent(
                tuple(select_buttons),
                tuple(mode_buttons),
                tuple(bank1_controls),
                tuple(bank2_controls),
                tuple(bank1_faders),
                tuple(bank2_faders),
                self,
            )
            self._selector.name = "Main_Modes"
            # self.set_highlighting_session_component(self._selector._session)

            self.log_message("SparkLE Loaded !")
Exemplo n.º 21
0
	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
Exemplo n.º 22
0
    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