Example #1
0
	def _setup_controls(self):
		is_momentary = True
		self._fader = [None for index in range(8)]
		self._dial = [None for index in range(8)]
		self._button = [None for index in range(8)]
		self._menu = [None for index in range(6)]
		for index in range(2):
			self._fader[index] = MonoEncoderElement(MIDI_CC_TYPE, CHANNEL, SLIDER_CC[index], Live.MidiMap.MapMode.absolute, 'Fader_' + str(index), index, self)
		#for index in range(8):
		#	self._button[index] = MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, OHM_BUTTONS[index], 'Button_' + str(index), self)
		for index in range(8):
			self._dial[index] = MonoEncoderElement(MIDI_CC_TYPE, CHANNEL, KNOB_CC[index], Live.MidiMap.MapMode.absolute, 'Dial_' + str(index), index + 8, self)
		for index in range(4):
			self._menu[index] = MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, FUNCTION_NOTES[index], 'Menu_' + str(index), self)	
		#self._livid = MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, LIVID, 'Livid_Button', self)
		self._livid = DoublePressElement(MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, LIVID, 'Livid_Button', self))
		self._shift_l = MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, SHIFT_L, 'Shift_Button_Left', self)
		self._shift_r = MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, SHIFT_R, 'Shift_Button_Right', self)
		self._matrix = ButtonMatrixElement()
		self._matrix.name = 'Matrix'
		self._monomod = ButtonMatrixElement()
		self._monomod.name = 'Monomod'
		self._grid = [None for index in range(8)]
		for column in range(8):
			self._grid[column] = [None for index in range(8)]
			for row in range(8):
				self._grid[column][row] = MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, (column * 8) + row, 'Grid_' + str(column) + '_' + str(row), self)
		for row in range(5):
			button_row = []
			for column in range(7):
				button_row.append(self._grid[column][row])
			self._matrix.add_row(tuple(button_row)) 
		for row in range(8):
			button_row = []
			for column in range(8):
				button_row.append(self._grid[column][row])
			self._monomod.add_row(tuple(button_row))
		self._dummy_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 15, 125)
		self._dummy_button.name = 'Dummy1'
		self._dummy_button2 = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 15, 126)
		self._dummy_button2.name = 'Dummy2'
		self._dummy_button3 = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 15, 127)
		self._dummy_button2.name = 'Dummy3'
		self._dial_matrix = ButtonMatrixElement()
		self._dial_matrix.add_row(self._dial)
Example #2
0
    def _setup_controls(self):
        self._pedal = [None for index in range(8)]
        for index in range(7):
            self._pedal[index] = DoublePressElement(
                MonoButtonElement(True, MIDI_CC_TYPE, 0, PEDAL_DEFS[index],
                                  'Pedal_' + str(index), self))
            #is_momentary, MIDI_NOTE_TYPE, CHANNEL, LIVID, 'Livid_Button', self
            self._pedal[index].name = 'Pedal_' + str(index)
            self._pedal[index]._report = False
        self._pedal[7] = LoopPedalExpressionElement(
            self, MIDI_CC_TYPE, 0, 1, Live.MidiMap.MapMode.absolute)
        self._pedal[7].name = 'Pedal_' + str(7)
        self._pedal[7]._report = False
        self._leds = [None for index in range(4)]
        for index in range(4):
            red_led = ButtonElement(True, MIDI_NOTE_TYPE, 0, LED_DEFS[index])
            green_led = ButtonElement(True, MIDI_NOTE_TYPE, 0,
                                      LED_DEFS[index] + 4)
            blue_led = ButtonElement(True, MIDI_NOTE_TYPE, 0,
                                     LED_DEFS[index] + 8)
            self._leds[index] = RGB_LED(red_led, green_led, blue_led, True,
                                        MIDI_NOTE_TYPE, 0, index + 13,
                                        'LED_' + str(index), self)
        self._select_buttons = ButtonMatrixElement()
        self._select_buttons.name = 'SelectMatrix'
        self._select_buttons.add_row(
            [self._pedal[6], self._pedal[5], self._pedal[4], self._pedal[3]])
        self._doublepress_select_buttons = ButtonMatrixElement()
        self._doublepress_select_buttons.name = 'DoublepressSelectMatrix'
        self._doublepress_select_buttons.add_row([
            self._pedal[6].double_press, self._pedal[5].double_press,
            self._pedal[4].double_press, self._pedal[3].double_press
        ])

        self._record_button = self._pedal[1]
        self._mute_button = self._pedal[2]
        self._overdub_button = self._pedal[0]
