コード例 #1
0
ファイル: xone.py プロジェクト: macfergus/live-xonek2
 def __init__(self,
              num_tracks,
              num_returns=0,
              device_select=None,
              device_encoders=None):
     self.devices = []
     self.eqs = []
     self.active_track = 0
     self.device_select = device_select
     MixerComponent.__init__(self, num_tracks, num_returns)
     self.encoders = [DynamicEncoder(cc, None) for cc in device_encoders]
     for i in range(len(self._channel_strips)):
         dev = {
             "cb": None,
             "component": DeviceComponent(),
             "track": None,
             "params": [],
             "toggle": None,
         }
         self.devices.append(dev)
         self.register_components(dev["component"])
         eq = {"component": DeviceComponent(), "cb": None, "track": None}
         self.eqs.append(eq)
         self.register_components(eq["component"])
     self._reassign_tracks()
     if device_select:
         for i, b in enumerate(device_select):
             b.add_value_listener(partial(self.on_device_select_push, i))
コード例 #2
0
 def _setup_device(self):
     encoders = [ make_encoder(21 + index, b'Device_Control_%d' % index) for index in xrange(8) ]
     self._encoders = tuple(encoders)
     device = DeviceComponent(device_selection_follows_track_selection=True)
     device.name = b'Device_Component'
     self.set_device_component(device)
     device.set_parameter_controls(self._encoders)
コード例 #3
0
 def _create_device(self):
     self._device = DeviceComponent(
         device_selection_follows_track_selection=True)
     self._device_navigation = DeviceNavigationComponent()
     self._device.set_enabled(True)
     self._device_navigation.set_enabled(True)
     self.set_device_component(self._device)
    def _setup_device(self):
        """Create a DeviceComponent to control macro knobs"""

        self._device = DeviceComponent()
        self.set_device_component(self._device)
        param_knobs = ButtonMatrixElement(rows=[self._knobs[0:8]])
        self._device.layer = Layer(parameter_controls=param_knobs)
コード例 #5
0
ファイル: __init__.py プロジェクト: welvet/launchpad-pro
    def _activate_track_control(self):
        if self._pad_control_device is not None:
            return

        if (len(self.mixer.selected_strip()._track.devices) > 0):
            devices = self.mixer.selected_strip()._track.devices
            self.actual_device = devices[0]

            self._track_control_device = DeviceComponent()
            device_controls = (
                EncoderElement(MIDI_CC_TYPE, 10, 1, self._map_modes.absolute),
                EncoderElement(MIDI_CC_TYPE, 10, 2, self._map_modes.absolute),
                EncoderElement(MIDI_CC_TYPE, 10, 3, self._map_modes.absolute),
                EncoderElement(MIDI_CC_TYPE, 10, 4, self._map_modes.absolute),
                EncoderElement(MIDI_CC_TYPE, 10, 5, self._map_modes.absolute),
                EncoderElement(MIDI_CC_TYPE, 10, 6, self._map_modes.absolute),
                EncoderElement(MIDI_CC_TYPE, 10, 7, self._map_modes.absolute),
                EncoderElement(MIDI_CC_TYPE, 10, 8, self._map_modes.absolute),
            )

            self._track_control_device.set_device(self.actual_device)
            self._track_control_device.set_parameter_controls(
                tuple(device_controls))
            self._track_control_device.set_lock_to_device(
                "lock", self.actual_device)
コード例 #6
0
 def _create_device(self):
     self._device = DeviceComponent(
         is_enabled=True,
         name=u'Device',
         device_selection_follows_track_selection=True)
     self._device.layer = Layer(parameter_controls=self._encoders)
     self.set_device_component(self._device)
コード例 #7
0
ファイル: OhmOne.py プロジェクト: hoefkensj/OhmOne
    def _setup_device_control(self):
        self._device = DeviceComponent(None, True)
        self._channel_strip = ChannelStripComponent()
        self._device.name = 'Device_Component'
        lock_button = ButtonElement(True, MIDI_NOTE_TYPE, CHANNEL,
                                    DEVICE_LOCK_BUTTON)
        self._device.set_lock_button(lock_button)

        device_parameters = []
        for index in range(8):
            macro_knobs = SliderElement(MIDI_CC_TYPE, CHANNEL,
                                        KNOBS_BANK_ONE[index])
            device_parameters.append(macro_knobs)

        self._device.set_parameter_controls(device_parameters)
        self.set_device_component(
            self._device)  #Why not self._device.set_device_component()

        #device_nav_button = [ButtonElement(True, MIDI_NOTE_TYPE, CHANNEL, DEVICE_NAV_BUTTONS[index]) for index in range(2)]
        #self._device.set_device_nav_buttons(self, device_nav_button[0], device_nav_button[1])

        bank_button = [
            ButtonElement(True, MIDI_NOTE_TYPE, CHANNEL,
                          DEVICE_BANK_BUTTONS[index]) for index in range(2)
        ]
        self._device.set_bank_prev_button(bank_button[0])
        self._device.set_bank_next_button(bank_button[1])
