Beispiel #1
0
    def __init__(self, *a, **k):
        (super(Elements, self).__init__)(*a, **k)
        self.shift_button = create_button(32,
                                          'Shift_Button',
                                          resource_type=PrioritizedResource)
        self.zoom_button = create_button(104,
                                         'Zoom_Button',
                                         resource_type=PrioritizedResource)
        self.note_repeat_button = create_button(24, 'Note_Repeat_Button')
        self.full_level_button = create_button(25, 'Full_Level_Button')
        self.bank_button = create_button(26, 'Bank_Button')
        self.preset_button = create_button(27, 'Preset_Button')
        self.show_hide_button = create_button(29, 'Show_Hide_Button')
        self.nudge_button = create_button(30, 'Nudge_Button')
        self.editor_button = create_button(31, 'Editor_Button')
        self.set_loop_button = create_button(85, 'Set_Loop_Button')
        self.setup_button = create_button(86, 'Setup_Button')
        self.up_button = create_button(87, 'Up_Button')
        self.down_button = create_button(89, 'Down_Button')
        self.left_button = create_button(90, 'Left_Button')
        self.right_button = create_button(102, 'Right_Button')
        self.select_button = create_button(103, 'Select_Button')
        self.click_button = create_button(105, 'Click_Button')
        self.record_button = create_button(107, 'Record_Button')
        self.play_button = create_button(109, 'Play_Button')
        self.stop_button = create_button(111, 'Stop_Button')
        self.pads_raw = [[
            create_button((offset + col_index),
                          ('{}_Pad_{}'.format(col_index, row_index)),
                          msg_type=MIDI_NOTE_TYPE)
            for col_index in range(SESSION_WIDTH)
        ] for row_index, offset in enumerate(range(48, 32, -4))]
        self.pads = ButtonMatrixElement(rows=(self.pads_raw), name='Pads')

        def with_modifier(modifier_button, button):
            return ComboElement(control=button,
                                modifier=modifier_button,
                                name=('{}_With_{}'.format(
                                    button.name,
                                    modifier_button.name.split('_')[0])))

        self.play_button_with_shift = with_modifier(self.shift_button,
                                                    self.play_button)
        self.stop_button_with_shift = with_modifier(self.shift_button,
                                                    self.stop_button)
        self.pads_with_shift = ButtonMatrixElement(
            name='Pads_With_Shift',
            rows=(recursive_map(partial(with_modifier, self.shift_button),
                                self.pads_raw)))
        self.pads_with_zoom = ButtonMatrixElement(
            name='Pads_With_Zoom',
            rows=(recursive_map(partial(with_modifier, self.zoom_button),
                                self.pads_raw)))
        self.encoders = ButtonMatrixElement(rows=[[
            create_encoder(index + 14, 'Encoder_{}'.format(index))
            for index in range(4)
        ]],
                                            name='Encoders')
        self.native_mode_reply_element = InputControlElement(
            MIDI_CC_TYPE, 15, 127, name='Native_Mode_Reply_Element')
def create_ringed_encoder(identifier, ring_element_identifier, name):
    return RingedEncoderElement(MIDI_CC_TYPE,
      0,
      identifier,
      map_mode=(Live.MidiMap.MapMode.relative_signed_bit),
      ring_element=InputControlElement(MIDI_CC_TYPE,
      0, ring_element_identifier, name=(name + '_Ring_Element')),
      name=name)