def __init__(self, *a, **k): super(ATOM, self).__init__(*a, **k) with self.component_guard(): with inject(skin=const(skin)).everywhere(): self._elements = Elements() with self.component_guard(): with inject(element_container=const(self._elements)).everywhere(): self._create_lighting() self._create_transport() self._create_record_modes() self._create_undo() self._create_view_toggle() self._create_background() self._create_session() self._create_mixer() self._create_encoder_modes() self._create_session_navigation_modes() self._create_keyboard() self._create_drum_group() self._create_note_modes() self._create_pad_modes() self._create_user_assignments_mode() self._target_track = ArmedTargetTrackComponent( name=u'Target_Track') self.__on_target_track_changed.subject = self._target_track self._drum_group_finder = self.register_disconnectable( PercussionInstrumentFinder( device_parent=self._target_track.target_track)) self.__on_drum_group_changed.subject = self._drum_group_finder self.__on_drum_group_changed() self.__on_main_view_changed.subject = self.application.view
def __init__(self, c_instance): ControlSurface.__init__(self, c_instance) self._main_modes = NullModes() self._element_injector = inject( element_container=const(None)).everywhere() self._message_injector = inject(message=const(None)).everywhere() with self.component_guard(): with inject(skin=const(skin), message_cache=const( self._sysex_message_cache)).everywhere(): self._elements = Elements() self._element_injector = inject( element_container=const(self._elements)).everywhere() with self.component_guard(): self._create_message() self._message_injector = inject( message=const(self._message)).everywhere() self._switch_display_layout(sysex.KNOB_SCREEN_LAYOUT_BYTE) self._device_bank_registry = DeviceBankRegistry() with self.component_guard(): self._create_session() self._create_mixer() self._create_session_recording() self._create_auto_arm() self._create_track_navigation() self._create_device() self._create_device_navigation() self._create_background() self._create_modes() return
def __init__(self, *a, **k): super(ComradeEncoders, self).__init__((), *a, **k) self._main_modes = NullModes() self._element_injector = inject(element_container=const(None)).everywhere() self._message_injector = inject(message=const(None)).everywhere() with self.component_guard(): with inject(skin=const(skin), message_cache=const(self._sysex_message_cache)).everywhere(): self._elements = Elements() self._element_injector = inject(element_container=const(self._elements)).everywhere() with self.component_guard(): self._create_message() self._message_injector = inject(message=const(self._message)).everywhere() self._switch_display_layout(sysex.KNOB_SCREEN_LAYOUT_BYTE) self._device_bank_registry = DeviceBankRegistry() with self.component_guard(): self._create_transport() self._create_auto_arm() self._create_drums() self._create_device() self._create_device_navigation() self._create_actions() self._create_clip_actions() self._create_background() self._create_modes() self._drum_group_finder = self.register_disconnectable(PercussionInstrumentFinder(device_parent=self.song.view.selected_track)) self.__on_drum_group_found.subject = self._drum_group_finder self.__on_drum_group_found() self.__on_selected_track_changed.subject = self.song.view self.__on_selected_track_changed() self.__on_record_mode_changed.subject = self.song self.set_feedback_channels([DRUM_FEEDBACK_CHANNEL]) self._set_feedback_velocity()
def _create_elements(self): with self.component_guard(): skin = Skin(ForceColors if self.is_force else MPCColors) with inject(skin=const(skin)).everywhere(): elements_class = None if self.is_force: elements_class = ForceElements elif self._product_id == MPC_X_PRODUCT_ID: elements_class = MPCXElements elif self._product_id == MPC_LIVE_PRODUCT_ID: elements_class = MPCLiveElements self._elements = elements_class(self._product_id) self._element_injector = inject(element_container=const(self._elements)).everywhere()
def __init__(self, *a, **k): (super(SLMkIII, self).__init__)( a, product_id_bytes=sysex.NOVATION_MANUFACTURER_ID + sysex.DEVICE_FAMILY_CODE + sysex.DEVICE_FAMILY_MEMBER_CODE, **k) self._main_modes = NullModes() self._element_injector = inject( element_container=(const(None))).everywhere() self._message_injector = inject(message=(const(None))).everywhere() with self.component_guard(): with inject(skin=(const(skin)), message_cache=(const( self._sysex_message_cache))).everywhere(): self._elements = Elements() self._element_injector = inject( element_container=(const(self._elements))).everywhere() with self.component_guard(): self._create_message() self._message_injector = inject( message=(const(self._message))).everywhere() self._switch_display_layout(sysex.KNOB_SCREEN_LAYOUT_BYTE) self._device_bank_registry = DeviceBankRegistry() with self.component_guard(): self._create_session() self._create_mixer() self._create_transport() self._create_session_recording() self._create_auto_arm() self._create_track_navigation() self._create_drums() self._create_device() self._create_device_navigation() self._create_actions() self._create_clip_actions() self._create_background() self._create_modes() self._drum_group_finder = self.register_disconnectable( PercussionInstrumentFinder( device_parent=(self.song.view.selected_track))) self._SLMkIII__on_drum_group_found.subject = self._drum_group_finder self._SLMkIII__on_drum_group_found() self._SLMkIII__on_selected_track_changed.subject = self.song.view self._SLMkIII__on_selected_track_changed() self._SLMkIII__on_session_record_changed.subject = self.song self._SLMkIII__on_record_mode_changed.subject = self.song self.set_feedback_channels([DRUM_FEEDBACK_CHANNEL]) self._set_feedback_velocity()
def __init__(self, device_bank_registry=None, banking_info=None, info_layer=None, delete_handler=None, session_ring=None, *a, **k): super(DeviceNavigationComponent, self).__init__(*a, **k) self._make_navigation_node = partial( make_navigation_node, session_ring=session_ring, device_bank_registry=device_bank_registry, banking_info=banking_info) self._delete_handler = delete_handler self._updating_children = BooleanContext() self._device_list = self.register_component( ScrollableListWithTogglesComponent()) self._on_selection_clicked_in_controller.subject = self._device_list self._on_selection_changed_in_controller.subject = self._device_list self._on_state_changed_in_controller.subject = self._device_list self._current_node = None self._message_box = self.register_component( MessageBoxComponent(layer=info_layer, is_enabled=False)) self._message_box.text = consts.MessageBoxText.EMPTY_DEVICE_CHAIN self._selected_track = None self._on_selected_track_changed.subject = self.song.view with inject(selection=const(NamedTuple( selected_device=None))).everywhere(): self._on_selected_track_changed() self._on_device_parameters_changed.subject = self._selected_track.view.selected_device return
def _create_components(self): self._fixed_length_setting = FixedLengthSetting() self._fixed_length_recording = FixedLengthRecording( self.song, self._fixed_length_setting) with inject(fixed_length_recording=const( self._fixed_length_recording)).everywhere(): super(Launchpad_Pro_MK3, self)._create_components() self._create_recording_modes() self._create_session_overview() self._create_auto_arm() self._create_background() self._create_device_navigation() self._create_device_parameters() self._create_print_to_clip() self._create_undo_redo() self._create_transport() self._create_clip_actions() self._create_quantization() self._create_fixed_length() self._create_drum_group() self._create_scale_pad_translator() self._create_mixer_modes() self._create_session_modes() self._create_note_modes() self._create_main_modes() self.__on_layout_switch_value.subject = self._elements.layout_switch
def __init__(self, *a, **k): super(Akai_Force_MPC, self).__init__(*a, **k) self._product_id = None self._element_injector = inject( element_container=const(None)).everywhere() self._is_initialized = False self._initialize_task = self._tasks.add(task.run(self._initialize)) self._initialize_task.kill() self._components_enabled = False with self.component_guard(): self._ping_element = SysexElement( send_message_generator=const(SYSEX_MSG_HEADER + (BROADCAST_ID, PING_MSG_TYPE, SYSEX_END_BYTE)), name=b'Ping_Element') self._pong_element = MultiElement( name=b'Pong_Multi_Element', *[ IdentifyingSysexElement( sysex_identifier=SYSEX_MSG_HEADER + (identifier, PONG_MSG_TYPE), name=(b'Pong_Element_{}').format(index)) for index, identifier in enumerate(SUPPORTED_PRODUCT_IDS) ]) self._ping_pong = PingPongComponent( on_pong_callback=self._identify, on_ping_timeout=partial(self._enable_components, False), name=b'Ping_Pong') self._ping_pong.layer = Layer(ping=self._ping_element, pong=self._pong_element) return
def __init__(self, *a, **k): super(Code, self).__init__(*a, **k) with self.component_guard(): with inject(skin=const(make_default_skin())).everywhere(): self._create_controls() self._create_transport() self._create_mixer() self._create_mixer_navigation()
def __init__(self, *a, **k): (super(NovationBase, self).__init__)( a, product_id_bytes=sysex.NOVATION_MANUFACTURER_ID + self.model_family_code + sysex.DEVICE_FAMILY_MEMBER_CODE, **k) self._element_injector = inject( element_container=(const(None))).everywhere() with self.component_guard(): with inject(skin=(const(self.skin))).everywhere(): self._elements = self.element_class() self._element_injector = inject( element_container=(const(self._elements))).everywhere() if self.suppress_layout_switch: self.register_slot(self._elements.layout_switch, nop, 'value') with self.component_guard(): self._create_components()
def apply_properties(self, new_object, song): decorated = None with inject(song=(const(song))).everywhere(): decorated = self._factory.decorate(new_object, additional_properties=(self._copied_additional_properties), song=song) self._apply_nested_properties(decorated) return decorated
def _setup_mod(self): def get_monomodular(host): if isinstance(__builtins__, dict): if not 'monomodular' in list( __builtins__.keys()) or not isinstance( __builtins__['monomodular'], ModRouter): __builtins__['monomodular'] = ModRouter( song=self.song, register_component=self._register_component) else: if not hasattr(__builtins__, 'monomodular') or not isinstance( __builtins__['monomodular'], ModRouter): setattr( __builtins__, 'monomodular', ModRouter(song=self.song, register_component=self._register_component)) monomodular = __builtins__['monomodular'] if not monomodular.has_host(): monomodular.set_host(host) return monomodular self.monomodular = get_monomodular(self) self.monomodular.name = 'monomodular_switcher' with inject(register_component=const(self._register_component), song=const(self.song)).everywhere(): self.modhandler = MonoBlocksModHandler( self ) ## song = self.song, register_component = self._register_component) self.modhandler.name = 'ModHandler' self.modhandler.layer = Layer(priority=6, grid=self._matrix) self.modhandler.alt_shift_layer = AddLayerMode(self.modhandler, Layer()) # Shift_button = self.elements.shift_button, # Alt_button = self.elements.select_button)) self.modhandler.legacy_shift_layer = AddLayerMode( self.modhandler, Layer( priority=7, device_selector_matrix=self._matrix.submatrix[:, :1], channel_buttons=self._matrix.submatrix[:, 1:2], nav_matrix=self._matrix.submatrix[4:8, 2:6], )) self.modhandler.shift_layer = AddLayerMode( self.modhandler, Layer( priority=7, device_selector_matrix=self._matrix.submatrix[:, :1], )) #lock_button = self.elements.master_select_button, #)) self.modhandler.alt_layer = AddLayerMode(self.modhandler, Layer(priority=7, )) #key_buttons = self.elements.select_buttons)) #key_buttons = self.elements.track_state_buttons)) self._modHandle = ModControl(modscript=self, monomodular=self.monomodular, name='ModHandle') self._device_provider.restart_mod()
def __init__(self, *a, **k): super(PushBase, self).__init__(*a, **k) self.register_slot(self.song.view, self._on_selected_track_changed, 'selected_track') self._device_decorator_factory = self._create_device_decorator_factory() self.register_disconnectable(self._device_decorator_factory) self._double_press_context = DoublePressContext() injecting = self._create_injector() self._push_injector = injecting.everywhere() self._element_injector = inject(element_container=const(None)).everywhere() with self.component_guard(): self._suppress_sysex = False self._skin = self._create_skin() self._clip_creator = ClipCreator() self._note_editor_settings = [] self._notification = None self._user = None with inject(skin=const(self._skin)).everywhere(): self._create_controls() self._element_injector = inject(element_container=const(self.elements)).everywhere()
def __init__(self, clip_slot_copy_handler = None, fixed_length_recording = None, *a, **k): self._clip_copy_handler = clip_slot_copy_handler or ClipSlotCopyHandler() self._fixed_length_recording = fixed_length_recording with inject(copy_handler=const(self._clip_copy_handler), fixed_length_recording=const(self._fixed_length_recording)).everywhere(): super(SpecialSessionComponent, self).__init__(*a, **k) self._slot_launch_button = None self._duplicate_button = None self._duplicate = DuplicateSceneComponent(self._session_ring, parent=self) self._duplicate_enabler = EnablingModesComponent(parent=self, component=self._duplicate) self._end_initialisation()
def __init__(self, *a, **k): (super(FA, self).__init__)(*a, **k) with self.component_guard(): with inject(skin=(const(make_default_skin()))).everywhere(): self._create_controls() self._create_transport() self._create_session_recording() self._create_mixer() self._create_navigation() self._create_modes() self._create_drums()
def __init__(self, *a, **k): super(Oxygen_Pro, self).__init__(*a, **k) with self.component_guard(): self._elements = Elements() with inject(element_container=const(self._elements)).everywhere(): self._create_transport() self._create_undo_redo() self._create_device_parameters() self._create_session() self._create_mixer() self._create_record_modes() self.__on_main_view_changed.subject = self.application.view
def __init__(self, device_bank_registry = None, banking_info = None, info_layer = None, delete_handler = None, session_ring = None, *a, **k): super(DeviceNavigationComponent, self).__init__(*a, **k) self._make_navigation_node = partial(make_navigation_node, session_ring=session_ring, device_bank_registry=device_bank_registry, banking_info=banking_info) self._delete_handler = delete_handler self._device_list = self.register_component(ScrollableListWithTogglesComponent()) self._on_selection_clicked_in_controller.subject = self._device_list self._on_selection_changed_in_controller.subject = self._device_list self._on_state_changed_in_controller.subject = self._device_list self._current_node = None self._message_box = self.register_component(MessageBoxComponent(layer=info_layer, is_enabled=False)) self._message_box.text = consts.MessageBoxText.EMPTY_DEVICE_CHAIN self._selected_track = None self._on_selected_track_changed.subject = self.song.view with inject(selection=const(NamedTuple(selected_device=None))).everywhere(): self._on_selected_track_changed()
def _setup_mod(self): def get_monomodular(host): if isinstance(__builtins__, dict): if not 'monomodular' in list(__builtins__.keys()) or not isinstance(__builtins__['monomodular'], ModRouter): __builtins__['monomodular'] = ModRouter(song = self.song, register_component = self._register_component) else: if not hasattr(__builtins__, 'monomodular') or not isinstance(__builtins__['monomodular'], ModRouter): setattr(__builtins__, 'monomodular', ModRouter(song = self.song, register_component = self._register_component)) monomodular = __builtins__['monomodular'] if not monomodular.has_host(): monomodular.set_host(host) return monomodular self.monomodular = get_monomodular(self) self.monomodular.name = 'monomodular_switcher' with inject(register_component = const(self._register_component), song = const(self.song)).everywhere(): self.modhandler = PushModHandler(self) ## song = self.song, register_component = self._register_component) self.modhandler.name = 'ModHandler' self.modhandler.layer = Layer( priority = 6, lock_button = self.elements.note_mode_button, grid = self.elements.matrix, nav_up_button = self.elements.octave_up_button, nav_down_button = self.elements.octave_down_button, nav_left_button = self.elements.in_button, nav_right_button = self.elements.out_button, key_buttons = self.elements.side_buttons, ) self.modhandler.alt_shift_layer = AddLayerMode( self.modhandler, Layer(Shift_button = self.elements.shift_button, Alt_button = self.elements.select_button)) self.modhandler.legacy_shift_layer = AddLayerMode( self.modhandler, Layer(priority = 7, device_selector_matrix = self.elements.matrix.submatrix[:, :1], channel_buttons = self.elements.matrix.submatrix[:, 1:2], nav_matrix = self.elements.matrix.submatrix[4:8, 2:6], )) self.modhandler.shift_layer = AddLayerMode( self.modhandler, Layer( priority = 7, device_selector_matrix = self.elements.matrix.submatrix[:, :1], )) #lock_button = self.elements.master_select_button, #)) self.modhandler.alt_layer = AddLayerMode( self.modhandler, Layer( priority = 7, )) #key_buttons = self.elements.select_buttons)) #key_buttons = self.elements.track_state_buttons)) self._device_provider.restart_mod() # self._modHandle = ModControl(monomodular = self.monomodular, is_momentary = True, msg_type = MIDI_NOTE_TYPE, channel = 15, identifier = 0, name = 'ModHandle') self._modHandle = ModControl(modscript = self, monomodular = self.monomodular, name = 'ModHandle')
def _setup_mod(self): def get_monomodular(host): if isinstance(__builtins__, dict): if not 'monomodular' in __builtins__.keys() or not isinstance(__builtins__['monomodular'], ModRouter): __builtins__['monomodular'] = ModRouter(song = self.song, register_component = self._register_component) else: if not hasattr(__builtins__, 'monomodular') or not isinstance(__builtins__['monomodular'], ModRouter): setattr(__builtins__, 'monomodular', ModRouter(song = self.song, register_component = self._register_component)) monomodular = __builtins__['monomodular'] if not monomodular.has_host(): monomodular.set_host(host) return monomodular self.monomodular = get_monomodular(self) self.monomodular.name = 'monomodular_switcher' with inject(register_component = const(self._register_component), song = const(self.song)).everywhere(): self.modhandler = PushModHandler(self) ## song = self.song, register_component = self._register_component) #debug('mod task group:', self.modhandler.parent_task_group) self.modhandler.name = 'ModHandler' self.modhandler.layer = Layer( priority = 6, lock_button = self.elements.note_mode_button, grid = self.elements.matrix, shift_button = self.elements.shift_button, alt_button = self.elements.select_button, nav_up_button = self.elements.octave_up_button, nav_down_button = self.elements.octave_down_button, nav_left_button = self.elements.in_button, nav_right_button = self.elements.out_button, key_buttons = self.elements.side_buttons, ) #self.modhandler.layer.priority = 0 self.modhandler.legacy_shift_layer = AddLayerMode( self.modhandler, Layer(priority = 7, device_selector_matrix = self.elements.matrix.submatrix[:, :1], channel_buttons = self.elements.matrix.submatrix[:, 1:2], nav_matrix = self.elements.matrix.submatrix[4:8, 2:6], )) self.modhandler.shift_layer = AddLayerMode( self.modhandler, Layer( priority = 7, device_selector_matrix = self.elements.matrix.submatrix[:, :1], )) #lock_button = self.elements.master_select_button, #)) self.modhandler.alt_layer = AddLayerMode( self.modhandler, Layer( priority = 7, )) #key_buttons = self.elements.select_buttons)) #key_buttons = self.elements.track_state_buttons)) self._device_provider.restart_mod()
def __init__(self, *a, **k): (super(Oxygen_Pro, self).__init__)(a, product_id_bytes=midi.M_AUDIO_MANUFACTURER_ID + (0, ), **k) self._last_selected_knob_mode = 'device' with self.component_guard(): self._elements = Elements(self.session_height, self.session_width, self.pad_ids) with inject(element_container=(const(self._elements))).everywhere(): self._create_background() self._create_transport() self._create_undo_redo() self._create_session() self._create_mixer() self._create_device_parameters() self._create_record_modes() self._create_button_modes() self._create_knob_modes() self._create_takeover_modes() self._Oxygen_Pro__on_main_view_changed.subject = self.application.view
def __init__(self, *a, **k): super(KeyLabEssential, self).__init__(*a, **k) with self.component_guard(): with inject(skin=const(default_skin)).everywhere(): self._create_controls() self._create_hardware_settings() self._on_focused_view_changed.subject = self.application.view self._hardware_settings.set_hardware_live_mode_enabled(True) self._on_memory_preset_changed_on_hardware.subject = self._hardware_settings self._hardware_settings.select_memory_preset(sysex.DAW_MEMORY_PRESET_INDEX) with self.component_guard(): self._create_transport() self._create_undo() self._create_session() self._create_navigation() self._create_mixer() self._create_view_control() self._create_arrangement() self._create_jogwheel_modes()
def _setup_mod(self): self.monomodular = get_monomodular(self) self.monomodular.name = 'monomodular_switcher' with inject(register_component=const(self._register_component), song=const(self.song)).everywhere(): self.modhandler = PushModHandler( self ) ## song = self.song, register_component = self._register_component) self.modhandler.name = 'ModHandler' self.modhandler.layer = Layer( priority=10, lock_button=self.elements.note_mode_button, grid=self.elements.matrix, key_buttons=self.elements.select_buttons, key2_buttons=self.elements.track_state_buttons, Shift_button=self.elements.shift_button, Alt_button=self.elements.select_button, detent_dial=self.elements.tempo_control, master_dial=self.elements.master_volume_control, name_display_line=self.elements.display_line3, value_display_line=self.elements.display_line4) self.modhandler.legacy_shift_layer = AddLayerMode( self.modhandler, Layer(priority=6, nav_up_button=self.elements.nav_up_button, nav_down_button=self.elements.nav_down_button, nav_left_button=self.elements.nav_left_button, nav_right_button=self.elements.nav_right_button, channel_buttons=self.elements.matrix.submatrix[:, 1:2], nav_matrix=self.elements.matrix.submatrix[4:8, 2:6])) self.modhandler.shift_layer = AddLayerMode( self.modhandler, Layer( priority=6, lock_button=self.elements.master_select_button, )) #device_selector_matrix = self.elements.matrix.submatrix[:, :1], self.modhandler.alt_layer = AddLayerMode( self.modhandler, Layer(priority=6, alt_name_display_line=self.elements.display_line3, alt_value_display_line=self.elements.display_line4))
def __init__(self, *a, **k): super(ATOMSQ, self).__init__(*a, **k) with self.component_guard(): self._elements = Elements() with inject(element_container=const(self._elements)).everywhere(): self._create_background() self._create_transport() self._create_undo() self._create_view_toggle() self._create_device_parameters() self._create_translating_background() self._create_device_navigation() self._create_launch_and_stop() self._create_session() self._create_mixer() self._create_view_control() self._create_button_labels() self._create_record_modes() self._create_lower_pad_modes() self._create_main_modes() self.__on_main_view_changed.subject = self.application.view
def _setup_mod(self): self.monomodular = get_monomodular(self) self.monomodular.name = 'monomodular_switcher' with inject(register_component = const(self._register_component), song = const(self.song)).everywhere(): self.modhandler = PushModHandler(self) ## song = self.song, register_component = self._register_component) self.modhandler.name = 'ModHandler' self.modhandler.layer = Layer( priority = 6, lock_button = self.elements.note_mode_button, grid = self.elements.matrix, shift_button = self.elements.shift_button, alt_button = self.elements.select_button, key_buttons = self.elements.side_buttons) self.modhandler.legacy_shift_layer = AddLayerMode( self.modhandler, Layer(priority = 6, nav_up_button = self.elements.nav_up_button, nav_down_button = self.elements.nav_down_button, nav_left_button = self.elements.nav_left_button, nav_right_button = self.elements.nav_right_button, channel_buttons = self.elements.matrix.submatrix[:, 1:2], nav_matrix = self.elements.matrix.submatrix[4:8, 2:6] )) self.modhandler.shift_layer = AddLayerMode( self.modhandler, Layer( priority = 6, device_selector_matrix = self.elements.matrix.submatrix[:, :1], lock_button = self.elements.master_select_button, name_display_line = self.elements.display_line3, value_display_line = self.elements.display_line4 )) self.modhandler.alt_layer = AddLayerMode( self.modhandler, Layer( priority = 6, alt_name_display_line = self.elements.display_line3, alt_value_display_line = self.elements.display_line4 ))
def _create_injector(self): return inject(double_press_context=const(self._double_press_context), expect_dialog=const(self.expect_dialog), show_notification=const(self.show_notification), selection=lambda : PushSelection(application=self.application(), device_component=self._device_component, navigation_component=self._device_navigation))
def _component_guard(self): with super(Push2, self)._component_guard(): with inject(real_time_mapper=const(self._c_instance.real_time_mapper)).everywhere(): yield self._commit_real_time_data_changes() self._model.commit_changes()
def _create_injector(self): return inject(double_press_context=const(self._double_press_context), double_click_context=const(self._double_click_context), expect_dialog=const(self.expect_dialog), show_notification=const(self.show_notification), commit_model_changes=const(self._model.commit_changes), register_real_time_data=const(self.register_real_time_data), selection=lambda : PushSelection(application=self.application(), device_component=self._device_component, navigation_component=self._device_navigation))