コード例 #8
0
ファイル: Block.py プロジェクト: spiralune/monomodular
	def _setup_transport_control(self):
		is_momentary = True # We'll only be using momentary buttons here
		transport = TransportComponent() #Instantiate a Transport Component
		"""set up the buttons"""
		transport.set_play_button(ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, 69)) #ButtonElement(is_momentary, msg_type, channel, identifier) Note that the MIDI_NOTE_TYPE constant is defined in the InputControlElement module
		transport.set_stop_button(ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, 70))
		#transport.set_record_button(ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, 66))
		#transport.set_overdub_button(ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, 68))
		#transport.set_nudge_buttons(ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, 80), ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, 73)) #(up_button, down_button)
		#transport.set_tap_tempo_button(ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, 80))
		#transport.set_metronome_button(ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, 80)) #For some reason, in Ver 7.x.x this method's name has no trailing "e" , and must be called as "set_metronom_button()"...
		#transport.set_loop_button(ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, 82))
		#transport.set_punch_buttons(ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, 85), ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, 87)) #(in_button, out_button)
		#transport.set_seek_buttons(ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, 90), ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, 92)) # (ffwd_button, rwd_button)
		#"""set up the sliders"""
		#transport.set_tempo_control(SliderElement(MIDI_CC_TYPE, CHANNEL, 26), SliderElement(MIDI_CC_TYPE, CHANNEL, 25)) #(control, fine_control)
		#transport.set_song_position_control(SliderElement(MIDI_CC_TYPE, CHANNEL, 24))
		
		device_param_controls = []
		effects_knob_cc = [17,16,9,8,19,18,11,10]
		device = DeviceComponent()
		for index in range(8):
			device_param_controls.append(EncoderElement(MIDI_CC_TYPE, 0, effects_knob_cc[index], Live.MidiMap.MapMode.absolute))
		device.set_parameter_controls(tuple(device_param_controls))
		self.set_device_component(device)
コード例 #9
0
ファイル: AumPC20.py プロジェクト: splenda/monomodular
    def _setup_custom_components(self):
        is_momentary = True
        master_select_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0,
                                             80)
        master_select_button.name = 'Master_Select_Button'
        self._master_select_button = master_select_button
        select_buttons = []
        arm_buttons = []
        sliders = []
        for track in range(8):
            select_buttons.append(
                AumPCMonoButtonElement(is_momentary, MIDI_NOTE_TYPE, track, 51,
                                       str(track) + '_Select_Button', self))
            arm_buttons.append(
                ButtonElement(is_momentary, MIDI_NOTE_TYPE, track, 48))
            sliders.append(
                MonoEncoderElement(MIDI_CC_TYPE, track, 7,
                                   Live.MidiMap.MapMode.absolute,
                                   'Slider_' + str(track), track, self))
            select_buttons[-1].name = str(track) + '_Select_Button'
            arm_buttons[-1].name = str(track) + '_Arm_Button'
            #sliders[-1].name = str(track) + '_Volume_Control'
        self._select_buttons = select_buttons

        transport = TransportComponent()
        transport.name = 'Transport'
        slider_modes = SliderModesComponent(self._mixer, tuple(sliders))
        slider_modes.name = 'Slider_Modes'
        self._shift_modes = AumPC20ShiftableSelectorComponent(
            tuple(select_buttons), master_select_button, tuple(arm_buttons),
            self._matrix, self._session, self._session_zoom, self._mixer,
            transport, slider_modes, self._send_introduction_message, self)
        self._shift_modes.name = 'Shift_Modes'
        self._shift_modes.set_mode_toggle(self._shift_button)
        self._device = DeviceComponent()
