本文整理汇总了Python中_Framework.ModesComponent.ModesComponent.update方法的典型用法代码示例。如果您正苦于以下问题:Python ModesComponent.update方法的具体用法?Python ModesComponent.update怎么用?Python ModesComponent.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类_Framework.ModesComponent.ModesComponent
的用法示例。
在下文中一共展示了ModesComponent.update方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Launchpad_Pro
# 需要导入模块: from _Framework.ModesComponent import ModesComponent [as 别名]
# 或者: from _Framework.ModesComponent.ModesComponent import update [as 别名]
#.........这里部分代码省略.........
self._create_session_mode()
self._create_note_modes()
self._create_device_mode()
self._create_user_mode()
self._create_record_arm_mode()
self._create_track_select_mode()
self._create_mute_mode()
self._create_solo_mode()
self._create_volume_mode()
self._create_pan_mode()
self._create_sends_mode()
self._create_stop_clips_mode()
self._modes.layer = Layer(session_mode_button=self._midimap['Session_Mode_Button'], note_mode_button=self._midimap['Note_Mode_Button'], device_mode_button=self._midimap['Device_Mode_Button'], user_mode_button=self._midimap['User_Mode_Button'], record_arm_mode_button=self._midimap['Record_Arm_Mode_Button'], track_select_mode_button=self._midimap['Track_Select_Mode_Button'], mute_mode_button=self._midimap['Mute_Mode_Button'], solo_mode_button=self._midimap['Solo_Mode_Button'], volume_mode_button=self._midimap['Volume_Mode_Button'], pan_mode_button=self._midimap['Pan_Mode_Button'], sends_mode_button=self._midimap['Sends_Mode_Button'], stop_clip_mode_button=self._midimap['Stop_Clip_Mode_Button'])
self._modes.selected_mode = 'session_mode'
self._on_layout_changed.subject = self._modes
def _create_session_zooming_modes(self):
session_zoom_layer = Layer(button_matrix=self._midimap['Main_Button_Matrix'], nav_left_button=self._midimap['Arrow_Left_Button'], nav_right_button=self._midimap['Arrow_Right_Button'], nav_up_button=self._midimap['Arrow_Up_Button'], nav_down_button=self._midimap['Arrow_Down_Button'])
session_zooming_layer_mode = LayerMode(self._session_zoom, session_zoom_layer)
self._session_zooming_manager = SessionZoomingManagerComponent(self._modes, is_enabled=False)
session_zooming_button_layer_mode = LayerMode(self._session_zooming_manager, Layer(session_zooming_button=self._midimap['Session_Mode_Button']))
self._prioritized_session_zooming_button_layer_mode = LayerMode(self._session_zooming_manager, Layer(session_zooming_button=self._midimap['Session_Mode_Button'], priority=1))
self._session_zooming_background = BackgroundComponent(name='Session_Zooming_Background')
session_zooming_background_layer_mode = LayerMode(self._session_zooming_background, Layer(scene_launch_buttons=self._midimap['Scene_Launch_Button_Matrix'], delete_button=self._midimap['Delete_Button'], quantize_button=self._midimap['Quantize_Button'], duplicate_button=self._midimap['Duplicate_Button'], double_loop_button=self._midimap['Double_Loop_Button']))
self._modes.add_mode('session_zooming_mode', [self._session_zooming_manager,
session_zooming_button_layer_mode,
session_zooming_layer_mode,
session_zooming_background_layer_mode])
self._modes.add_mode('prioritized_session_zooming_mode', [partial(self._layout_switch, consts.SESSION_LAYOUT_SYSEX_BYTE),
self._session_zooming_manager,
self._prioritized_session_zooming_button_layer_mode,
session_zooming_layer_mode,
session_zooming_background_layer_mode,
self.update])
def _create_session_mode(self):
self._modes.add_mode('session_mode', [partial(self._layout_setup, consts.SESSION_LAYOUT_SYSEX_BYTE), self._session_layer_mode, self._session.update_navigation_buttons], behaviour=CancelingReenterBehaviour('session_zooming_mode'))
def _create_note_modes(self):
note_mode_matrix_translation = self._create_translation('Note_Mode_Matrix_Translation', consts.CHROM_MAP_CHANNEL, Layer(button_matrix=self._midimap['Main_Button_Matrix'], note_button_matrix=self._midimap['Note_Button_Matrix'], drum_matrix=self._midimap['Drum_Button_Matrix'], mixer_button_matrix=self._midimap['Mixer_Button_Matrix']), should_enable=False)
note_mode_scene_launch_translation = self._create_translation('Note_Mode_Scene_Launch_Translation', consts.CHROM_MAP_CHANNEL, Layer(scene_launch_buttons=self._midimap['Scene_Launch_Button_Matrix']))
drum_mode_note_matrix_translation = self._create_translation('Drum_Mode_Note_Button_Translation', 0, Layer(note_button_matrix=self._midimap['Note_Button_Matrix']), should_enable=False, should_reset=False)
drum_group_layer_mode = LayerMode(self._drum_group, layer=Layer(scroll_up_button=self._midimap['Arrow_Left_Button'], scroll_down_button=self._midimap['Arrow_Right_Button'], scroll_page_up_button=self._midimap['Arrow_Up_Button'], scroll_page_down_button=self._midimap['Arrow_Down_Button'], drum_matrix=self._midimap['Drum_Button_Matrix'], select_button=self._midimap['Shift_Button'], delete_button=self._midimap['Delete_Button']))
self._note_modes = SpecialModesComponent(name='Note_Modes')
self._note_modes.add_mode('chromatic_mode', [partial(self._layout_setup, consts.NOTE_LAYOUT_SYSEX_BYTE), self._clip_delete_layer_mode, note_mode_matrix_translation])
self._note_modes.add_mode('drum_mode', [partial(self._layout_setup, consts.DRUM_LAYOUT_SYSEX_BYTE),
self._setup_drum_group,
drum_group_layer_mode,
drum_mode_note_matrix_translation])
self._note_modes.add_mode('audio_mode', [partial(self._layout_setup, consts.AUDIO_LAYOUT_SYSEX_BYTE), self._clip_delete_layer_mode])
self._note_modes.set_enabled(False)
self._modes.add_mode('note_mode', [note_mode_scene_launch_translation,
self._note_modes,
self._select_note_mode,
self._select_target_track,
self._clip_actions_component,
self._show_playing_clip,
self._set_clip_actions_type], behaviour=ReenterBehaviour(self.toggle_detail_view))
self._session_record.set_modes_component(self._modes)
self._session_record.set_note_mode_name('note_mode')
def _create_device_mode(self):
device_mode_scene_launch_translation = self._create_translation('Device_Mode_Scene_Launch_Translation', consts.DEVICE_MAP_CHANNEL, Layer(scene_launch_buttons=self._midimap['Scene_Launch_Button_Matrix']))
device_layer_mode = LayerMode(self._device, layer=Layer(parameter_controls=self._midimap['Slider_Button_Matrix']))
device_nav_layer_mode = LayerMode(self._device_navigation, layer=Layer(device_nav_left_button=self._midimap['Arrow_Left_Button'], device_nav_right_button=self._midimap['Arrow_Right_Button']))
device_background_layer_mode = LayerMode(self._device_background, layer=Layer(arrow_up_button=self._midimap['Arrow_Up_Button'], arrow_down_button=self._midimap['Arrow_Down_Button']))
示例2: InstrumentComponent
# 需要导入模块: from _Framework.ModesComponent import ModesComponent [as 别名]
# 或者: from _Framework.ModesComponent.ModesComponent import update [as 别名]
#.........这里部分代码省略.........
],
)
# Audio mode
audio_layer_mode = LayerMode(AudioModeComponent(), layer=Layer(matrix=midimap["Main_Button_Matrix"]))
self._modes.add_mode(
"audio_mode",
[
partial(self._control_surface._layout_setup, consts.SESSION_LAYOUT_SYSEX_BYTE),
partial(
self._control_surface._layout_setup,
consts.DRUM_LAYOUT_SYSEX_BYTE,
consts.SYSEX_PARAM_BYTE_STANDALONE_LAYOUT,
),
# partial(self._control_surface._layout_setup, consts.DRUM_LAYOUT_SYSEX_BYTE),#consts.AUDIO_LAYOUT_SYSEX_BYTE),
self._control_surface._clip_delete_layer_mode,
common_layer_mode,
audio_layer_mode,
],
)
def set_enabled(self, enabled):
if not enabled:
self._do_implicit_arm(enabled)
ControlSurfaceComponent.set_enabled(self, enabled)
ModesComponent.set_enabled(self._modes, enabled)
if enabled:
self._do_implicit_arm(enabled)
def _enter_scale_mode(self):
self._previous_mode = self._modes.selected_mode
self.set_mode("scale_mode")
def _leave_scale_mode(self):
self.set_mode(self._previous_mode)
def _detect_mode(self):
track = self._control_surface._target_track_component.target_track
# drum_device = self._control_surface._drum_group_finder.drum_group
self._control_surface._setup_drum_group()
if (
track is None
or track.is_foldable
or track in self.song().return_tracks
or track == self.song().master_track
or track.is_frozen
or track.has_audio_input
):
self.set_mode("audio_mode")
self._scale_component._is_drumrack = False
elif self._control_surface._drum_group._drum_group_device:
self._scale_component._is_drumrack = True
self.set_mode("drum_mode")
else:
self._scale_component._is_drumrack = False
self.set_mode("note_mode")
def get_pattern(self):
return self._scale_component.get_pattern()
def on_selected_track_changed(self):
if self._implicit_arm:
# self._control_surface._setup_drum_group()
self._detect_mode()
self._do_implicit_arm()
def update(self):
self._modes.update()
def on_selected_scene_changed(self):
# self._do_implicit_arm()
self.update()
def set_mode(self, mode):
self._modes.selected_mode = mode
self._modes.update()
def get_mode(self):
return self._modes.selected_mode
def can_implicit_arm_track(self, track):
# todo
return track.can_be_armed and track.has_midi_input
def _do_implicit_arm(self, arm=True):
if self._is_enabled:
if self._implicit_arm and arm:
self._control_surface.set_feedback_channels(self._feedback_channels)
self._control_surface.set_controlled_track(self._control_surface._target_track_component.target_track)
else:
self._control_surface.release_controlled_track()
for track in self.song().tracks:
if self.can_implicit_arm_track(track):
track.implicit_arm = (
self._is_enabled
and self._implicit_arm
and arm
and self._control_surface._target_track_component.target_track == track
)