def __init__(self, c_instance): ControlSurface.__init__(self, c_instance) with self.component_guard(): self.set_pad_translations(PAD_TRANSLATIONS) self._suggested_input_port = 'DirectLink' self._suggested_output_port = 'DirectLink' self._waiting_for_first_response = True self._has_sliders = True self._current_midi_map = None self._display_reset_delay = -1 self._shift_pressed = False self._shift_button = ButtonElement(IS_MOMENTARY, MIDI_CC_TYPE, 15, 13) self._master_slider = SliderElement(MIDI_CC_TYPE, 15, 41) self._next_nav_button = ButtonElement(IS_MOMENTARY, MIDI_CC_TYPE, 15, 111) self._prev_nav_button = ButtonElement(IS_MOMENTARY, MIDI_CC_TYPE, 15, 110) self._device_bank_buttons = None self._device_navigation = None self._shift_button.name = 'Shift_Button' self._master_slider.name = 'Master_Volume_Control' self._next_nav_button.name = 'Next_Track_Button' self._prev_nav_button.name = 'Prev_Track_Button' self._master_slider.add_value_listener((self._slider_value), identify_sender=True) self._shift_button.add_value_listener(self._shift_value) self._setup_mixer() self._setup_transport_and_session() self._setup_device() self._setup_display() for component in self.components: component.set_enabled(False)
def disconnect(self): self._name_display_data_source.set_display_string(' ') for encoder in self._encoders: encoder.remove_value_listener(self._encoder_value) self._master_slider.remove_value_listener(self._slider_value) if self._has_sliders: for slider in tuple(self._sliders): slider.remove_value_listener(self._slider_value) for button in self._strip_buttons: button.remove_value_listener(self._mixer_button_value) self._preview_button.remove_value_listener(self._preview_value) ControlSurface.disconnect(self) self._encoders = None self._sliders = None self._strip_buttons = None self._master_slider = None self._current_midi_map = None self._shift_button = None self._name_display = None self._prev_bank_button = None self._next_bank_button = None self._encoder_modes = None self._transport_view_modes = None self._send_midi(SYSEX_START + (6, 0, 0, 0, 247))
def refresh_state(self): ControlSurface.refresh_state(self) self.schedule_message(5, self._send_midi, SYSEX_START + ENGAGE_HYPERCONTROL) for component in self.components: if isinstance(component, ModeSelectorComponent): component.set_mode(0)
def disconnect(self): self._display_data_source.set_display_string(' ') self._shift_button.remove_value_listener(self._shift_value) self._inst_button.remove_value_listener(self._inst_value) for encoder in self._encoders: encoder.remove_value_listener(self._encoder_value) for slider in tuple(self._sliders) + (self._master_slider, ): slider.remove_value_listener(self._slider_value) for button in tuple( self._strip_buttons) + (self._selected_mute_solo_button, ): button.remove_value_listener(self._mixer_button_value) for button in self._device_bank_buttons: button.remove_value_listener(self._device_bank_value) self._encoders = None self._sliders = None self._strip_buttons = None self._master_slider = None self._current_midi_map = None self._selected_mute_solo_button = None self._inst_button = None self._shift_button = None self._device_navigation = None self._display = None ControlSurface.disconnect(self) self._send_midi(SYSEX_START + (32, 0, 247))
def __init__(self, c_instance, control_factory=LaunchkeyControlFactory(), identity_response=SIZE_RESPONSE): ControlSurface.__init__(self, c_instance) self._control_factory = control_factory self._identity_response = identity_response with self.component_guard(): self.set_pad_translations(PAD_TRANSLATIONS) self._suggested_input_port = 'Launchkey InControl' self._suggested_output_port = 'Launchkey InControl' self._has_sliders = True self._current_midi_map = None self._master_slider = make_slider(7, 'Master_Volume_Control') self._modes_buttons = [] for index in range(3): button = ButtonElement(IS_MOMENTARY, MIDI_NOTE_TYPE, 0, 13 + index) self._modes_buttons.append(button) self._modes_buttons[(-1)].add_value_listener( self._dummy_listener) self._setup_mixer() self._setup_session() self._setup_transport() self._setup_device() self._setup_navigation() for component in self.components: component.set_enabled(False)
def __init__(self, c_instance): ControlSurface.__init__(self, c_instance) with self.component_guard(): self._setup_session_control() self._setup_mixer_control() self._setup_device_control() self._setup_transport_control() self._setup_view_control()
def disconnect(self): ControlSurface.disconnect(self) self._send_midi(SYSEX_START + (32, 0, 247)) self._send_midi(SYSEX_START + (16, 247)) self._send_midi(SYSEX_START + (17, 3, 0, 4, 65, 98, 108, 101, 116, 111, 110, 32, 76, 105, 118, 101, 32, 67, 111, 110, 116, 114, 111, 108, 32, 0, 1, 4, 83, 117, 114, 102, 97, 99, 101, 32, 67, 108, 111, 115, 101, 100, 46, 247))
def update_display(self): ControlSurface.update_display(self) if self._string_to_display != None: self._name_display_data_source.set_display_string( self._string_to_display) self._string_to_display = None if self._display_reset_delay >= 0: self._display_reset_delay -= 1 if self._display_reset_delay == -1: self._show_current_track_name()
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._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_selection_follows_track_selection=True) 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)
def _on_selected_track_changed(self): ControlSurface._on_selected_track_changed(self) self._show_current_track_name() if not self._has_sliders: all_tracks = self._session.tracks_to_use() selected_track = self.song().view.selected_track num_strips = self._session.width() if selected_track in all_tracks: track_index = list(all_tracks).index(selected_track) new_offset = track_index - track_index % num_strips self._session.set_offsets(new_offset, self._session.scene_offset())
def __init__(self, c_instance): ControlSurface.__init__(self, c_instance) with self.component_guard(): self._suppress_session_highlight = True self._suggested_input_port = 'Open Labs Midi Driver' self._suggested_output_port = '' self.set_pad_translations( ((0, 0, 12, 15), (1, 0, 13, 15), (2, 0, 14, 15), (3, 0, 15, 15), (0, 1, 8, 15), (1, 1, 9, 15), (2, 1, 10, 15), (3, 1, 11, 15), (0, 2, 4, 15), (1, 2, 5, 15), (2, 2, 6, 15), (3, 2, 7, 15), (0, 3, 0, 15), (1, 3, 1, 15), (2, 3, 2, 15), (3, 3, 3, 15))) self._setup_mixer_control() self._setup_device_and_transport_control()
def disconnect(self): ControlSurface.disconnect(self) for button in self._modes_buttons: if button.value_has_listener(self._dummy_listener): button.remove_value_listener(self._dummy_listener) self._modes_buttons = None self._encoders = None self._sliders = None self._strip_buttons = None self._master_slider = None self._current_midi_map = None self._transport_view_modes = None self._send_midi(LED_FLASHING_OFF) self._send_midi(LIVE_MODE_OFF)
def __init__(self, c_instance, macro_map_mode, volume_map_mode, device_controls, transport_controls, volume_controls, trackarm_controls, bank_controls, descriptions=None, mixer_options=None, device_component_class=DeviceComponent): ControlSurface.__init__(self, c_instance) with self.component_guard(): global_channel = 0 if descriptions: if 'INPUTPORT' in descriptions: self._suggested_input_port = descriptions['INPUTPORT'] if 'OUTPUTPORT' in descriptions: self._suggested_output_port = descriptions['OUTPUTPORT'] if 'CHANNEL' in descriptions: if is_valid_midi_channel(descriptions['CHANNEL']): global_channel = descriptions['CHANNEL'] if 'PAD_TRANSLATION' in descriptions: self.set_pad_translations(descriptions['PAD_TRANSLATION']) self._init_mixer_component(volume_controls, trackarm_controls, mixer_options, global_channel, volume_map_mode) self._init_device_component(device_controls, bank_controls, global_channel, macro_map_mode, device_component_class) self._init_transport_component(transport_controls, global_channel)
def __init__(self, c_instance): ControlSurface.__init__(self, c_instance) with self.component_guard(): self.set_pad_translations(PAD_TRANSLATIONS) self._suggested_input_port = 'Impulse' self._suggested_output_port = 'Impulse' self._has_sliders = True self._current_midi_map = None self._display_reset_delay = -1 self._shift_button = ButtonElement(IS_MOMENTARY, MIDI_CC_TYPE, 0, 39) self._preview_button = ButtonElement(IS_MOMENTARY, MIDI_CC_TYPE, 0, 41) self._master_slider = SliderElement(MIDI_CC_TYPE, 0, 8) self._shift_button.name = 'Shift_Button' self._master_slider.name = 'Master_Volume_Control' self._master_slider.add_value_listener((self._slider_value), identify_sender=True) self._preview_button.add_value_listener(self._preview_value) self._setup_mixer() self._setup_session() self._setup_transport() self._setup_device() self._setup_name_display() device_button = ButtonElement(not IS_MOMENTARY, MIDI_CC_TYPE, 1, 10) mixer_button = ButtonElement(not IS_MOMENTARY, MIDI_CC_TYPE, 1, 9) device_button.name = 'Encoder_Device_Mode' mixer_button.name = 'Encoder_Mixer_Mode' self._encoder_modes = EncoderModeSelector(self._device_component, self._mixer, self._next_bank_button, self._prev_bank_button, self._encoders) self._encoder_modes.set_device_mixer_buttons( device_button, mixer_button) self._string_to_display = None for component in self.components: component.set_enabled(False)
def __init__(self, c_instance): ControlSurface.__init__(self, c_instance) with self.component_guard(): self._suggested_input_port = 'HyperControl' self._suggested_output_port = 'HyperControl' self.set_pad_translations(PAD_TRANSLATIONS) stop_button = make_button(116) play_button = make_button(117) record_button = make_button(118) select_button = make_button(98) nav_left_button = make_button(99) nav_right_button = make_button(100) nav_up_button = make_button(101) nav_down_button = make_button(102) mixer_modes_toggle = make_button(58) mixer_or_device_toggle = make_button(59) hypercontrol_mode_toggle = make_button(60) encoders = tuple([make_encoder(33 + index) for index in range(8)]) transport = TransportComponent() transport.set_stop_button(stop_button) transport.set_play_button(play_button) transport.set_record_button(record_button) session = SessionComponent(8, 0) device = BestBankDeviceComponent( device_selection_follows_track_selection=True) self.set_device_component(device) device_nav = DeviceNavComponent() mixer = SpecialMixerComponent(NUM_TRACKS) session.set_mixer(mixer) mixer_encoder_modes = EncoderMixerModeSelector(mixer) mixer_encoder_modes.set_mode_toggle(mixer_modes_toggle) mixer_or_device = MixerOrDeviceModeSelector( encoders, select_button, nav_up_button, nav_down_button, nav_left_button, nav_right_button, mixer, session, device, mixer_encoder_modes, device_nav) mixer_or_device.set_mode_buttons( (mixer_modes_toggle, mixer_or_device_toggle, hypercontrol_mode_toggle))
def __init__(self, c_instance): ControlSurface.__init__(self, c_instance) self._alt_device_component = None with self.component_guard(): self.set_pad_translations(PAD_TRANSLATIONS) self._suggested_input_port = 'HyperControl' self._suggested_output_port = 'HyperControl' self._single_fader_button_modes = None self._has_faders = True self._display_reset_delay = -1 self._hc_byte = HC_BYTE self._waiting_for_first_response = True self._setup_controls() self._setup_displays() self._setup_mixer() self._setup_session() self._setup_transport() self._setup_device() self._setup_modes() self._drum_group_midi_button = None self._drum_group_hyper_button = None for component in self.components: component.set_enabled(False)
def build_midi_map(self, midi_map_handle): self._current_midi_map = midi_map_handle ControlSurface.build_midi_map(self, midi_map_handle)
def _on_selected_track_changed(self): ControlSurface._on_selected_track_changed(self) self._show_current_track_name()
def refresh_state(self): ControlSurface.refresh_state(self) self.schedule_message(2, self._send_midi, LIVE_MODE_ON) self.schedule_message(3, self._send_midi, SIZE_QUERY)
def disconnect(self): ControlSurface.disconnect(self) self._send_midi(SYSEX_START + DISABLE_HYPERCONTROL)
def set_appointed_device(self, device): ControlSurface.set_appointed_device(self, device) with self.component_guard(): if self._alt_device_component != None: self._alt_device_component.set_device(device)
def disconnect(self): self._scheduled_messages = [] for encoder in self._encoders: encoder.remove_value_listener(self._encoder_value) for fader in self._faders: fader.remove_value_listener(self._fader_value) for fader_button in self._fader_buttons: fader_button.remove_value_listener(self._fader_button_value) self._master_fader.remove_value_listener(self._fader_value) self._master_fader_button.remove_value_listener( self._fader_button_value) self._select_button.remove_value_listener(self._select_button_value) self._identify_button.remove_value_listener(self._identify_value) self._fader_group_midi_button.remove_value_listener( self._midi_button_value) self._fader_group_mix_button.remove_value_listener( self._hyper_button_value) self._fader_group_fx_button.remove_value_listener( self._hyper_button_value) self._encoder_group_midi_button.remove_value_listener( self._midi_button_value) self._encoder_group_mix_button.remove_value_listener( self._hyper_button_value) self._encoder_group_fx_button.remove_value_listener( self._hyper_button_value) if self._drum_group_midi_button != None: self._drum_group_midi_button.remove_value_listener( self._midi_button_value) if self._drum_group_hyper_button != None: self._drum_group_hyper_button.remove_value_listener( self._hyper_button_value) self._alt_device_component = None self._name_display = None self._value_display = None self._bank_display = None self._pad_display = None self._name_display_data_source = None self._value_display_data_source = None self._bank_display_data_source = None self._pad_display_data_source = None self._select_button = None self._left_button = None self._right_button = None self._up_button = None self._down_button = None self._loop_button = None self._ffwd_button = None self._rwd_button = None self._play_button = None self._stop_button = None self._rec_button = None self._master_fader_button = None self._fader_buttons = None self._faders = None self._encoders = None self._drum_pads = None self._identify_button = None self._main_group_hyper_button = None self._main_group_track_button = None self._main_group_fx_button = None self._encoder_group_midi_button = None self._encoder_group_mix_button = None self._encoder_group_fx_button = None self._fader_group_mode_button = None self._fader_group_midi_button = None self._fader_group_mix_button = None self._fader_group_fx_button = None self._drum_group_midi_button = None self._drum_group_roll_button = None self._drum_group_hyper_button = None self._mixer_for_encoders = None self._mixer_for_faders = None self._device_for_encoders = None self._device_for_faders = None self._transport = None self._session = None ControlSurface.disconnect(self) self._send_midi(SYSEX_START + DISABLE_HYPERCONTROL)
def disconnect(self): self._shift_button.remove_value_listener(self._shift_value) self._shift_button = None ControlSurface.disconnect(self)
def refresh_state(self): ControlSurface.refresh_state(self) self._waiting_for_first_response = True self.schedule_message(3, self._send_midi, SYSEX_START + (32, 46, 247))
def update_display(self): ControlSurface.update_display(self) if self._display_reset_delay >= 0: self._display_reset_delay -= 1 if self._display_reset_delay == -1: self._show_current_track_name()
def refresh_state(self): ControlSurface.refresh_state(self) self.schedule_message(3, self._send_midi, SYSEX_START + (6, 1, 1, 1, 247))
def restore_bank(self, bank_index): ControlSurface.restore_bank(self, bank_index) if self._alt_device_component != None: self._alt_device_component.restore_bank(bank_index)
def _on_selected_track_changed(self): ControlSurface._on_selected_track_changed(self) self._update_mixer_offset()
def refresh_state(self): self._bmatrix.prepare_update() ControlSurface.refresh_state(self) self.update_hardware() self._bmatrix.commit_update()
def refresh_state(self): ControlSurface.refresh_state(self) self.schedule_message(5, self._send_midi, IDENTITY_REQUEST)