コード例 #10
0
 def __init__(self, *a, **k):
     super(Advance, self).__init__(*a, **k)
     with self.component_guard():
         encoders = ButtonMatrixElement(rows=[[
             make_encoder(index + 22, b'Encoder_%d' % index)
             for index in xrange(8)
         ]])
         pads = ButtonMatrixElement(rows=[[
             make_button(identifier, b'Pad_%d_%d' % (col, row))
             for col, identifier in enumerate(row_ids)
         ] for row, row_ids in enumerate(PAD_IDS)])
         device = DeviceComponent(
             is_enabled=False,
             layer=Layer(parameter_controls=encoders),
             device_selection_follows_track_selection=True)
         device.set_enabled(True)
         self.set_device_component(device)
         drums = DrumRackComponent(is_enabled=False, layer=Layer(pads=pads))
         drums.set_enabled(True)
         play_button = make_button(118, b'Play_Button', MIDI_CC_TYPE, 0)
         stop_button = make_button(117, b'Stop_Button', MIDI_CC_TYPE, 0)
         record_button = make_button(119, b'Record_Button', MIDI_CC_TYPE, 0)
         loop_button = make_button(114, b'Loop_Button', MIDI_CC_TYPE, 0)
         transport = TransportComponent(is_enabled=False,
                                        layer=Layer(
                                            play_button=play_button,
                                            stop_button=stop_button,
                                            record_button=record_button,
                                            loop_button=loop_button))
         transport.set_enabled(True)
コード例 #11
0
    def _init_device(self):
        make_button = partial(make_launch_control_button, channel=10)
        make_encoder = partial(make_launch_control_encoder, channel=10)
        bottom_encoders, top_encoders = make_all_encoders(
            'Device', make_encoder)
        parameter_controls = top_encoders[:4] + bottom_encoders[:4]
        bank_buttons = [
            make_button(identifier,
                        'Device_Bank_Button_' + str(i),
                        is_pad=True)
            for i, identifier in enumerate(pad_identifiers)
        ]
        for button in bank_buttons:
            button.set_on_off_values(Colors.LED_ON, Colors.LED_OFF)

        self._device_bank_registry = DeviceBankRegistry()
        self._device = DeviceComponent(
            device_bank_registry=self._device_bank_registry, name='Device')
        self._device.set_enabled(False)
        self._device.layer = Layer(
            parameter_controls=ButtonMatrixElement(rows=[parameter_controls]),
            bank_buttons=ButtonMatrixElement(rows=[bank_buttons]))
        self.set_device_component(self._device)
        self._device_navigation = DeviceNavigationComponent()
        self._device_navigation.set_enabled(False)
        self._device_navigation.name = 'Device_Navigation'
        self._device_navigation.layer = Layer(
            next_device_button=make_button(115, 'Next_Device_Button'),
            previous_device_button=make_button(114, 'Prev_Device_Button'))
        self._view_control = ViewControlComponent()
        self._view_control.set_enabled(False)
        self._view_control.name = 'View_Control'
        self._view_control.layer = Layer(
            next_track_button=make_button(117, 'Device_Next_Track_Button'),
            prev_track_button=make_button(116, 'Device_Prev_Track_Button'))
コード例 #12
0
	def _setup_device_control(self):
		self._device = DeviceComponent()
		self._device.name = 'Device_Component'
		self.set_device_component(self._device)
		self._device_navigator = DetailViewControllerComponent()
		self._device_navigator.name = 'Device_Navigator'
		self._device_selection_follows_track_selection = FOLLOW
コード例 #13
0
    def _setup_device(self):
        encoders = []
        for index in range(8):
            encoders.append(
                PeekableEncoderElement(
                    MIDI_CC_TYPE, 1, index,
                    Live.MidiMap.MapMode.relative_binary_offset))
            encoders[(-1)].set_feedback_delay(-1)
            encoders[(-1)].add_value_listener(self._encoder_value,
                                              identify_sender=True)
            encoders[(-1)].name = b'Device_Control_' + str(index)

        self._encoders = tuple(encoders)
        self._prev_bank_button = ButtonElement(IS_MOMENTARY, MIDI_CC_TYPE, 1,
                                               12)
        self._next_bank_button = ButtonElement(IS_MOMENTARY, MIDI_CC_TYPE, 1,
                                               11)
        self._prev_bank_button.name = b'Device_Bank_Down_Button'
        self._next_bank_button.name = b'Device_Bank_Up_Button'
        device = DeviceComponent(device_selection_follows_track_selection=True)
        device.name = b'Device_Component'
        self.set_device_component(device)
        device.set_parameter_controls(self._encoders)
        device.set_bank_nav_buttons(self._prev_bank_button,
                                    self._next_bank_button)
