class Elements(ElementsBase):
    def __init__(self, *a, **k):
        super(Elements, self).__init__(
            continuous_mapping_sensitivity=CONTINUOUS_MAPPING_SENSITIVITY,
            fine_grained_continuous_mapping_sensitivity=
            FINE_GRAINED_CONTINUOUS_MAPPING_SENSITIVITY,
            *a,
            **k)
        self.display_line1 = self._create_display_line(sysex.CLEAR_LINE1,
                                                       sysex.WRITE_LINE1, 0)
        self.display_line2 = self._create_display_line(sysex.CLEAR_LINE2,
                                                       sysex.WRITE_LINE2, 1)
        self.display_line3 = self._create_display_line(sysex.CLEAR_LINE3,
                                                       sysex.WRITE_LINE3, 2)
        self.display_line4 = self._create_display_line(sysex.CLEAR_LINE4,
                                                       sysex.WRITE_LINE4, 3)
        self.display_lines = [
            self.display_line1, self.display_line2, self.display_line3,
            self.display_line4
        ]
        with_shift = partial(ComboElement, modifier=self.shift_button)
        self.shifted_matrix = ButtonMatrixElement(name='Shifted_Button_Matrix',
                                                  rows=recursive_map(
                                                      with_shift,
                                                      self.matrix_rows_raw))
        touch_strip_mode_element = SysexElement(
            send_message_generator=sysex.make_touch_strip_mode_message)
        touch_strip_light_element = SysexElement(
            send_message_generator=sysex.make_touch_strip_light_message)
        self.touch_strip_tap = create_note_button(12, 'Touch_Strip_Tap')
        self.touch_strip_control = TouchStripElement(
            name='Touch_Strip_Control',
            touch_button=self.touch_strip_tap,
            mode_element=touch_strip_mode_element,
            light_element=touch_strip_light_element)
        self.touch_strip_control.set_feedback_delay(-1)
        self.touch_strip_control.set_needs_takeover(False)
        base_message_generator = make_send_message_generator(
            sysex.SET_AFTERTOUCH_MODE)

        def make_aftertouch_mode_message(mode_id):
            raise mode_id in ('polyphonic', 'mono') or AssertionError
            mode_message = sysex.POLY_AFTERTOUCH if mode_id == 'polyphonic' else sysex.MONO_AFTERTOUCH
            return base_message_generator(mode_message)

        self.aftertouch_control = SysexElement(
            sysex_identifier=sysex.SET_AFTERTOUCH_MODE,
            send_message_generator=make_aftertouch_mode_message,
            default_value='polyphonic')

    def _create_display_line(self, clear_cmd, write_cmd, index):
        line = SpecialPhysicalDisplay(consts.DISPLAY_LENGTH, 1)
        line.set_clear_all_message(clear_cmd)
        line.set_message_parts(write_cmd, (247, ))
        line.name = 'Display_Line_%d' % index
        line.reset()
        return line
class Elements(ElementsBase):
    def __init__(self, model=None, *a, **k):
        assert model is not None
        self._model = model
        super(Elements, self).__init__(
            continuous_mapping_sensitivity=CONTINUOUS_MAPPING_SENSITIVITY,
            fine_grained_continuous_mapping_sensitivity=
            FINE_GRAINED_CONTINUOUS_MAPPING_SENSITIVITY,
            *a,
            **k)
        for button in self.select_buttons_raw:
            button.is_rgb = True

        self.mix_button = self.single_track_mix_mode_button
        self.page_left_button = self.in_button
        self.page_left_button.name = 'Page_Left_Button'
        self.page_right_button = self.out_button
        self.page_right_button.name = 'Page_Right_Button'
        self.global_mute_button.is_rgb = True
        self.global_solo_button.is_rgb = True
        self.global_track_stop_button.is_rgb = True
        self.play_button.is_rgb = True
        self.record_button.is_rgb = True
        self.automation_button.is_rgb = True
        for button in self.side_buttons_raw:
            button.is_rgb = True

        self.convert_button = create_button(35, 'Convert')
        self.setup_button = create_button(30, 'Setup_Button')
        self.layout_button = create_button(31, 'Layout')
        self._create_touch_strip()
        self.aftertouch_control = SysexElement(
            send_message_generator=sysex.make_aftertouch_mode_message,
            default_value='polyphonic')
        return

    def _create_touch_strip(self):
        touch_strip_mode_element = SysexElement(
            send_message_generator=sysex.make_touch_strip_mode_message)
        touch_strip_light_element = SysexElement(
            send_message_generator=sysex.make_touch_strip_light_message)
        self.touch_strip_tap = create_note_button(12, 'Touch_Strip_Tap')
        self.touch_strip_control = TouchStripElement(
            name='Touch_Strip_Control',
            touch_button=self.touch_strip_tap,
            mode_element=touch_strip_mode_element,
            light_element=touch_strip_light_element)
        self.touch_strip_control.state_count = 31
        self.touch_strip_control.set_feedback_delay(-1)
        self.touch_strip_control.set_needs_takeover(False)