Example #3
0
    def _create_controls(self):
        make_on_off_button = partial(make_button, skin=self._default_skin)

        def make_color_button(*a, **k):
            button = make_button(skin=self._color_skin, *a, **k)
            button.is_rgb = True
            button.num_delayed_messages = 2
            return button

        def make_matrix_button(track, scene):
            return make_color_button(0,
                                     32 + track - NUM_TRACKS * scene,
                                     name=u'%d_Clip_%d_Button' %
                                     (track, scene))

        def make_stop_button(track):
            return make_button(track,
                               52,
                               name=u'%d_Stop_Button' % track,
                               skin=self._stop_button_skin)

        self._shift_button = make_button(0,
                                         98,
                                         name=u'Shift_Button',
                                         resource_type=PrioritizedResource)
        self._bank_button = make_on_off_button(0, 103, name=u'Bank_Button')
        self._left_button = make_button(0, 97, name=u'Bank_Select_Left_Button')
        self._right_button = make_button(0,
                                         96,
                                         name=u'Bank_Select_Right_Button')
        self._up_button = make_button(0, 94, name=u'Bank_Select_Up_Button')
        self._down_button = make_button(0, 95, name=u'Bank_Select_Down_Button')
        self._stop_buttons = ButtonMatrixElement(
            rows=[[make_stop_button(track) for track in xrange(NUM_TRACKS)]])
        self._stop_all_button = make_button(0,
                                            81,
                                            name=u'Stop_All_Clips_Button')
        self._scene_launch_buttons_raw = [
            make_color_button(0,
                              scene + 82,
                              name=u'Scene_%d_Launch_Button' % scene)
            for scene in xrange(NUM_SCENES)
        ]
        self._scene_launch_buttons = ButtonMatrixElement(
            rows=[self._scene_launch_buttons_raw])
        self._matrix_rows_raw = [[
            make_matrix_button(track, scene) for track in xrange(NUM_TRACKS)
        ] for scene in xrange(NUM_SCENES)]
        self._session_matrix = ButtonMatrixElement(rows=self._matrix_rows_raw)
        self._pan_button = make_on_off_button(0, 87, name=u'Pan_Button')
        self._sends_button = make_on_off_button(
            0, 88, name=u'Sends_Button', resource_type=PrioritizedResource)
        self._user_button = make_on_off_button(0, 89, name=u'User_Button')
        self._mixer_encoders = ButtonMatrixElement(rows=[[
            make_ring_encoder(
                48 + track, 56 + track, name=u'Track_Control_%d' % track)
            for track in xrange(NUM_TRACKS)
        ]])
        self._volume_controls = ButtonMatrixElement(rows=[[
            make_slider(track, 7, name=u'%d_Volume_Control' % track)
            for track in xrange(NUM_TRACKS)
        ]])
        self._master_volume_control = make_slider(
            0, 14, name=u'Master_Volume_Control')
        self._prehear_control = make_encoder(0,
                                             47,
                                             name=u'Prehear_Volume_Control')
        self._crossfader_control = make_slider(0, 15, name=u'Crossfader')
        self._raw_select_buttons = [
            make_on_off_button(channel, 51, name=u'%d_Select_Button' % channel)
            for channel in xrange(NUM_TRACKS)
        ]
        self._arm_buttons = ButtonMatrixElement(rows=[[
            make_on_off_button(channel, 48, name=u'%d_Arm_Button' % channel)
            for channel in xrange(NUM_TRACKS)
        ]])
        self._solo_buttons = ButtonMatrixElement(rows=[[
            make_on_off_button(channel, 49, name=u'%d_Solo_Button' % channel)
            for channel in xrange(NUM_TRACKS)
        ]])
        self._mute_buttons = ButtonMatrixElement(rows=[[
            make_on_off_button(channel, 50, name=u'%d_Mute_Button' % channel)
            for channel in xrange(NUM_TRACKS)
        ]])
        self._crossfade_buttons = ButtonMatrixElement(rows=[[
            make_button(channel,
                        66,
                        name=u'%d_Crossfade_Button' % channel,
                        skin=self._crossfade_button_skin)
            for channel in xrange(NUM_TRACKS)
        ]])
        self._select_buttons = ButtonMatrixElement(
            rows=[self._raw_select_buttons])
        self._master_select_button = make_on_off_button(
            channel=0, identifier=80, name=u'Master_Select_Button')
        self._send_select_buttons = ButtonMatrixElement(rows=[[
            ComboElement(button, modifiers=[self._sends_button])
            for button in self._raw_select_buttons
        ]])
        self._quantization_buttons = ButtonMatrixElement(rows=[[
            ComboElement(button, modifiers=[self._shift_button])
            for button in self._raw_select_buttons
        ]])
        self._metronome_button = make_on_off_button(0,
                                                    90,
                                                    name=u'Metronome_Button')
        self._play_button = make_on_off_button(0, 91, name=u'Play_Button')
        self._record_button = make_on_off_button(0, 93, name=u'Record_Button')
        self._session_record_button = make_on_off_button(
            0, 102, name=u'Session_Record_Button')
        self._nudge_down_button = make_button(0,
                                              100,
                                              name=u'Nudge_Down_Button')
        self._nudge_up_button = make_button(0, 101, name=u'Nudge_Up_Button')
        self._tap_tempo_button = make_button(0, 99, name=u'Tap_Tempo_Button')
        self._tempo_control = make_encoder(0, 13, name=u'Tempo_Control')
        self._device_controls = ButtonMatrixElement(rows=[[
            make_ring_encoder(
                16 + index, 24 + index, name=u'Device_Control_%d' % index)
            for index in xrange(8)
        ]])
        self._device_control_buttons_raw = [
            make_on_off_button(0, 58 + index) for index in xrange(8)
        ]
        self._device_bank_buttons = ButtonMatrixElement(rows=[[
            DeviceBankButtonElement(button, modifiers=[self._shift_button])
            for button in self._device_control_buttons_raw
        ]])
        self._device_prev_bank_button = self._device_control_buttons_raw[2]
        self._device_prev_bank_button.name = u'Device_Prev_Bank_Button'
        self._device_next_bank_button = self._device_control_buttons_raw[3]
        self._device_next_bank_button.name = u'Device_Next_Bank_Button'
        self._device_on_off_button = self._device_control_buttons_raw[4]
        self._device_on_off_button.name = u'Device_On_Off_Button'
        self._device_lock_button = self._device_control_buttons_raw[5]
        self._device_lock_button.name = u'Device_Lock_Button'
        self._prev_device_button = self._device_control_buttons_raw[0]
        self._prev_device_button.name = u'Prev_Device_Button'
        self._next_device_button = self._device_control_buttons_raw[1]
        self._next_device_button.name = u'Next_Device_Button'
        self._clip_device_button = self._device_control_buttons_raw[6]
        self._clip_device_button.name = u'Clip_Device_Button'
        self._detail_view_button = self._device_control_buttons_raw[7]
        self._detail_view_button.name = u'Detail_View_Button'
        self._foot_pedal_button = DoublePressElement(
            make_pedal_button(64, name=u'Foot_Pedal'))
        self._shifted_matrix = ButtonMatrixElement(
            rows=recursive_map(self._with_shift, self._matrix_rows_raw))
        self._shifted_scene_buttons = ButtonMatrixElement(rows=[[
            self._with_shift(button)
            for button in self._scene_launch_buttons_raw
        ]])