コード例 #14
0
 def __init__(self, *a, **k):
     super(MPK225, self).__init__(*a, **k)
     with self.component_guard():
         midimap = MidiMap()
         drum_rack = DrumRackComponent(
             name='Drum_Rack',
             is_enabled=False,
             layer=Layer(pads=midimap['Drum_Pads']))
         drum_rack.set_enabled(True)
         transport = TransportComponent(
             name='Transport',
             is_enabled=False,
             layer=Layer(play_button=midimap['Play'],
                         record_button=midimap['Record'],
                         stop_button=midimap['Stop'],
                         seek_forward_button=midimap['Forward'],
                         seek_backward_button=midimap['Backward'],
                         loop_button=midimap['Loop']))
         transport.set_enabled(True)
         device = DeviceComponent(
             name='Device',
             is_enabled=False,
             layer=Layer(parameter_controls=midimap['Encoders']),
             device_selection_follows_track_selection=True)
         device.set_enabled(True)
         self.set_device_component(device)
コード例 #15
0
    def __init__(self, c_instance):
        ControlSurface.__init__(self, c_instance)
        with self.component_guard():
            is_momentary = True
            self._suggested_input_port = 'Oxygen'
            self._suggested_output_port = 'Oxygen'
            self._has_slider_section = True
            self._device_selection_follows_track_selection = True
            self._shift_button = ButtonElement(is_momentary, MIDI_CC_TYPE, GLOBAL_CHANNEL, 57)
            self._shift_button.add_value_listener(self._shift_value)
            self._mixer = SpecialMixerComponent(NUM_TRACKS)
            self._mute_solo_buttons = []
            self._track_up_button = ButtonElement(is_momentary, MIDI_CC_TYPE, GLOBAL_CHANNEL, 111)
            self._track_down_button = ButtonElement(is_momentary, MIDI_CC_TYPE, GLOBAL_CHANNEL, 110)
            self._master_slider = SliderElement(MIDI_CC_TYPE, GLOBAL_CHANNEL, 41)
            for index in range(NUM_TRACKS):
                self._mute_solo_buttons.append(ButtonElement(is_momentary, MIDI_CC_TYPE, GLOBAL_CHANNEL, 49 + index))
                self._mixer.channel_strip(index).set_volume_control(SliderElement(MIDI_CC_TYPE, GLOBAL_CHANNEL, 33 + index))

            self._shift_value(0)
            self._mixer.master_strip().set_volume_control(self._master_slider)
            self._mixer.selected_strip().set_volume_control(None)
            device = DeviceComponent()
            device.set_parameter_controls(tuple([ EncoderElement(MIDI_CC_TYPE, GLOBAL_CHANNEL, 17 + index, Live.MidiMap.MapMode.absolute) for index in range(8) ]))
            self.set_device_component(device)
            ffwd_button = ButtonElement(is_momentary, MIDI_CC_TYPE, GLOBAL_CHANNEL, 115)
            rwd_button = ButtonElement(is_momentary, MIDI_CC_TYPE, GLOBAL_CHANNEL, 114)
            loop_button = ButtonElement(is_momentary, MIDI_CC_TYPE, GLOBAL_CHANNEL, 113)
            transport = TransportComponent()
            transport.set_stop_button(ButtonElement(is_momentary, MIDI_CC_TYPE, GLOBAL_CHANNEL, 116))
            transport.set_play_button(ButtonElement(is_momentary, MIDI_CC_TYPE, GLOBAL_CHANNEL, 117))
            transport.set_record_button(ButtonElement(is_momentary, MIDI_CC_TYPE, GLOBAL_CHANNEL, 118))
            session = SessionComponent(0, 0)
            transport_view_modes = TransportViewModeSelector(transport, session, ffwd_button, rwd_button, loop_button)
コード例 #16
0
 def _setup_device(self):
     encoders = [ make_encoder(21 + index, 'Device_Control_%d' % index) for index in xrange(8) ]
     self._encoders = tuple(encoders)
     device = DeviceComponent()
     device.name = 'Device_Component'
     self.set_device_component(device)
     device.set_parameter_controls(self._encoders)