Пример #3
0
class Elements(ElementsBase):

    def __init__(self, model = None, *a, **k):
        raise model is not None or AssertionError
        self._model = model
        super(Elements, self).__init__(*a, **k)
        for button in self.select_buttons_raw:
            button.is_rgb = True

        self.mix_button = self.single_track_mix_mode_button
        self.page_left_button = self.in_button
        self.page_left_button.name = 'Page_Left_Button'
        self.page_right_button = self.out_button
        self.page_right_button.name = 'Page_Right_Button'
        self.global_mute_button.is_rgb = True
        self.global_solo_button.is_rgb = True
        self.global_track_stop_button.is_rgb = True
        self.play_button.is_rgb = True
        self.record_button.is_rgb = True
        self.automation_button.is_rgb = True
        for button in self.side_buttons_raw:
            button.is_rgb = True

        self.convert_button = create_button(35, 'Convert')
        self.setup_button = create_button(30, 'Setup_Button')
        self.layout_button = create_button(31, 'Layout')
        self._create_touch_strip()
        self.aftertouch_control = SysexElement(send_message_generator=sysex.make_aftertouch_mode_message, default_value='polyphonic')
        return

    def _create_touch_strip(self):
        touch_strip_mode_element = SysexElement(send_message_generator=sysex.make_touch_strip_mode_message)
        touch_strip_light_element = SysexElement(send_message_generator=sysex.make_touch_strip_light_message)
        self.touch_strip_tap = create_note_button(12, 'Touch_Strip_Tap')
        self.touch_strip_control = TouchStripElement(name='Touch_Strip_Control', touch_button=self.touch_strip_tap, mode_element=touch_strip_mode_element, light_element=touch_strip_light_element)
        self.touch_strip_control.state_count = 31
        self.touch_strip_control.set_feedback_delay(-1)
        self.touch_strip_control.set_needs_takeover(False)
class Elements(ElementsBase):

    def __init__(self, *a, **k):
        super(Elements, self).__init__(*a, **k)
        self.display_line1 = self._create_display_line(sysex.CLEAR_LINE1, sysex.WRITE_LINE1, 0)
        self.display_line2 = self._create_display_line(sysex.CLEAR_LINE2, sysex.WRITE_LINE2, 1)
        self.display_line3 = self._create_display_line(sysex.CLEAR_LINE3, sysex.WRITE_LINE3, 2)
        self.display_line4 = self._create_display_line(sysex.CLEAR_LINE4, sysex.WRITE_LINE4, 3)
        self.display_lines = [self.display_line1,
         self.display_line2,
         self.display_line3,
         self.display_line4]
        with_shift = partial(ComboElement, modifier=self.shift_button)
        self.shifted_matrix = ButtonMatrixElement(name='Shifted_Button_Matrix', rows=recursive_map(with_shift, self.matrix_rows_raw))
        touch_strip_mode_element = SysexElement(send_message_generator=sysex.make_touch_strip_mode_message)
        touch_strip_light_element = SysexElement(send_message_generator=sysex.make_touch_strip_light_message)
        self.touch_strip_tap = create_note_button(12, 'Touch_Strip_Tap')
        self.touch_strip_control = TouchStripElement(name='Touch_Strip_Control', touch_button=self.touch_strip_tap, mode_element=touch_strip_mode_element, light_element=touch_strip_light_element)
        self.touch_strip_control.set_feedback_delay(-1)
        self.touch_strip_control.set_needs_takeover(False)
        base_message_generator = make_send_message_generator(sysex.SET_AFTERTOUCH_MODE)

        def make_aftertouch_mode_message(mode_id):
            raise mode_id in ('polyphonic', 'mono') or AssertionError
            mode_message = sysex.POLY_AFTERTOUCH if mode_id == 'polyphonic' else sysex.MONO_AFTERTOUCH
            return base_message_generator(mode_message)

        self.aftertouch_control = SysexElement(sysex_identifier=sysex.SET_AFTERTOUCH_MODE, send_message_generator=make_aftertouch_mode_message, default_value='polyphonic')

    def _create_display_line(self, clear_cmd, write_cmd, index):
        line = SpecialPhysicalDisplay(consts.DISPLAY_LENGTH, 1)
        line.set_clear_all_message(clear_cmd)
        line.set_message_parts(write_cmd, (247,))
        line.name = 'Display_Line_%d' % index
        line.reset()
        return line