class BeatStep(ArturiaControlSurface): def __init__(self, *a, **k): super(BeatStep, self).__init__(*a, **k) self._skin = Skin(Colors) with self.component_guard(): self._create_controls() self._create_device() self._create_session() self._create_mixer() self._create_transport() def _create_controls(self): self._device_encoders = ButtonMatrixElement(rows=[ [ EncoderElement(MIDI_CC_TYPE, 0, identifier, Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Encoder_%d_%d' % (column_index, row_index)) for column_index, identifier in enumerate(row) ] for row_index, row in enumerate(( ENCODER_MSG_IDS[:4], ENCODER_MSG_IDS[8:12])) ]) self._horizontal_scroll_encoder = EncoderElement(MIDI_CC_TYPE, 0, 75, Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Horizontal_Scroll_Encoder') self._vertical_scroll_encoder = EncoderElement(MIDI_CC_TYPE, 0, 72, Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Vertical_Scroll_Encoder') self._volume_encoder = EncoderElement(MIDI_CC_TYPE, 0, 91, Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Volume_Encoder') self._pan_encoder = EncoderElement(MIDI_CC_TYPE, 0, 17, Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Pan_Encoder') self._send_a_encoder = EncoderElement(MIDI_CC_TYPE, 0, 77, Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Send_A_Encoder') self._send_b_encoder = EncoderElement(MIDI_CC_TYPE, 0, 93, Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Send_B_Encoder') self._send_encoders = ButtonMatrixElement(rows=[ [ self._send_a_encoder, self._send_b_encoder]]) self._return_a_encoder = EncoderElement(MIDI_CC_TYPE, 0, 73, Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Return_A_Encoder') self._return_b_encoder = EncoderElement(MIDI_CC_TYPE, 0, 79, Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Return_B_Encoder') self._return_encoders = ButtonMatrixElement(rows=[ [ self._return_a_encoder, self._return_b_encoder]]) self._pads = ButtonMatrixElement(rows=[ [ ButtonElement(True, MIDI_NOTE_TYPE, PAD_CHANNEL, identifier, name='Pad_%d_%d' % (col_index, row_index), skin=self._skin) for col_index, identifier in enumerate(row) ] for row_index, row in enumerate(PAD_MSG_IDS) ]) self._stop_button = ButtonElement(True, MIDI_CC_TYPE, 0, 1, name='Stop_Button') self._play_button = ButtonElement(True, MIDI_CC_TYPE, 0, 2, name='Play_Button') def _create_device(self): self._device = DeviceComponent(name='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) def _create_session(self): self._session = SessionComponent(name='Session', is_enabled=False, num_tracks=self._pads.width(), num_scenes=self._pads.height(), enable_skinning=True, layer=Layer(clip_launch_buttons=self._pads, scene_select_control=self._vertical_scroll_encoder)) self._session.set_enabled(True) def _create_mixer(self): self._mixer = MixerComponent(name='Mixer', is_enabled=False, num_returns=2, layer=Layer(track_select_encoder=self._horizontal_scroll_encoder, selected_track_volume_control=self._volume_encoder, selected_track_pan_control=self._pan_encoder, selected_track_send_controls=self._send_encoders, return_volume_controls=self._return_encoders)) self._mixer.set_enabled(True) def _create_transport(self): self._transport = TransportComponent(name='Transport', is_enabled=False, layer=Layer(stop_button=self._stop_button, play_button=self._play_button)) self._transport.set_enabled(True) def _collect_setup_messages(self): for identifier, hardware_id in izip(ENCODER_MSG_IDS, HARDWARE_ENCODER_IDS): self._setup_hardware_encoder(hardware_id, identifier) self._setup_hardware_button(HARDWARE_STOP_BUTTON_ID, 1, msg_type='cc') self._setup_hardware_button(HARDWARE_PLAY_BUTTON_ID, 2, msg_type='cc') for hardware_id, identifier in izip(HARDWARE_PAD_IDS, chain(*PAD_MSG_IDS)): self._setup_hardware_button(hardware_id, identifier, PAD_CHANNEL, msg_type='note')
def _create_mixer(self): self._mixer = MixerComponent( name='Mixer', is_enabled=False, num_returns=2, layer=Layer(track_select_encoder=self._horizontal_scroll_encoder, selected_track_volume_control=self._volume_encoder, selected_track_pan_control=self._pan_encoder, selected_track_send_controls=self._send_encoders, return_volume_controls=self._return_encoders)) self._mixer.set_enabled(True)
class BeatStep(ArturiaControlSurface): def __init__(self, *a, **k): super(BeatStep, self).__init__(*a, **k) self._skin = Skin(Colors) with self.component_guard(): self._create_controls() self._create_device() self._create_session() self._create_mixer() self._create_transport() def _create_controls(self): self._device_encoders = ButtonMatrixElement(rows=[ [ EncoderElement(MIDI_CC_TYPE, 0, identifier, Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Encoder_%d_%d' % (column_index, row_index)) for column_index, identifier in enumerate(row) ] for row_index, row in enumerate((ENCODER_MSG_IDS[:4], ENCODER_MSG_IDS[8:12])) ]) self._horizontal_scroll_encoder = EncoderElement(MIDI_CC_TYPE, 0, 75, Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Horizontal_Scroll_Encoder') self._vertical_scroll_encoder = EncoderElement(MIDI_CC_TYPE, 0, 72, Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Vertical_Scroll_Encoder') self._volume_encoder = EncoderElement(MIDI_CC_TYPE, 0, 91, Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Volume_Encoder') self._pan_encoder = EncoderElement(MIDI_CC_TYPE, 0, 17, Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Pan_Encoder') self._send_a_encoder = EncoderElement(MIDI_CC_TYPE, 0, 77, Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Send_A_Encoder') self._send_b_encoder = EncoderElement(MIDI_CC_TYPE, 0, 93, Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Send_B_Encoder') self._send_encoders = ButtonMatrixElement(rows=[[self._send_a_encoder, self._send_b_encoder]]) self._return_a_encoder = EncoderElement(MIDI_CC_TYPE, 0, 73, Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Return_A_Encoder') self._return_b_encoder = EncoderElement(MIDI_CC_TYPE, 0, 79, Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Return_B_Encoder') self._return_encoders = ButtonMatrixElement(rows=[[self._return_a_encoder, self._return_b_encoder]]) self._pads = ButtonMatrixElement(rows=[ [ ButtonElement(True, MIDI_NOTE_TYPE, PAD_CHANNEL, identifier, name='Pad_%d_%d' % (col_index, row_index), skin=self._skin) for col_index, identifier in enumerate(row) ] for row_index, row in enumerate(PAD_MSG_IDS) ]) self._stop_button = ButtonElement(True, MIDI_CC_TYPE, 0, 1, name='Stop_Button') self._play_button = ButtonElement(True, MIDI_CC_TYPE, 0, 2, name='Play_Button') def _create_device(self): self._device = DeviceComponent(name='Device', is_enabled=False, layer=Layer(parameter_controls=self._device_encoders)) self._device.set_enabled(True) self.set_device_component(self._device) self._device_selection_follows_track_selection = True def _create_session(self): self._session = SessionComponent(name='Session', is_enabled=False, num_tracks=self._pads.width(), num_scenes=self._pads.height(), enable_skinning=True, layer=Layer(clip_launch_buttons=self._pads, scene_select_control=self._vertical_scroll_encoder)) self._session.set_enabled(True) def _create_mixer(self): self._mixer = MixerComponent(name='Mixer', is_enabled=False, num_returns=2, layer=Layer(track_select_encoder=self._horizontal_scroll_encoder, selected_track_volume_control=self._volume_encoder, selected_track_pan_control=self._pan_encoder, selected_track_send_controls=self._send_encoders, return_volume_controls=self._return_encoders)) self._mixer.set_enabled(True) def _create_transport(self): self._transport = TransportComponent(name='Transport', is_enabled=False, layer=Layer(stop_button=self._stop_button, play_button=self._play_button)) self._transport.set_enabled(True) def _collect_setup_messages(self): for identifier, hardware_id in izip(ENCODER_MSG_IDS, HARDWARE_ENCODER_IDS): self._setup_hardware_encoder(hardware_id, identifier) self._setup_hardware_button(HARDWARE_STOP_BUTTON_ID, 1, msg_type='cc') self._setup_hardware_button(HARDWARE_PLAY_BUTTON_ID, 2, msg_type='cc') for hardware_id, identifier in izip(HARDWARE_PAD_IDS, chain(*PAD_MSG_IDS)): self._setup_hardware_button(hardware_id, identifier, PAD_CHANNEL, msg_type='note')
class MiniLab(ArturiaControlSurface): session_component_type = SessionComponent encoder_msg_channel = 0 encoder_msg_ids = (7, 74, 71, 76, 77, 93, 73, 75, 114, 18, 19, 16, 17, 91, 79, 72) pad_channel = 9 def __init__(self, *a, **k): super(MiniLab, self).__init__(*a, **k) with self.component_guard(): self._create_controls() self._create_device() self._create_session() self._create_mixer() def _create_controls(self): self._device_controls = ButtonMatrixElement(rows=[ [ EncoderElement(MIDI_CC_TYPE, self.encoder_msg_channel, identifier, Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Encoder_%d_%d' % (column_index, row_index)) for column_index, identifier in enumerate(row) ] for row_index, row in enumerate((self.encoder_msg_ids[:4], self.encoder_msg_ids[8:12])) ]) self._horizontal_scroll_encoder = EncoderElement(MIDI_CC_TYPE, self.encoder_msg_channel, self.encoder_msg_ids[7], Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Horizontal_Scroll_Encoder') self._vertical_scroll_encoder = EncoderElement(MIDI_CC_TYPE, self.encoder_msg_channel, self.encoder_msg_ids[15], Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Vertical_Scroll_Encoder') self._volume_encoder = EncoderElement(MIDI_CC_TYPE, self.encoder_msg_channel, self.encoder_msg_ids[13], Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Volume_Encoder') self._pan_encoder = EncoderElement(MIDI_CC_TYPE, self.encoder_msg_channel, self.encoder_msg_ids[12], Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Pan_Encoder') self._send_a_encoder = EncoderElement(MIDI_CC_TYPE, self.encoder_msg_channel, self.encoder_msg_ids[4], Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Send_A_Encoder') self._send_b_encoder = EncoderElement(MIDI_CC_TYPE, self.encoder_msg_channel, self.encoder_msg_ids[5], Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Send_B_Encoder') self._send_encoders = ButtonMatrixElement(rows=[[self._send_a_encoder, self._send_b_encoder]]) self._return_a_encoder = EncoderElement(MIDI_CC_TYPE, self.encoder_msg_channel, self.encoder_msg_ids[6], Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Return_A_Encoder') self._return_b_encoder = EncoderElement(MIDI_CC_TYPE, self.encoder_msg_channel, self.encoder_msg_ids[14], Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Return_B_Encoder') self._return_encoders = ButtonMatrixElement(rows=[[self._return_a_encoder, self._return_b_encoder]]) self._pads = ButtonMatrixElement(rows=[ [ ButtonElement(True, MIDI_NOTE_TYPE, self.pad_channel, col + 36 + 8 * row, name='Pad_%d_%d' % (col, row)) for col in xrange(8) ] for row in xrange(2) ]) 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) def _create_session(self): self._session = self.session_component_type(num_tracks=self._pads.width(), num_scenes=self._pads.height(), name='Session', is_enabled=False, layer=Layer(clip_launch_buttons=self._pads, scene_select_control=self._vertical_scroll_encoder)) self._session.set_enabled(True) def _create_mixer(self): self._mixer = MixerComponent(name='Mixer', is_enabled=False, num_returns=2, layer=Layer(track_select_encoder=self._horizontal_scroll_encoder, selected_track_volume_control=self._volume_encoder, selected_track_pan_control=self._pan_encoder, selected_track_send_controls=self._send_encoders, return_volume_controls=self._return_encoders)) self._mixer.set_enabled(True) def _collect_setup_messages(self): for cc_id, encoder_id in izip(self.encoder_msg_ids, HARDWARE_ENCODER_IDS): self._setup_hardware_encoder(encoder_id, cc_id, channel=self.encoder_msg_channel) for index, pad_id in enumerate(HARDWARE_BUTTON_IDS): self._setup_hardware_button(pad_id, index + PAD_IDENTIFIER_OFFSET, self.pad_channel)
class MiniLab(ArturiaControlSurface): def __init__(self, *a, **k): super(MiniLab, self).__init__(*a, **k) with self.component_guard(): self._create_controls() self._create_device() self._create_session() self._create_mixer() def _create_controls(self): self._device_controls = ButtonMatrixElement(rows=[ [ EncoderElement(MIDI_CC_TYPE, 0, identifier, Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Encoder_%d_%d' % (column_index, row_index)) for column_index, identifier in enumerate(row) ] for row_index, row in enumerate((ENCODER_MSG_IDS[:4], ENCODER_MSG_IDS[8:12])) ]) self._horizontal_scroll_encoder = EncoderElement(MIDI_CC_TYPE, 0, 75, Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Horizontal_Scroll_Encoder') self._vertical_scroll_encoder = EncoderElement(MIDI_CC_TYPE, 0, 72, Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Vertical_Scroll_Encoder') self._volume_encoder = EncoderElement(MIDI_CC_TYPE, 0, 91, Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Volume_Encoder') self._pan_encoder = EncoderElement(MIDI_CC_TYPE, 0, 17, Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Pan_Encoder') self._send_a_encoder = EncoderElement(MIDI_CC_TYPE, 0, 77, Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Send_A_Encoder') self._send_b_encoder = EncoderElement(MIDI_CC_TYPE, 0, 93, Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Send_B_Encoder') self._send_encoders = ButtonMatrixElement(rows=[[self._send_a_encoder, self._send_b_encoder]]) self._return_a_encoder = EncoderElement(MIDI_CC_TYPE, 0, 73, Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Return_A_Encoder') self._return_b_encoder = EncoderElement(MIDI_CC_TYPE, 0, 79, Live.MidiMap.MapMode.relative_smooth_two_compliment, name='Return_B_Encoder') self._return_encoders = ButtonMatrixElement(rows=[[self._return_a_encoder, self._return_b_encoder]]) self._pads = ButtonMatrixElement(rows=[ [ ButtonElement(True, MIDI_NOTE_TYPE, PAD_CHANNEL, col + 36 + 8 * row, name='Pad_%d_%d' % (col, row)) for col in xrange(8) ] for row in xrange(2) ]) def _create_device(self): self._device = DeviceComponent(name='Device', is_enabled=False, layer=Layer(parameter_controls=self._device_controls)) self._device.set_enabled(True) self.set_device_component(self._device) self._device_selection_follows_track_selection = True def _create_session(self): self._session = SessionComponent(num_tracks=self._pads.width(), num_scenes=self._pads.height(), name='Session', is_enabled=False, layer=Layer(clip_launch_buttons=self._pads, scene_select_control=self._vertical_scroll_encoder)) self._session.set_enabled(True) def _create_mixer(self): self._mixer = MixerComponent(name='Mixer', is_enabled=False, num_returns=2, layer=Layer(track_select_encoder=self._horizontal_scroll_encoder, selected_track_volume_control=self._volume_encoder, selected_track_pan_control=self._pan_encoder, selected_track_send_controls=self._send_encoders, return_volume_controls=self._return_encoders)) self._mixer.set_enabled(True) def _collect_setup_messages(self): for cc_id, encoder_id in izip(ENCODER_MSG_IDS, HARDWARE_ENCODER_IDS): self._setup_hardware_encoder(encoder_id, cc_id) for index, pad_id in enumerate(HARDWARE_BUTTON_IDS): identifier = index + PAD_IDENTIFIER_OFFSET channel = PAD_CHANNEL self._setup_hardware_button(pad_id, identifier, channel)
def _create_mixer(self): self._mixer = MixerComponent(name='Mixer', is_enabled=False, num_returns=2, layer=Layer(track_select_encoder=self._horizontal_scroll_encoder, selected_track_volume_control=self._volume_encoder, selected_track_pan_control=self._pan_encoder, selected_track_send_controls=self._send_encoders, return_volume_controls=self._return_encoders)) self._mixer.set_enabled(True)
class MiniLab(ArturiaControlSurface): session_component_type = SessionComponent encoder_msg_channel = 0 encoder_msg_ids = (7, 74, 71, 76, 77, 93, 73, 75, 114, 18, 19, 16, 17, 91, 79, 72) pad_channel = 9 def __init__(self, *a, **k): super(MiniLab, self).__init__(*a, **k) with self.component_guard(): self._create_controls() self._create_device() self._create_session() self._create_mixer() def _create_controls(self): self._device_controls = ButtonMatrixElement(rows=[[ EncoderElement(MIDI_CC_TYPE, self.encoder_msg_channel, identifier, Live.MidiMap.MapMode.relative_smooth_binary_offset, name=u'Encoder_%d_%d' % (column_index, row_index)) for column_index, identifier in enumerate(row) ] for row_index, row in enumerate((self.encoder_msg_ids[:4], self.encoder_msg_ids[8:12]))]) self._horizontal_scroll_encoder = EncoderElement( MIDI_CC_TYPE, self.encoder_msg_channel, self.encoder_msg_ids[7], Live.MidiMap.MapMode.relative_smooth_binary_offset, name=u'Horizontal_Scroll_Encoder') self._vertical_scroll_encoder = EncoderElement( MIDI_CC_TYPE, self.encoder_msg_channel, self.encoder_msg_ids[15], Live.MidiMap.MapMode.relative_smooth_binary_offset, name=u'Vertical_Scroll_Encoder') self._volume_encoder = EncoderElement( MIDI_CC_TYPE, self.encoder_msg_channel, self.encoder_msg_ids[13], Live.MidiMap.MapMode.relative_smooth_binary_offset, name=u'Volume_Encoder') self._pan_encoder = EncoderElement( MIDI_CC_TYPE, self.encoder_msg_channel, self.encoder_msg_ids[12], Live.MidiMap.MapMode.relative_smooth_binary_offset, name=u'Pan_Encoder') self._send_a_encoder = EncoderElement( MIDI_CC_TYPE, self.encoder_msg_channel, self.encoder_msg_ids[4], Live.MidiMap.MapMode.relative_smooth_binary_offset, name=u'Send_A_Encoder') self._send_b_encoder = EncoderElement( MIDI_CC_TYPE, self.encoder_msg_channel, self.encoder_msg_ids[5], Live.MidiMap.MapMode.relative_smooth_binary_offset, name=u'Send_B_Encoder') self._send_encoders = ButtonMatrixElement( rows=[[self._send_a_encoder, self._send_b_encoder]]) self._return_a_encoder = EncoderElement( MIDI_CC_TYPE, self.encoder_msg_channel, self.encoder_msg_ids[6], Live.MidiMap.MapMode.relative_smooth_binary_offset, name=u'Return_A_Encoder') self._return_b_encoder = EncoderElement( MIDI_CC_TYPE, self.encoder_msg_channel, self.encoder_msg_ids[14], Live.MidiMap.MapMode.relative_smooth_binary_offset, name=u'Return_B_Encoder') self._return_encoders = ButtonMatrixElement( rows=[[self._return_a_encoder, self._return_b_encoder]]) self._pads = ButtonMatrixElement(rows=[[ ButtonElement(True, MIDI_NOTE_TYPE, self.pad_channel, col + 36 + 8 * row, name=u'Pad_%d_%d' % (col, row)) for col in xrange(8) ] for row in xrange(2)]) def _create_device(self): self._device = DeviceComponent( name=u'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) def _create_session(self): self._session = self.session_component_type( num_tracks=self._pads.width(), num_scenes=self._pads.height(), name=u'Session', is_enabled=False, layer=Layer(clip_launch_buttons=self._pads, scene_select_control=self._vertical_scroll_encoder)) self._session.set_enabled(True) def _create_mixer(self): self._mixer = MixerComponent( name=u'Mixer', is_enabled=False, num_returns=2, layer=Layer(track_select_encoder=self._horizontal_scroll_encoder, selected_track_volume_control=self._volume_encoder, selected_track_pan_control=self._pan_encoder, selected_track_send_controls=self._send_encoders, return_volume_controls=self._return_encoders)) self._mixer.set_enabled(True) def _collect_setup_messages(self): # for cc_id, encoder_id in izip(self.encoder_msg_ids, HARDWARE_ENCODER_IDS): # self._setup_hardware_encoder(encoder_id, cc_id, channel=self.encoder_msg_channel) for index, pad_id in enumerate(HARDWARE_BUTTON_IDS): self._setup_hardware_button(pad_id, index + PAD_IDENTIFIER_OFFSET, self.pad_channel)