コード例 #17
0
    def _setup_device_control(self):
        is_momentary = True
        self._device = DeviceComponent()
        self._channelstrip = ChannelStripComponent()
        self._device.name = 'Device_Component'

        device_param_controls = []
        for index in range(8):
            device_param_controls.append(
                SliderElement(MIDI_CC_TYPE, CHANNEL_FX, MACRO_CONTROLS[index]))
        self._device.set_parameter_controls(device_param_controls)
        self._device.set_on_off_button(
            ButtonElement(True, MIDI_CC_TYPE, CHANNEL_FX, DEVICE_ON))
        self._device.set_lock_button(
            ButtonElement(True, MIDI_CC_TYPE, CHANNEL_FX, DEVICE_LOCK))
        # self._device.set_bank_down_value(ButtonElement(True, MIDI_CC_TYPE, CHANNEL, DEVICE_LOCK))
        # self._device.set_bank_up_value(ButtonElement(True, MIDI_CC_TYPE, CHANNEL, DEVICE_ON))
        up_bank_button = ButtonElement(True, MIDI_CC_TYPE, CHANNEL_FX,
                                       DEVICE_BANK_UP)
        down_bank_button = ButtonElement(True, MIDI_CC_TYPE, CHANNEL_FX,
                                         DEVICE_BANK_DOWN)
        # self._device.set_bank_buttons(down_bank_button, up_bank_button)
        self.set_device_component(self._device)
        self._device_nav = DeviceNavComponent()
        self._device_nav.set_device_nav_buttons(
            ButtonElement(True, MIDI_CC_TYPE, CHANNEL_FX, PREVIOUS_DEVICE),
            ButtonElement(True, MIDI_CC_TYPE, CHANNEL_FX, NEXT_DEVICE))
        self._device.set_bank_prev_button(down_bank_button)
        self._device.set_bank_next_button(up_bank_button)
コード例 #18
0
	def _setup_device_control(self):
		self._device = DeviceComponent()
		self._device.name = 'Device_Component'
		self.set_device_component(self._device)
		self._device_navigator = DeviceNavigator(self._device, self._mixer, self)
		self._device_navigator.name = 'Device_Navigator'
		#self._device_selection_follows_track_selection = FOLLOW 
		self._device.device_name_data_source().set_update_callback(self._on_device_name_changed)
コード例 #19
0
ファイル: MiniLab.py プロジェクト: m-nny/remote-scripts
 def _create_device(self):
     self._device = DeviceComponent(
         name='Device',
         is_enabled=False,
         layer=Layer(parameter_controls=self._device_controls),
         device_selection_follows_track_selection=True)
     self._device.set_enabled(True)
     self.set_device_component(self._device)
コード例 #20
0
    def _init_device_component(self, device_controls, bank_controls, global_channel, macro_map_mode):
        is_momentary = True
        if device_controls:
            device = DeviceComponent()
            device.name = 'Device_Component'
            if bank_controls:
                next_button = None
                prev_button = None
                if 'NEXTBANK' in bank_controls.keys() and bank_controls['NEXTBANK'] in range(128):
                    next_button = ButtonElement(is_momentary, MIDI_CC_TYPE, global_channel, bank_controls['NEXTBANK'])
                    next_button.name = 'Device_Next_Bank_Button'
                if 'PREVBANK' in bank_controls.keys() and bank_controls['PREVBANK'] in range(128):
                    prev_button = ButtonElement(is_momentary, MIDI_CC_TYPE, global_channel, bank_controls['PREVBANK'])
                    prev_button.name = 'Device_Previous_Bank_Button'
                device.set_bank_nav_buttons(prev_button, next_button)
                if 'TOGGLELOCK' in bank_controls.keys() and bank_controls['TOGGLELOCK'] in range(128):
                    lock_button = ButtonElement(is_momentary, MIDI_CC_TYPE, global_channel, bank_controls['TOGGLELOCK'])
                    lock_button.name = 'Device_Lock_Button'
                    device.set_lock_button(lock_button)
                bank_buttons = []
                for index in range(8):
                    key = 'BANK' + str(index + 1)
                    if key in bank_controls.keys():
                        control_info = bank_controls[key]
                        channel = global_channel
                        cc = -1
                        if isinstance(control_info, (tuple, list)):
                            cc = control_info[0]
                            if control_info[1] in range(16):
                                channel = control_info[1]
                        else:
                            cc = control_info
                        if cc in range(128) and channel in range(16):
                            button = ButtonElement(is_momentary, MIDI_CC_TYPE, channel, cc)
                            button.name = 'Device_Bank_' + str(index) + '_Button'
                            bank_buttons.append(button)

                if len(bank_buttons) > 0:
                    device.set_bank_buttons(tuple(bank_buttons))
            parameter_encoders = []
            for control_info in device_controls:
                channel = global_channel
                cc = -1
                if isinstance(control_info, (tuple, list)):
                    cc = control_info[0]
                    if control_info[1] in range(16):
                        channel = control_info[1]
                else:
                    cc = control_info
                if cc in range(128) and channel in range(16):
                    encoder = EncoderElement(MIDI_CC_TYPE, channel, cc, macro_map_mode)
                    encoder.name = 'Device_Parameter_' + str(list(device_controls).index(control_info)) + '_Control'
                    parameter_encoders.append(encoder)

            if len(parameter_encoders) > 0:
                device.set_parameter_controls(tuple(parameter_encoders))
            self.set_device_component(device)
