def __init__(self, button_index, mono_chrome = False, *a, **k):
        super(ControlMode, self).__init__(button_index, *a, **a)
        self._device_bank_registry = DeviceBankRegistry()
        self._device_bank_registry.add_device_bank_listener(self._on_device_bank_changed)
        self.track_selections = tuple(lambda .0: for idx in .0:
ControlTrackElement(idx)(range(8)))
        self._is_monochrome = mono_chrome
        self.main_buttons = ([
            None,
            self._do_select_level], [
            None,
            self._do_select_pan], [
            None,
            self._do_select_send], [
            None,
            self._do_select_device])
        self.nav_buttons = ([
            None,
            self._do_nav1], [
            None,
            self._do_nav2], [
            None,
            self._do_nav3], [
            None,
            self._do_nav4])
        self.song().add_return_tracks_listener(self.return_tracks_changed)
    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'))
Пример #3
0
 def __init__(self, mode_selector, *a, **k):
     super(MonoNavSection, self).__init__(*a, **k)
     is_momentary = True
     self._modesel = mode_selector
     self._device_bank_registry = DeviceBankRegistry()
     self.volume_knob = SliderElement(MIDI_CC_TYPE, 0, 40)
     self.tempo_knob = SliderElement(MIDI_CC_TYPE, 0, 41)
     self.swing_knob = SliderElement(MIDI_CC_TYPE, 0, 42)
     self.mode_button = ButtonElement(True, MIDI_CC_TYPE, 2, 86)
     self.alt_button = ButtonElement(True, MIDI_CC_TYPE, 2, 81)
     self._do_left_knob.subject = self.volume_knob
     self._do_center_knob.subject = self.tempo_knob
     self._do_right_knob.subject = self.swing_knob
     self._do_mode_button.subject = self.mode_button
     self._do_alt_button.subject = self.alt_button
     self._mode = MODE_ADJUST
     self._alt_down = False