コード例 #21
0
 def __init__(self, *a, **k):
     super(Alesis_V, self).__init__(*a, **k)
     with self.component_guard():
         encoders = ButtonMatrixElement(rows=[
          [ EncoderElement(MIDI_CC_TYPE, 0, identifier + 20, Live.MidiMap.MapMode.absolute, name='Encoder_%d' % identifier) for identifier in xrange(4)
          ]])
         device = DeviceComponent(name='Device', is_enabled=False, layer=Layer(parameter_controls=encoders), device_selection_follows_track_selection=True)
         device.set_enabled(True)
         self.set_device_component(device)
コード例 #22
0
    def _setup_device_control(self):
        sliders = []
        pressures = [92, 94, 98, 102, 106, 108]
        for index in range(6):
            sliders.append(
                SliderElement(MIDI_CC_TYPE, CHANNEL, pressures[index]))

        self._sliders = tuple(sliders)
        device = DeviceComponent()
        self.set_device_component(device)
        device.set_parameter_controls(self._sliders)
コード例 #23
0
 def _create_return_devices(self):
     self._device_returns = []
     for track in self.song().return_tracks:
         device = DeviceComponent()
         try:
             device.set_device(track.devices[0])
         except:
             self.log_message("no devices on return track")
         self._device_returns.append(device)
         if len(self._device_returns) == 2:
             break
コード例 #24
0
ファイル: Launch_Parent.py プロジェクト: zaslonmusic/Launch_Z
 def _setup_device(self):
     encoders = [
         make_encoder(21 + index, 'Device_Control_%d' % index)
         for index in xrange(8)
     ]
     self._encoders = tuple(encoders)
     device = DeviceComponent(device_selection_follows_track_selection=True)
     device.name = 'Device_Component'
     self.set_device_component(device)
     device.set_parameter_controls(self._encoders)
     self._deviceonoff = self._control_factory.create_device_switch_button()
     device.set_on_off_button(self._deviceonoff)
コード例 #25
0
    def _init_device_component(self, device_controls, bank_controls, global_channel, macro_map_mode):
        is_momentary = True
        DeviceButton = partial(ButtonElement, is_momentary, MIDI_CC_TYPE)

        def make_bank_button(control, name, is_momentary=True):
            return DeviceButton(global_channel, bank_controls[control], name=name)

        if device_controls:
            device = DeviceComponent(device_selection_follows_track_selection=True, name='Device_Component')
            layer_specs = {}
            if bank_controls:
                if has_specification_for('NEXTBANK', bank_controls):
                    layer_specs['bank_next_button'] = make_bank_button('NEXTBANK', 'Device_Next_Bank_Button')
                if has_specification_for('PREVBANK', bank_controls):
                    layer_specs['bank_prev_button'] = make_bank_button('PREVBANK', 'Device_Previous_Bank_Button')
                if has_specification_for('TOGGLELOCK', bank_controls):
                    layer_specs['lock_button'] = make_bank_button('TOGGLELOCK', 'Device_Lock_Button')
                bank_buttons_raw = []
                for index in xrange(8):
                    key = 'BANK' + str(index + 1)
                    if key in bank_controls.keys():
                        control_info = bank_controls[key]
                        channel = global_channel
                        cc = control_info
                        if isinstance(control_info, (tuple, list)):
                            cc = control_info[0]
                            if is_valid_midi_channel(control_info[1]):
                                channel = control_info[1]
                        if is_valid_midi_identifier(cc) and is_valid_midi_channel(channel):
                            name = 'Device_Bank_' + str(index) + '_Button'
                            bank_buttons_raw.append(DeviceButton(channel, cc, name=name))

                if len(bank_buttons_raw) > 0:
                    layer_specs['bank_buttons'] = ButtonMatrixElement(rows=[
                     bank_buttons_raw])
            parameter_encoders_raw = []
            for index, control_info in enumerate(device_controls):
                channel = global_channel
                cc = control_info
                if isinstance(control_info, (tuple, list)):
                    cc = control_info[0]
                    if is_valid_midi_channel(control_info[1]):
                        channel = control_info[1]
                if is_valid_midi_identifier(cc) and is_valid_midi_channel(channel):
                    name = 'Device_Parameter_%d_Control' % index
                    parameter_encoders_raw.append(EncoderElement(MIDI_CC_TYPE, channel, cc, macro_map_mode, name=name))

            if len(parameter_encoders_raw) > 0:
                layer_specs['parameter_controls'] = ButtonMatrixElement(rows=[
                 parameter_encoders_raw])
            device.layer = Layer(**layer_specs)
            self.set_device_component(device)
コード例 #26
0
ファイル: MonoMixerComponent.py プロジェクト: aumhaa/m4m7
	def __init__(self, *a, **k):
		super(ChannelStripComponent, self).__init__(*a, **k)
		self._device_component = DeviceComponent()
		self._device_component._show_msg_callback = lambda message: None
		self._on_selected_track_changed.subject = self.song().view
		self._fold_task = self._tasks.add(Task.sequence(Task.wait(TRACK_FOLD_DELAY), Task.run(self._do_fold_track))).kill()
		#self._cue_volume_slot = self.register_disconnectable(ParameterSlot())
		self._track_state = self.register_disconnectable(TrackArmState())
		self._on_arm_state_changed.subject = self._track_state
		self._eq_gain_controls = None
		self._eq_device = None
		self._record_button_value = 0
		self._arming_select_button = None
コード例 #27
0
    def __init__(self, *a, **k):
        super(MPK261Custom, self).__init__(*a, **k)
        with self.component_guard():
            midimap = MidiMap()
            drum_rack = DrumRackComponent(name=u'Drum_Rack', is_enabled=False,
                                          layer=Layer(pads=midimap[u'Drum_Pads']))
            drum_rack.set_enabled(True)
            transport = TransportComponent(name=u'Transport', is_enabled=False, layer=Layer(
                play_button=midimap[u'Play'],
                record_button=midimap[u'Record'],
                stop_button=midimap[u'Stop'],
                seek_forward_button=midimap[u'Forward'],
                seek_backward_button=midimap[u'Backward'],
                loop_button=midimap[u'Loop'],
                metronome_button=midimap[u'Metronome'],
                tap_tempo_button=midimap[u'TapTempoButton'],
                quant_toggle_button=midimap[u'RecQuantButton'],
                overdub_button=midimap[u'OverdubButton']
                ))
            transport.set_enabled(True)
            mixer_size = len(midimap[u'Sliders'])

            # Custom changes: Adds the "mute" buttons. By default, mute = turns light on.
            # invert_mute_feedback flips it around so muting = turns light off.
            mixer = MixerComponent(mixer_size, name=u'Mixer', is_enabled=False,
                                   invert_mute_feedback=True,
                                   layer=Layer(
                                       volume_controls=midimap[u'Sliders'],
                                       pan_controls=midimap[u'Encoders'],
                                       arm_buttons=midimap[u'Arm_Buttons'],
                                       mute_buttons=midimap[u'Mute_Buttons'],
                                   ))
            mixer.set_enabled(True)

            # Adds the blue hand controls.
            device = DeviceComponent(
                name=u'Device', is_enabled=False,
                layer=Layer(parameter_controls=midimap[u'EncodersB1']),
                device_selection_follows_track_selection=True)
            device.set_enabled(True)
            self.set_device_component(device)

            session = SessionComponent(
                SESSION_WIDTH, SESSION_HEIGHT, auto_name=True, enable_skinning=True,
                is_enabled=False, layer=Layer(
                    clip_launch_buttons=midimap[u'Drum_Pads_BankB'],
                    stop_track_clip_buttons=midimap[u'Drum_Pads_BankC_BottomRow'],
                    scene_launch_buttons=midimap[u'Drum_Pads_BankD_RightColumn']))
            session.set_enabled(True)

        self.log_message(u' ***** MPK261 Custom script loaded ****')
コード例 #28
0
    def _setup_session_control(self):
        is_momentary = True
        self._device = DeviceComponent()
        self._device.name = 'Device_Component'
        self._session = SpecialSessionComponent(4, 4)
        self._session.name = 'Session_Control'
        self._session.set_track_bank_buttons(
            self._set_button(BUTTONCHANNEL + 1, SESSIONRIGHT),
            self._set_button(BUTTONCHANNEL + 1, SESSIONLEFT))
        self._session.set_scene_bank_buttons(
            self._set_button(BUTTONCHANNEL + 1, SESSIONDOWN),
            self._set_button(BUTTONCHANNEL + 1, SESSIONUP))
        self._session_zoom = SpecialZoomingComponent(self._session)
        self._session_zoom.name = 'Session_Overview'
        self._session_zoom.set_nav_buttons(
            self._set_button(BUTTONCHANNEL + 1, ZOOMUP),
            self._set_button(BUTTONCHANNEL + 1, ZOOMDOWN),
            self._set_button(BUTTONCHANNEL + 1, ZOOMLEFT),
            self._set_button(BUTTONCHANNEL + 1, ZOOMRIGHT))
        tracks = self.getslots()  #get clip slots to access clip colors
        for scene_index in range(4):
            scene_off = self._session._scene_offset
            scene = self._session.scene(scene_index + scene_off)
            scene.name = 'Scene_' + str(scene_index + scene_off)
            button_row = []
            for track_index in range(4):
                button = self._set_button(
                    BUTTONCHANNEL, CLIPNOTEMAP[scene_index][track_index],
                    GREEN, OFF)
                button_row.append(button)
                clip_slot = scene.clip_slot(track_index)
                clip_slot.name = str(track_index) + '_Clip_Slot_' + str(
                    scene_index + scene_off)
                clip_slot.set_launch_button(button)
                c = tracks[track_index][scene_index +
                                        scene_off]  #get clip for color
                clip_slot.set_stopped_value(LOWYELLOW)
                if c.clip != None:
                    cval = self._get_MF3D_color(self.int_to_rgb(c.clip.color))
                    self.log_message("Clip:  tr: " + str(track_index) +
                                     " clip: " + str(scene_index + scene_off) +
                                     " has color: " +
                                     str(self.int_to_rgb(c.clip.color)) +
                                     " va " + str(cval))
                    clip_slot.set_stopped_value(cval)
##                clip_slot.set_triggered_to_launch_value(1)
                clip_slot.set_triggered_to_play_value(PLAYTRIG_COL)
                clip_slot.set_started_value(TRIGD_COL)
                clip_slot.set_triggered_to_record_value(RECTRIG_COL)
                clip_slot.set_recording_value(RECD_COL)
コード例 #29
0
 def _create_device(self):
     self._device = DeviceComponent(
         name=b'Device',
         is_enabled=False,
         layer=Layer(parameter_controls=self._device_encoders),
         device_selection_follows_track_selection=True)
     self._device.set_enabled(True)
     self.set_device_component(self._device)
     self._device_navigation = DeviceNavigationComponent(
         name=b'Device_Navigation',
         is_enabled=False,
         layer=Layer(device_nav_left_button=self._device_left_button,
                     device_nav_right_button=self._device_right_button))
     self._device_navigation.set_enabled(True)
コード例 #30
0
    def pad_device_params(self):
        device_param_controls = []
        for param in self.note_page_cc[:8]:
            self.rotary_encoder_potis[param] = EncoderElement(
                MIDI_CC_TYPE, 0, param, Live.MidiMap.MapMode.absolute)
            self.rotary_encoder_potis[param].release_parameter()
            self.rotary_encoder_potis[param].send_value(0, True)
            self.rotary_encoder_potis[param].clear_send_cache()
            device_param_controls.append(self.rotary_encoder_potis[param])

        device = DeviceComponent()
        device.name = 'Device_Component pad'
        device.set_parameter_controls(tuple(device_param_controls))
        self.set_device_component(device)