本文整理汇总了Python中ableton.v2.control_surface.mode.ModesComponent.add_mode方法的典型用法代码示例。如果您正苦于以下问题:Python ModesComponent.add_mode方法的具体用法?Python ModesComponent.add_mode怎么用?Python ModesComponent.add_mode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ableton.v2.control_surface.mode.ModesComponent
的用法示例。
在下文中一共展示了ModesComponent.add_mode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _create_session_mode
# 需要导入模块: from ableton.v2.control_surface.mode import ModesComponent [as 别名]
# 或者: from ableton.v2.control_surface.mode.ModesComponent import add_mode [as 别名]
def _create_session_mode(self):
session_modes = ModesComponent(is_enabled=False)
session_modes.add_mode('session', self._session_mode)
session_modes.add_mode('overview', self._session_overview_mode)
session_modes.layer = Layer(cycle_mode_button='layout_button')
session_modes.selected_mode = 'session'
return [session_modes, self._session_navigation]
示例2: _create_clip_mode
# 需要导入模块: from ableton.v2.control_surface.mode import ModesComponent [as 别名]
# 或者: from ableton.v2.control_surface.mode.ModesComponent import add_mode [as 别名]
def _create_clip_mode(self):
base_loop_layer = Layer(shift_button='shift_button', loop_button='track_state_buttons_raw[1]')
self._loop_controller = LoopSettingsControllerComponent(is_enabled=False)
self._model.loopSettingsView = self._loop_controller
audio_clip_layer = Layer(warp_mode_encoder='parameter_controls_raw[5]', transpose_encoder='parameter_controls_raw[6]', detune_encoder=self._with_shift('parameter_controls_raw[6]'), gain_encoder='parameter_controls_raw[7]', shift_button='shift_button')
audio_clip_controller = AudioClipSettingsControllerComponent(is_enabled=False)
self._model.audioClipSettingsView = audio_clip_controller
clip_control_mode_selector = ModesComponent(is_enabled=False)
clip_control_mode_selector.add_mode('midi', [make_freeze_aware(self._loop_controller, base_loop_layer + Layer(encoders=self.elements.global_param_controls.submatrix[:3, :]))])
clip_control_mode_selector.add_mode('audio', [make_freeze_aware(self._loop_controller, base_loop_layer + Layer(encoders=self.elements.global_param_controls.submatrix[1:4, :], zoom_encoder='fine_grain_param_controls_raw[0]')), make_freeze_aware(audio_clip_controller, audio_clip_layer)])
clip_control_mode_selector.add_mode('no_clip', [])
clip_control_mode_selector.selected_mode = 'no_clip'
clip_control = ClipControlComponent(loop_controller=self._loop_controller, audio_clip_controller=audio_clip_controller, mode_selector=clip_control_mode_selector, decorator_factory=self._clip_decorator_factory, is_enabled=False)
self._model.clipView = clip_control
return [partial(self._view_control.show_view, 'Detail/Clip'), clip_control_mode_selector, clip_control]
示例3: OhmModHandler
# 需要导入模块: from ableton.v2.control_surface.mode import ModesComponent [as 别名]
# 或者: from ableton.v2.control_surface.mode.ModesComponent import add_mode [as 别名]
class OhmModHandler(ModHandler):
def __init__(self, *a, **k):
super(OhmModHandler, self).__init__(*a, **k)
self._shift_mode = ModesComponent()
self._color_type = 'RGB'
self._shift_mode.add_mode('shift', tuple([self._enable_shift, self._disable_shift]), behaviour = CancellableBehaviourWithRelease())
self.nav_box = self.register_component(NavigationBox(self, 16, 16, 8, 8, self.set_offset))
self._mod_button = None
def _enable_shift(self):
self._shift_value(1)
def _disable_shift(self):
self._shift_value(0)
def set_shift_button(self, button):
self._shift_mode.shift_button.set_control_element(button)
def set_nav_matrix(self, matrix):
self.nav_box.set_matrix(matrix)
def _receive_grid(self, x, y, value, *a, **k):
#self._receive_grid(x, y, value, *a, **k)
legacy = self.active_mod().legacy
if self._active_mod:
if not self._grid_value.subject is None:
if legacy:
x = x - self.x_offset
y = y - self.y_offset
if x in range(8) and y in range(8):
try:
self._grid_value.subject.send_value(x, y, self._colors[value], True)
except:
pass
def set_device_selector_matrix(self, matrix):
self._device_selector.set_matrix(matrix)
@listens('value')
def _grid_value(self, value, x, y, *a, **k):
#self.log_message('_base_grid_value ' + str(x) + str(y) + str(value))
if self.active_mod():
if self.active_mod().legacy:
x += self.x_offset
y += self.y_offset
self._active_mod.send('grid', x, y, value)
@listens('value')
def _shift_value(self, value, *a, **k):
self._is_shifted = not value is 0
mod = self.active_mod()
if mod:
mod.send('shift', value)
if self._is_shifted:
self.shift_mode.enter_mode()
if mod and mod.legacy:
self.legacy_shift_mode.enter_mode()
else:
self.legacy_shift_mode.leave_mode()
self.shift_mode.leave_mode()
self.update()
def set_mod_button(self, button):
self._mod_button = button
def update(self, *a, **k):
mod = self.active_mod()
if self.is_enabled():
if not mod is None:
mod.restore()
else:
if not self._grid_value.subject is None:
self._grid_value.subject.reset()
if not self._keys_value.subject is None:
self._keys_value.subject.reset()
self._alt_value.subject and self._alt_value.subject.send_value(2 + int(self.is_alted())*7, True)
if self._on_lock_value.subject:
self._on_lock_value.subject.send_value(1 + (int(self.is_locked())*4), True)
else:
self._mod_button and self._mod_button.send_value(7 + (not self.active_mod() is None)*7, True)
else:
self._mod_button and self._mod_button.send_value((not self.active_mod() is None)*3, True)
示例4: OhmModes
# 需要导入模块: from ableton.v2.control_surface.mode import ModesComponent [as 别名]
# 或者: from ableton.v2.control_surface.mode.ModesComponent import add_mode [as 别名]
#.........这里部分代码省略.........
dj_controls = [self._grid[7][index] for index in range(7)]
self._dj_translation = TranslationComponent(controls = dj_controls, channel = 12)
def _setup_session_control(self):
self._session_ring = SessionRingComponent(num_tracks = 7, num_scenes = 5)
self._session_ring.set_enabled(True)
self._session_navigation = SessionNavigationComponent(session_ring = self._session_ring)
self._session_navigation.scroll_navigation_layer = AddLayerMode(self._session_navigation, Layer(priority = 5, up_button = self._menu[2], down_button = self._menu[5], left_button = self._menu[3], right_button = self._menu[4]))
self._session_navigation.page_navigation_layer = AddLayerMode(self._session_navigation, Layer(priority = 5, page_up_button = self._menu[2], page_down_button = self._menu[5], page_left_button = self._menu[3], page_right_button = self._menu[4]))
self._session_navigation._vertical_banking.scroll_up_button.color = 'Session.NavigationButtonOn'
self._session_navigation._vertical_banking.scroll_down_button.color = 'Session.NavigationButtonOn'
self._session_navigation._horizontal_banking.scroll_up_button.color = 'Session.NavigationButtonOn'
self._session_navigation._horizontal_banking.scroll_down_button.color = 'Session.NavigationButtonOn'
self._session_navigation._vertical_paginator.scroll_up_button.color = 'Session.PageNavigationButtonOn'
self._session_navigation._vertical_paginator.scroll_down_button.color = 'Session.PageNavigationButtonOn'
self._session_navigation._horizontal_paginator.scroll_up_button.color = 'Session.PageNavigationButtonOn'
self._session_navigation._horizontal_paginator.scroll_down_button.color = 'Session.PageNavigationButtonOn'
self._session_navigation.set_enabled(False)
self._session = OhmSessionComponent(name = 'Session', session_ring = self._session_ring, auto_name = True)
hasattr(self._session, '_enable_skinning') and self._session._enable_skinning()
self._session.set_enabled(False)
self._session.clip_launch_layer = AddLayerMode(self._session, Layer(priority = 5, clip_launch_buttons = self._matrix.submatrix[:7,:5]))
self._session.scene_launch_layer = AddLayerMode(self._session, Layer(priority = 5, scene_launch_buttons = self._matrix.submatrix[7,:5]))
self._session_zoom = SessionOverviewComponent(name = 'Session_Overview', session_ring = self._session_ring, enable_skinning = True)
self._session_zoom.layer = Layer(priority = 5, button_matrix = self._matrix.submatrix[:7,:5])
self._session_zoom.set_enabled(False)
self._session_modes = ModesComponent(name = 'Session_Modes')
self._session_modes.add_mode('disabled', [self._session,
self._session.clip_launch_layer,
self._session.scene_launch_layer,
self._session_navigation,
self._session_navigation.scroll_navigation_layer])
self._session_modes.add_mode('enabled', [self._session,
self._session.scene_launch_layer,
self._session_zoom,
self._session_navigation,
self._session_navigation.page_navigation_layer],
behaviour = DefaultedBehaviour())
self._session_modes.layer = Layer(priority = 5, enabled_button = self._grid[7][7])
self._session_modes.selected_mode = 'disabled'
self._session_modes.set_enabled(False)
def _setup_mixer_control(self):
self._mixer = OhmMixerComponent(name = 'Mixer', tracks_provider = self._session_ring, track_assigner = simple_track_assigner, invert_mute_feedback = True, auto_name = True, enable_skinning = True)
self._mixer.layer = Layer(priority = 5, volume_controls = self._fader_matrix.submatrix[:7, :], prehear_volume_control = self._dial[15], crossfader_control = self._crossfader)
self._mixer.master_strip().layer = Layer(priority = 5, volume_control = self._fader[7], select_button = self._button[7])
self._mixer.mix_layer = AddLayerMode(self._mixer, Layer(priority = 5, mute_buttons = self._matrix.submatrix[:7,5],
solo_buttons = self._matrix.submatrix[:7,6],
arm_buttons = self._matrix.submatrix[:7,7],
send_controls = self._dial_matrix.submatrix[:,:2],
pan_controls = self._dial_matrix.submatrix[:7,2:],
track_select_buttons = self._button_matrix.submatrix[:7,:],))
self._mixer.dj_layer = AddLayerMode(self._mixer, Layer(priority = 5, mute_buttons = self._matrix.submatrix[:7,5],
crossfade_toggles = self._matrix.submatrix[:7,6],
end_pan_controls = self._dial_matrix.submatrix[:3,3],
eq_gain_controls = self._dial_matrix.submatrix[:,:3],
track_select_buttons = self._button_matrix.submatrix[:7,:],))
self._mixer.instrument_layer = AddLayerMode(self._mixer, Layer(priority = 5,
instrument_send_controls = self._dial_matrix.submatrix[:,2:],
示例5: DS1
# 需要导入模块: from ableton.v2.control_surface.mode import ModesComponent [as 别名]
# 或者: from ableton.v2.control_surface.mode.ModesComponent import add_mode [as 别名]
#.........这里部分代码省略.........
def _tracks_to_use(self):
return self.song.visible_tracks + self.song.return_tracks
def _setup_session_control(self):
self._session_ring = SessionRingComponent(num_tracks = 8, num_scenes = 1, tracks_to_use = self._tracks_to_use)
self._session_ring.set_enabled(True)
self._session_navigation = DS1SessionNavigationComponent(name = 'SessionNavigation', session_ring = self._session_ring)
self._session_navigation._vertical_banking.scroll_up_button.color = 'Session.NavigationButtonOn'
self._session_navigation._vertical_banking.scroll_down_button.color = 'Session.NavigationButtonOn'
self._session_navigation._horizontal_banking.scroll_up_button.color = 'Session.NavigationButtonOn'
self._session_navigation._horizontal_banking.scroll_down_button.color = 'Session.NavigationButtonOn'
self._session_navigation.layer = Layer(priority = 4, track_select_dial = ComboElement(control = self._encoder[1], modifier = [self._encoder_button[1]] ), up_button = self._grid[0][1], down_button = self._grid[0][2])
self._session_navigation.set_enabled(False)
self._session = DS1SessionComponent(session_ring = self._session_ring, auto_name = True)
hasattr(self._session, '_enable_skinning') and self._session._enable_skinning()
self._session.layer = Layer(priority = 4, scene_launch_buttons = self._grid_matrix.submatrix[1:2, 1:2])
self._session.clips_layer = AddLayerMode(self._session, Layer(priority = 4, clip_launch_buttons = self._top_buttons, stop_track_clip_buttons = self._bottom_buttons))
self._session.set_enabled(False)
def _setup_mixer_control(self):
self._mixer = MonoMixerComponent(name = 'Mixer', num_returns = 2, tracks_provider = self._session_ring, track_assigner = simple_track_assigner, invert_mute_feedback = True, auto_name = True, enable_skinning = True)
self._mixer.master_strip().set_volume_control(self._master_fader)
self._mixer.set_prehear_volume_control(self._side_dial[3])
self._mixer.layer = Layer(volume_controls = self._fader_matrix, track_select_dial = self._encoder[1])
self._strip = [self._mixer.channel_strip(index) for index in range(8)]
for index in range(8):
self._strip[index].layer = Layer(priority = 4, parameter_controls = self._dial_matrix.submatrix[index:index+1, :])
self._mixer.selected_strip().layer = Layer(priority = 4, parameter_controls = self._selected_parameter_controls)
self._mixer.master_strip().layer = Layer(priority = 4, parameter_controls = self._side_dial_matrix.submatrix[:3, :])
self._mixer.main_layer = AddLayerMode(self._mixer, Layer(priority = 4, solo_buttons = self._bottom_buttons, mute_buttons = self._top_buttons))
self._mixer.select_layer = AddLayerMode(self._mixer, Layer(priority = 4, arm_buttons = self._bottom_buttons, track_select_buttons = self._top_buttons))
self.song.view.selected_track = self._mixer.channel_strip(0)._track
self._mixer.set_enabled(False)
def _setup_transport_control(self):
self._transport = DS1TransportComponent()
self._transport.name = 'Transport'
self._transport._record_toggle.view_transform = lambda value: 'Transport.RecordOn' if value else 'Transport.RecordOff'
self._transport.layer = Layer(priority = 4, stop_button = self._grid[1][0], play_button = self._grid[0][0], record_button = self._grid[2][0])
self._transport.set_enabled(True)
def _setup_device_control(self):
self._device = DeviceComponent(name = 'Device_Component', device_provider = self._device_provider, device_bank_registry = DeviceBankRegistry())
self._device_navigator = DeviceNavigator(self._device_provider, self._mixer, self)
self._device_navigator.name = 'Device_Navigator'
def _setup_session_recording_component(self):
self._clip_creator = ClipCreator()
self._clip_creator.name = 'ClipCreator'
self._recorder = SessionRecordingComponent(ViewControlComponent())
self._recorder.set_enabled(True)
self._recorder.layer = Layer(priority = 4, automation_button = self._grid[1][2], record_button = self._grid[2][1],)
def _setup_m4l_interface(self):
self._m4l_interface = M4LInterfaceComponent(controls=self.controls, component_guard=self.component_guard, priority = 10)
self._m4l_interface.name = "M4LInterface"
self.get_control_names = self._m4l_interface.get_control_names
self.get_control = self._m4l_interface.get_control
self.grab_control = self._m4l_interface.grab_control
self.release_control = self._m4l_interface.release_control
def _setup_translations(self):
controls = []
for control in self.controls:
controls.append(control)
self._translations = TranslationComponent(controls, 10)
self._translations.name = 'TranslationComponent'
self._translations.set_enabled(False)
def _setup_main_modes(self):
self._main_modes = ModesComponent(name = 'MainModes')
self._main_modes.add_mode('Main', [self._mixer, self._mixer.main_layer, self._session, self._session_navigation], cycle_mode_button_color = 'ModeButtons.Main')
self._main_modes.add_mode('Select', [self._mixer, self._mixer.select_layer, self._session, self._session_navigation], cycle_mode_button_color = 'ModeButtons.Select')
self._main_modes.add_mode('Clips', [self._mixer, self._session, self._session.clips_layer, self._session_navigation], cycle_mode_button_color = 'ModeButtons.Clips')
self._main_modes.layer = Layer(priority = 4, cycle_mode_button = self._grid[2][2])
self._main_modes.selected_mode = 'Main'
self._main_modes.set_enabled(False)
def _can_auto_arm_track(self, track):
routing = track.current_input_routing
return routing == 'Ext: All Ins' or routing == 'All Ins' or routing.startswith('DS1 Input')
#self._main_modes.selected_mode in ['Sends', 'Device'] and
# a
示例6: Twister
# 需要导入模块: from ableton.v2.control_surface.mode import ModesComponent [as 别名]
# 或者: from ableton.v2.control_surface.mode.ModesComponent import add_mode [as 别名]
#.........这里部分代码省略.........
resource = PrioritizedResource
self._encoder = [CodecEncoderElement(msg_type = MIDI_CC_TYPE, channel = CHANNEL, identifier = TWISTER_DIALS[index], name = 'Encoder_' + str(index), num = TWISTER_DIALS[index], script = self, optimized_send_midi = optimized, resource_type = resource, monobridge = self._monobridge) for index in range(16)]
self._encoder_button = [TwisterButtonElement(is_momentary = is_momentary, msg_type = MIDI_CC_TYPE, channel = 1, identifier = TWISTER_DIAL_BUTTONS[index], name = 'Encoder_Button_' + str(index), script = self, skin = self._skin, color_map = COLOR_MAP, optimized_send_midi = optimized, resource_type = resource, monobridge = self._monobridge) for index in range(16)]
self._dial_matrix = ButtonMatrixElement(name = 'Dial_Matrix', rows = [self._encoder[index*4:(index*4)+4] for index in range(4)])
self._dial_button_matrix = ButtonMatrixElement(name = 'Dial_Button_Matrix', rows = [self._encoder_button[index*4:(index*4)+4] for index in range(4)])
def _setup_background(self):
self._background = BackgroundComponent(name = 'Background')
self._background.layer = Layer(priority = 3, dials = self._dial_matrix, dial_buttons = self._dial_button_matrix.submatrix[:,:])
self._background.set_enabled(True)
def _setup_m4l_interface(self):
self._m4l_interface = M4LInterfaceComponent(controls=self.controls, component_guard=self.component_guard, priority = 10)
self._m4l_interface.name = "M4LInterface"
self.get_control_names = self._m4l_interface.get_control_names
self.get_control = self._m4l_interface.get_control
self.grab_control = self._m4l_interface.grab_control
self.release_control = self._m4l_interface.release_control
def _define_sysex(self):
pass
def _check_connection(self):
self._connected = True
self._initialize_hardware()
self._initialize_script()
def _setup_mixer_control(self):
self._mixer_session_ring = SessionRingComponent(num_tracks = 4, num_scenes = 4)
self._mixer = MonoMixerComponent(name = 'Mixer', tracks_provider = self._mixer_session_ring, track_assigner = simple_track_assigner, invert_mute_feedback = True, auto_name = True, enable_skinning = True)
self._mixer.layer = Layer(priority = 4,
solo_buttons = self._dial_button_matrix.submatrix[:,0],
stop_clip_buttons = self._dial_button_matrix.submatrix[:,1],
track_select_buttons = self._dial_button_matrix.submatrix[:,2])
self._mixer.set_enabled(True)
def _setup_device_control(self):
self._device = SpecialDeviceComponent(name = 'Device_Component', device_provider = self._device_provider, device_bank_registry = DeviceBankRegistry(), script = self)
self._device.layer = Layer(priority = 4, parameter_controls = self._dial_matrix.submatrix[:,:],)
self._device.bank_layer = AddLayerMode(self._device, Layer(priority = 4,
bank_prev_button = self._encoder_button[12],
bank_next_button = self._encoder_button[13]))
self._device.set_enabled(False)
def _setup_mod(self):
self.monomodular = get_monomodular(self)
self.monomodular.name = 'monomodular_switcher'
self.modhandler = TwisterModHandler(self, device_provider = self._device_provider)
self.modhandler.name = 'ModHandler'
self.modhandler.layer = Layer(priority = 8,
twister_encoder_button_grid = self._dial_button_matrix.submatrix[:,:],)
#twister_encoder_grid = self._dial_matrix.submatrix[:,:],)
self.modhandler.set_enabled(False)
def _setup_modes(self):
self._modswitcher = ModesComponent(name = 'ModSwitcher')
self._modswitcher.add_mode('mod', [self.modhandler, self._device])
self._modswitcher.add_mode('device', [self._device, self._device.bank_layer])
self._modswitcher.selected_mode = 'device'
self._modswitcher.set_enabled(True)
def _update_modswitcher(self):
debug('update modswitcher', self.modhandler.active_mod())
if self.modhandler.active_mod():
self._modswitcher.selected_mode = 'mod'
else:
self._modswitcher.selected_mode = 'device'
@listens('appointed_device')
def _on_device_changed(self):
debug('appointed device changed, script')
self._update_modswitcher()
@listens('selected_track')
def _on_selected_track_changed(self):
debug('_on_selected_track_changed')
#super(Cntrlr, self)._on_selected_track_changed()
#self._drum_group_finder.device_parent = self.song.veiw.selected_track
if not len(self.song.view.selected_track.devices):
self._update_modswitcher()
def restart_monomodular(self):
#debug('restart monomodular')
self.modhandler.disconnect()
with self.component_guard():
self._setup_mod()
示例7: Codec
# 需要导入模块: from ableton.v2.control_surface.mode import ModesComponent [as 别名]
# 或者: from ableton.v2.control_surface.mode.ModesComponent import add_mode [as 别名]
#.........这里部分代码省略.........
def _setup_device_controls(self):
self._device = [None for index in range(4)]
for index in range(4):
self._device[index] = CodecDeviceComponent(self, index+1, device_bank_registry = DeviceBankRegistry())
self._device[index].name = 'CodecDevice_Component_' + str(index+1)
self._device[index].layer = Layer(priority = 4, parameter_controls = self._encoder_matrix.submatrix[:, index],
on_off_button = self._button[1][index],
bank_prev_button = self._button[2][index],
bank_next_button = self._button[3][index],
)
self._device[index]._nav_layer = AddLayerMode(self._device[index], Layer(priority = 4, nav_prev_button = self._button[6][index],
nav_next_button = self._button[7][index],))
self._device[index].set_enabled(False)
def _setup_special_device_control(self):
self._special_device = SpecialCodecDeviceComponent(self, device_bank_registry = DeviceBankRegistry(), device_provider = self._device_provider)
self._special_device.name = 'SpecialCodecDeviceComponent'
self._is_active_device = True
self._special_device.layer = Layer(priority = 4, parameter_controls = self._encoder_matrix.submatrix[:,:],
on_off_button = self._button[1][0],
bank_prev_button = self._button[4][0],
bank_next_button = self._button[5][0],
)
self._special_device.set_enabled(False)
def _setup_device_chooser(self):
self._selected_device = self._device[0]
self._last_selected_device = self._device[0]
self._selected_device_modes = ModesComponent()
self._selected_device_modes.add_mode('disabled', [None])
self._selected_device_modes.add_mode('device_0', [self._device_navigator._dev1_layer], behaviour = DefaultedBehaviour())
self._selected_device_modes.add_mode('device_1', [self._device_navigator._dev2_layer], behaviour = DefaultedBehaviour())
self._selected_device_modes.add_mode('device_2', [self._device_navigator._dev3_layer], behaviour = DefaultedBehaviour())
self._selected_device_modes.add_mode('device_3', [self._device_navigator._dev4_layer], behaviour = DefaultedBehaviour())
self._selected_device_modes.layer = Layer(priority = 4, device_0_button = self._button[0][0], device_1_button = self._button[0][1], device_2_button = self._button[0][2], device_3_button = self._button[0][3])
self._selected_device_modes.selected_mode = 'device_0'
self._selected_device_modes.set_enabled(False)
self._on_device_selector_mode_changed.subject = self._selected_device_modes
def _setup_device_selector(self):
self._device_selector = DeviceSelectorComponent(self)
self._device_selector.name = 'Device_Selector'
self._device_selector.layer = Layer(priority = 4, matrix = self._code_keys)
self._device_selector.set_enabled(False)
def _setup_send_reset(self):
self._send_reset = CodecResetSendsComponent(self)
self._send_reset.set_enabled(False)
#self._send_reset.set_buttons(self._button)
def _setup_default_buttons(self):
self._value_default = ParameterDefaultComponent(script = self, dials = self._dial)
self._value_default.layer = Layer(priority = 3, matrix = self._button_matrix)
self._value_default.set_enabled(False)
def _setup_shift_modes(self):
self._main_shift_modes = ModesComponent(name = 'MainShiftModes')
self._main_shift_modes.add_mode('disabled', [self.normal_encoder_sysex], cycle_mode_button_color = 'DefaultButton.Off')
示例8: Push
# 需要导入模块: from ableton.v2.control_surface.mode import ModesComponent [as 别名]
# 或者: from ableton.v2.control_surface.mode.ModesComponent import add_mode [as 别名]
#.........这里部分代码省略.........
def _create_background_layer(self):
return super(Push, self)._create_background_layer() + Layer(display_line1='display_line1', display_line2='display_line2', display_line3='display_line3', display_line4='display_line4', in_button='in_button', out_button='out_button', pad_parameters=self._pad_parameter_control)
def _create_message_box_background_layer(self):
return super(Push, self)._create_message_box_background_layer() + BackgroundLayer('in_button', 'out_button', priority=consts.MESSAGE_BOX_PRIORITY)
def _create_track_frozen_layer(self):
return Layer(display='display_line2', _notification=self._notification.use_full_display(1))
def _create_notification_component(self):
return NotificationComponent(display_lines='display_lines', is_root=True, is_enabled=True)
def _create_message_box_layer(self):
return Layer(display_line1='display_line1', display_line2='display_line2', display_line3='display_line3', display_line4='display_line4', cancel_button='select_buttons_raw[-1]', priority=consts.MESSAGE_BOX_PRIORITY)
def _create_clip_mode(self):
return [self._track_modes, (self._mixer, self._mixer_layer)] + super(Push, self)._create_clip_mode()
def _create_clip_loop_layer(self):
return super(Push, self)._create_clip_loop_layer() + Layer(name_display=self.elements.display_line1.subdisplay[:36], value_display=self.elements.display_line2.subdisplay[:36])
def _create_clip_audio_layer(self):
return super(Push, self)._create_clip_audio_layer() + Layer(name_display=self.elements.display_line1.subdisplay[36:], value_display=self.elements.display_line2.subdisplay[36:])
def _create_clip_name_layer(self):
return super(Push, self)._create_clip_name_layer() + Layer(display='display_line3')
def _create_session_recording(self):
return FixedLengthSessionRecordingComponent(fixed_length_setting=self._fixed_length_setting, clip_creator=self._clip_creator, view_controller=self._view_control, name='Session_Recording', is_root=True)
def _init_track_modes(self):
self._track_modes = ModesComponent(name='Track_Modes')
self._track_modes.set_enabled(False)
self._track_modes.add_mode('stop', AddLayerMode(self._stop_clips, self._stop_track_clips_layer))
self._track_modes.add_mode('solo', AddLayerMode(self._mixer, self._mixer_solo_layer))
self._track_modes.add_mode('mute', AddLayerMode(self._mixer, self._mixer_mute_layer))
self._track_modes.layer = self._create_track_modes_layer()
self._track_modes.selected_mode = 'mute'
def _browser_back_to_top(self):
self._browser_mode.component.back_to_top()
def _browser_reset_load_memory(self):
self._browser_mode.component.reset_load_memory()
def _init_browser(self):
class BrowserMode(MultiEntryMode):
def __init__(self, create_browser = nop, *a, **k):
super(BrowserMode, self).__init__(LazyComponentMode(create_browser), *a, **k)
def enter_mode(browser_mode_self):
super(BrowserMode, browser_mode_self).enter_mode()
self._scales_enabler.selected_mode = 'disabled'
@property
def component(self):
return self._mode.component
self._browser_mode = BrowserMode(self._create_browser)
self._browser_hotswap_mode = MultiEntryMode(BrowserHotswapMode(application=self.application()))
self._on_browse_mode_changed.subject = self.application().view
def _init_browse_mode(self):
self._main_modes.add_mode('browse', [self._when_track_is_not_frozen(self._enable_stop_mute_solo_as_modifiers, partial(self._view_control.show_view, 'Browser'), self._browser_back_to_top, self._browser_hotswap_mode, self._browser_mode, self._browser_reset_load_memory)], groups=['add_effect', 'add_track', 'browse'], behaviour=mixin(DynamicBehaviourMixin, CancellableBehaviour)(lambda : not self._browser_hotswap_mode._mode.can_hotswap() and 'add_effect_left'))
示例9: Cntrlr
# 需要导入模块: from ableton.v2.control_surface.mode import ModesComponent [as 别名]
# 或者: from ableton.v2.control_surface.mode.ModesComponent import add_mode [as 别名]
#.........这里部分代码省略.........
common = CompoundMode(self._mixer,
self._session_ring)
main_buttons=CompoundMode(self._G_mixer.main_buttons_layer,
self._session_navigation,
self._session_navigation.nav_layer,
self._transport,
self._transport.overdub_layer,
self._recorder,
self._recorder.main_layer,
self._device)
shifted_main_buttons=CompoundMode(self._G_mixer.shifted_buttons_layer,
self._recorder,
self._recorder.shift_layer,
self._session,
self._session.scene_launch_layer,
self._session.stop_clips_layer,
self._transport,
self._device)
main_faders=CompoundMode(self._G_mixer.main_faders_layer,
self._G_mixer.master_fader_layer)
main_dials=CompoundMode(self._view_control,
self._view_control.main_layer,
self._device_navigator,
self._device_navigator.select_dial_layer,
self.encoder_navigation_on)
shifted_dials=CompoundMode(self._session_navigation,
self._session_navigation.nav_dial_layer,
self._device_navigator,
self._device_navigator.select_dial_layer,
self.encoder_navigation_on)
self._modalt_mode = ModesComponent(name = 'ModAltMode')
self._modalt_mode.add_mode('disabled', None)
self._modalt_mode.add_mode('enabled', [tuple([self._enable_mod_alt, self._disable_mod_alt])], behaviour = CancellableBehaviourWithRelease(), cycle_mode_button_color = 'Mod.AltOn')
self._modalt_mode.selected_mode = 'disabled'
self._modalt_mode.set_enabled(False)
self._modalt_mode.layer = Layer(priority = 4, enabled_button = self._encoder_button[1])
self._modswitcher = ModesComponent(name = 'ModSwitcher')
self._modswitcher.add_mode('mod', [self.modhandler, self._modalt_mode, main_faders, self._G_mixer.main_knobs_layer, self._device, self._device_navigator.main_layer, main_dials, DelayMode(self.modhandler.update, delay = .5, parent_task_group = self._task_group)])
self._modswitcher.add_mode('instrument', [self._instrument.shift_button_layer, main_buttons, main_faders, self._G_mixer.main_knobs_layer, self._device, self._device_navigator.main_layer]) #self._instrument.shift_button_layer, self._optional_translations])
self._modswitcher.selected_mode = 'instrument'
self._modswitcher.set_enabled(False)
self._instrument._main_modes = ModesComponent(name = 'InstrumentModes')
self._instrument._main_modes.add_mode('disabled', [main_buttons, main_dials, self._device.main_layer, self._session, self._session, self._session.clip_launch_layer])
self._instrument._main_modes.add_mode('drumpad', [self._instrument._drumpad.sequencer_layer,
main_buttons,
self._device.main_layer,
main_dials])
self._instrument._main_modes.add_mode('drumpad_split', [self._instrument._drumpad.split_layer,
self._instrument._selected_session,
main_buttons,
self._device.main_layer,
main_dials])
self._instrument._main_modes.add_mode('drumpad_sequencer', [self._instrument._drumpad.sequencer_layer,
main_buttons,
self._device.main_layer,
main_dials])
self._instrument._main_modes.add_mode('drumpad_shifted', [self._instrument._drumpad.sequencer_shift_layer,
self._instrument.drumpad_shift_layer,
shifted_main_buttons,
self._device.main_layer,
shifted_dials])
self._instrument._main_modes.add_mode('drumpad_split_shifted', [self._instrument._drumpad.split_layer,
示例10: Push2
# 需要导入模块: from ableton.v2.control_surface.mode import ModesComponent [as 别名]
# 或者: from ableton.v2.control_surface.mode.ModesComponent import add_mode [as 别名]
#.........这里部分代码省略.........
self._model.liveDialogView = self._dialog._message_box
def _create_mixer(self):
return MixerComponent(is_root=True, tracks_provider=self._session_ring, solo_layer=Layer(solo_buttons='select_buttons'), mute_layer=Layer(mute_buttons='select_buttons'))
def _create_convert(self):
convert = ConvertComponent(decorator_factory=self._device_decorator_factory, name='Convert', tracks_provider=self._session_ring, is_enabled=False, layer=make_dialog_layer(action_buttons='select_buttons', cancel_button='track_state_buttons_raw[0]'))
self.__on_convert_closed.subject = convert
self._model.convertView = convert
return convert
def _init_note_settings_component(self):
self._note_settings_component = NoteSettingsComponent(grid_resolution=self._grid_resolution, is_enabled=False, layer=Layer(full_velocity_button='accent_button', priority=consts.MOMENTARY_DIALOG_PRIORITY))
self._model.noteSettingsView = self._note_settings_component
def _init_note_editor_settings_component(self):
super(Push2, self)._init_note_editor_settings_component()
self._model.stepSettingsView = self._note_editor_settings_component.step_settings
def _init_automation_component(self):
self._automation_component = AutomationComponent()
self._model.stepAutomationSettingsView = self._automation_component
def _init_convert_enabler(self):
self._convert_enabler = ConvertEnabler(is_root=True, is_enabled=True, enter_dialog_mode=self._enter_dialog_mode, exit_dialog_mode=self._exit_dialog_mode)
self._convert_enabler.layer = Layer(convert_toggle_button='convert_button')
@listens('cancel')
def __on_convert_closed(self):
self._dialog_modes.selected_mode = None
def _init_main_modes(self):
super(Push2, self)._init_main_modes()
self._main_modes.add_mode('user', [self._user_mode_ui_blocker])
self._model.modeState = self.register_disconnectable(ModeCollector(main_modes=self._main_modes, mix_modes=self._mix_modes, global_mix_modes=self._mixer_control, device_modes=self._device_navigation.modes))
self.__on_main_mode_button_value.replace_subjects([self.elements.vol_mix_mode_button,
self.elements.pan_send_mix_mode_button,
self.elements.single_track_mix_mode_button,
self.elements.clip_mode_button,
self.elements.device_mode_button,
self.elements.browse_mode_button,
self.elements.create_device_button,
self.elements.create_track_button])
@listens_group('value')
def __on_main_mode_button_value(self, value, sender):
if not value:
self._exit_modal_modes()
def _exit_modal_modes(self):
self._dialog_modes.selected_mode = None
self._setup_enabler.selected_mode = 'disabled'
def _create_capture_and_insert_scene_component(self):
return CaptureAndInsertSceneComponent(name='Capture_And_Insert_Scene', decorator_factory=self._clip_decorator_factory, is_root=True)
def _init_stop_clips_action(self):
stop_clips_buttons = ButtonMatrixElement(rows=[wrap_button('select_buttons_raw', 'global_track_stop_button')])
self._stop_clips = StopClipComponent(session_ring=self._session_ring, name='Stop_Clip', is_root=True)
self._stop_clips.layer = Layer(stop_all_clips_button=self._with_shift('global_track_stop_button'), stop_selected_track_clip_button='global_track_stop_button', stop_track_clips_buttons=stop_clips_buttons)
def _init_mixer(self):
self._mixer = self._create_mixer()
self._mixer.add_mode('stop', self._stop_clips)
self._mixer.stop_button.mode_unselected_color = 'DefaultButton.On'
self._mixer.layer = Layer(solo_track_button='global_solo_button', mute_track_button='global_mute_button', stop_button='global_track_stop_button')
示例11: MonoPedal
# 需要导入模块: from ableton.v2.control_surface.mode import ModesComponent [as 别名]
# 或者: from ableton.v2.control_surface.mode.ModesComponent import add_mode [as 别名]
class MonoPedal(ControlSurface):
def __init__(self, *a, **k):
self.log_message = logger.warning
super(MonoPedal, self).__init__(*a, **k)
self._monomod_version = 'b996'
self._codec_version = 'b996'
self._cntrlr_version = 'b996'
self._cntrlr = None
self._host_name = 'MonoPedal'
self._color_type = 'OhmRGB'
self.hosts = []
self._timer = 0
self.flash_status = 1
self._touched = 0
self._last_main_mode = 'looper'
with self.component_guard():
self._setup_monobridge()
self._setup_controls()
self._setup_looper()
self._setup_launcher()
self._setup_device_control()
self._setup_modes()
self.schedule_message(1, self._open_log)
#self._loop_selector.set_enabled(True)
"""script initialization methods"""
def _open_log(self):
self.log_message("<<<<<<<<<<<<<<<<<<<<= " + str(self._host_name) + " " + str(self._monomod_version) + " log opened =>>>>>>>>>>>>>>>>>>>")
self.show_message(str(self._host_name) + ' Control Surface Loaded')
def _setup_monobridge(self):
self._monobridge = MonoBridgeElement(self)
self._monobridge.name = 'MonoBridge'
def _setup_controls(self):
self._pedal = [None for index in range(8)]
for index in range(7):
self._pedal[index] = DoublePressElement(MonoButtonElement(is_momentary = True, msg_type = MIDI_CC_TYPE, channel = 0, identifier = PEDAL_DEFS[index], name = 'Pedal_'+str(index), script = self))
self._pedal[index]._report = False
self._pedal[7] = LoopPedalExpressionElement(script = self, msg_type = MIDI_CC_TYPE, channel = 0, identifier = 1, map_mode = Live.MidiMap.MapMode.absolute)
self._pedal[7].name = 'Pedal_'+str(7)
self._pedal[7]._report = False
self._leds = [None for index in range(4)]
for index in range(4):
red_led = ButtonElement(True, MIDI_NOTE_TYPE, 0, LED_DEFS[index])
green_led = ButtonElement(True, MIDI_NOTE_TYPE, 0, LED_DEFS[index]+4)
blue_led = ButtonElement(True, MIDI_NOTE_TYPE, 0, LED_DEFS[index]+8)
self._leds[index] = RGB_LED(red_led, green_led, blue_led, is_momentary = True, msg_type = MIDI_NOTE_TYPE, channel = 0, identifier = index+13, name = 'LED_' + str(index), script = self)
self._select_buttons = ButtonMatrixElement()
self._select_buttons.name = 'SelectMatrix'
self._select_buttons.add_row([self._pedal[6], self._pedal[5], self._pedal[4], self._pedal[3]])
self._doublepress_select_buttons = ButtonMatrixElement()
self._doublepress_select_buttons.name = 'DoublepressSelectMatrix'
self._doublepress_select_buttons.add_row([self._pedal[6].double_press, self._pedal[5].double_press, self._pedal[4].double_press, self._pedal[3].double_press])
self._record_button = self._pedal[1]
self._mute_button = self._pedal[2]
self._overdub_button = self._pedal[0]
def _setup_looper(self):
self._looper = MonolooperComponent(self._leds, self)
self._looper.layer = Layer(select_buttons = self._select_buttons,
doublepress_select_buttons = self._doublepress_select_buttons,
overdub_button = self._pedal[2],
record_button = self._pedal[1],
mute_button = self._pedal[0],
expression_pedal = self._pedal[7],)
def _setup_launcher(self):
self._launcher = LauncherComponent(self._leds, self)
self._launcher.set_enabled(False)
self._launcher.layer = Layer(select_buttons = self._select_buttons,
doublepress_select_buttons = self._doublepress_select_buttons,
fire1_button = self._pedal[2],
fire2_button = self._pedal[1],
fire3_button = self._pedal[0],
expression_pedal = self._pedal[7])
def _setup_device_control(self):
self._device_control = DeviceControlComponent(self._leds, self)
self._device_control.set_enabled(False)
self._device_control.layer = Layer(select_buttons = self._select_buttons,
doublepress_select_buttons = self._doublepress_select_buttons,
toggle1_button = self._pedal[2],
toggle2_button = self._pedal[1],
toggle3_button = self._pedal[0],
expression_pedal = self._pedal[7])
def _setup_modes(self):
self._button_modes = ModesComponent(name='Button_Modes')
self._button_modes.add_mode('launcher', self._launcher)
#.........这里部分代码省略.........
示例12: AumPush2
# 需要导入模块: from ableton.v2.control_surface.mode import ModesComponent [as 别名]
# 或者: from ableton.v2.control_surface.mode.ModesComponent import add_mode [as 别名]
class AumPush2(Push2):
device_component_class = AumPush2DeviceComponent
device_provider_class = ModDeviceProvider
def __init__(self, c_instance, model):
self._monomod_version = 'b996'
self._cntrlr_version = 'b996'
self._host_name = 'AumPush2'
self._color_type = 'Push'
self._auto_arm_calls = 0
self.log_message = logger.warning
super(AumPush2, self).__init__(c_instance, model)
with self.component_guard():
self._hack_stuff()
#self._on_selected_track_changed.subject = self.song.view
#self._on_main_mode_changed.subject = self._main_modes
self.log_message('<<<<<<<<<<<<<<<<<<<<<<<< AumPush2 ' + str(self._monomod_version) + ' log opened >>>>>>>>>>>>>>>>>>>>>>>>')
def _create_components(self):
self._remove_pedal()
super(AumPush2, self)._create_components()
#no idea why this is messing up the stock colors?
def _create_skin(self):
return self.register_disconnectable(make_default_skin())
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_matrix_modes(self):
super(AumPush2, self)._init_matrix_modes()
#self._setup_monoinstrument()
self._setup_mod()
self._note_modes.add_mode('mod', [self.modhandler])
self._note_modes.add_mode('looperhack', [self._audio_loop])
def _create_device_component(self):
return self.device_component_class(script = self, device_decorator_factory=self._device_decorator_factory, device_bank_registry=self._device_bank_registry, banking_info=self._banking_info, name='DeviceComponent', is_enabled=True, is_root=True)
"""
def _create_main_mixer_modes(self):
self._mixer_control = MixerControlComponent(name='Global_Mix_Component', view_model=self._model.mixerView, tracks_provider=self._session_ring, is_enabled=False, layer=Layer(controls='fine_grain_param_controls', volume_button='track_state_buttons_raw[0]', panning_button='track_state_buttons_raw[1]', send_slot_one_button='track_state_buttons_raw[2]', send_slot_two_button='track_state_buttons_raw[3]', send_slot_three_button='track_state_buttons_raw[4]', send_slot_four_button='track_state_buttons_raw[5]', send_slot_five_button='track_state_buttons_raw[6]', cycle_sends_button='track_state_buttons_raw[7]'))
self._model.mixerView.realtimeMeterData = self._mixer_control.real_time_meter_handlers
track_mixer_control = TrollMixerControlComponent(script = self, name='Track_Mix_Component', is_enabled=False, tracks_provider=self._session_ring, layer=Layer(controls='fine_grain_param_controls', scroll_left_button='track_state_buttons_raw[6]', scroll_right_button='track_state_buttons_raw[7]'))
self._track_mixer_control = track_mixer_control
self._model.mixerView.trackControlView = track_mixer_control
#.........这里部分代码省略.........
示例13: Minim
# 需要导入模块: from ableton.v2.control_surface.mode import ModesComponent [as 别名]
# 或者: from ableton.v2.control_surface.mode.ModesComponent import add_mode [as 别名]
#.........这里部分代码省略.........
self._session_navigation._vertical_layer = AddLayerMode(self._session_navigation, Layer(priority = 4, up_button = self._top_button[0], down_button = self._top_button[1]))
self._session_navigation.set_enabled(False)
def _setup_recorder(self):
self._recorder = SessionRecordingComponent(view_controller = self._viewcontrol)
self._recorder.layer = Layer(priority = 4, new_button = self._side_button[2], record_button = self._side_button[1])
self._recorder.set_enabled(False)
def _setup_instrument(self):
self._grid_resolution = GridResolution()
self._c_instance.playhead.enabled = True
self._playhead_element = PlayheadElement(self._c_instance.playhead)
self._drum_group_finder = PercussionInstrumentFinder(device_parent=self.song.view.selected_track)
self._instrument = MinimMonoInstrumentComponent(name = 'InstrumentComponent', script = self, skin = self._skin, drum_group_finder = self._drum_group_finder, grid_resolution = self._grid_resolution, settings = DEFAULT_INSTRUMENT_SETTINGS, device_provider = self._device_provider, parent_task_group = self._task_group)
self._instrument._drumpad._drumgroup._button_coordinates_to_pad_index = lambda first_note, coordinates: coordinates[1] + (abs(coordinates[0]-1)*4) + first_note
self._instrument._drumpad._drumgroup.create_translation_entry = lambda button: (button.coordinate[1], button.coordinate[0]+2, button.identifier, button.channel)
self._instrument.layer = Layer(priority = 6, shift_button = self._side_button[3])
self._instrument.keypad_options_layer = AddLayerMode(self._instrument, Layer(priority = 6,
scale_up_button = self._button[0][3],
scale_down_button = self._button[0][2],
offset_up_button = self._button[0][1],
offset_down_button = self._button[0][0],))
#vertical_offset_up_button = self._top_button[1],
#vertical_offset_down_button = self._top_button[0]))
self._instrument.drumpad_options_layer = AddLayerMode(self._instrument, Layer(priority = 6,
scale_up_button = self._button[0][3],
scale_down_button = self._button[0][2],
drum_offset_up_button = self._button[0][1],
drum_offset_down_button = self._button[0][0],))
self._instrument._keypad.main_layer = LayerMode(self._instrument._keypad, Layer(priority = 6, keypad_matrix = self._matrix.submatrix[:,1:3]))
self._instrument._keypad.select_layer = LayerMode(self._instrument._keypad, Layer(priority = 6, keypad_select_matrix = self._matrix.submatrix[:, 1:3]))
self._instrument._drumpad.main_layer = LayerMode(self._instrument._drumpad, Layer(priority = 6, drumpad_matrix = self._matrix.submatrix[:,1:3]))
self._instrument._drumpad.select_layer = LayerMode(self._instrument._drumpad, Layer(priority = 6, drumpad_select_matrix = self._matrix.submatrix[:,1:3]))
self._instrument._main_modes = ModesComponent(name = 'InstrumentModes')
self._instrument._main_modes.add_mode('disabled', [])
self._instrument._main_modes.add_mode('drumpad', [self._instrument._drumpad, self._instrument._drumpad.main_layer, self._instrument.drumpad_options_layer])
self._instrument._main_modes.add_mode('drumpad_shifted', [self._instrument._drumpad, self._instrument._drumpad.select_layer, self._instrument.drumpad_options_layer])
self._instrument._main_modes.add_mode('keypad', [self._instrument._keypad, self._instrument._keypad.main_layer, self._instrument.keypad_options_layer])
self._instrument._main_modes.add_mode('keypad_shifted', [self._instrument._keypad, self._instrument._keypad.select_layer, self._instrument.keypad_options_layer])
self._instrument.register_component(self._instrument._main_modes)
self._instrument.set_enabled(False)
#self._instrument.audioloop_layer = LayerMode(self._instrument, Layer(priority = 6, loop_selector_matrix = self._base_grid))
def _setup_modes(self):
self._main_modes = ModesComponent(name = 'MainModes')
self._main_modes.add_mode('disabled', [])
self._main_modes.add_mode('session_shifted', [self._recorder, self._mixer, self._mixer.solo_mute_record_stop_layer, self._session, self._session.stop_layer, self._session_navigation, self._session_navigation._vertical_layer, self._transport], groups = ['shifted'], behaviour = self._shift_latching(color = 'Mode.Session'))
self._main_modes.add_mode('session', [self._recorder, self._mixer, self._session, self._session.cliplaunch_layer, self._session_navigation, self._session_navigation._horizontal_layer, self._transport], behaviour = self._shift_latching(color = 'Mode.Session'))
self._main_modes.add_mode('instrument_shifted', [self._recorder, self._mixer, self._mixer.mute_layer, self._viewcontrol, self._instrument, self._transport], groups = ['shifted'], behaviour = self._shift_latching(color = 'Mode.Instrument'))
self._main_modes.add_mode('instrument', [self._recorder, self._mixer, self._mixer.select_layer, self._viewcontrol, self._instrument, self._transport], behaviour = self._shift_latching(color = 'Mode.Instrument'))
self._main_modes.layer = Layer(priority = 6, session_button = self._side_button[4], instrument_button = self._side_button[3])
self._main_modes.set_enabled(False)
self._main_modes.selected_mode = 'disabled'
def _can_auto_arm_track(self, track):
routing = track.current_input_routing
return routing == 'Ext: All Ins' or routing == 'All Ins' or routing.startswith('Livid Minim Input')
def _setup_m4l_interface(self):
self._m4l_interface = M4LInterfaceComponent(controls=self.controls, component_guard=self.component_guard)
self.get_control_names = self._m4l_interface.get_control_names
self.get_control = self._m4l_interface.get_control
self.grab_control = self._m4l_interface.grab_control
self.release_control = self._m4l_interface.release_control
@listens('device')
def _on_device_changed(self):
pass
def disconnect(self):
self.log_message('<<<<<<<<<<<<<<<<<<<<<<<<< Minim log closed >>>>>>>>>>>>>>>>>>>>>>>>>')
super(Minim, self).disconnect()
def handle_sysex(self, midi_bytes):
#debug('sysex: ', str(midi_bytes))
#debug('matching:', midi_bytes[1:5], 'to', tuple([0, 1, 97] + [self._sysex_id]))
if len(midi_bytes)==9 and midi_bytes[1:5] == tuple([0, 1, 97] + [self._sysex_id]):
if not self._connected:
#debug('connecting from sysex...')
self._connected = True
self._initialize_hardware()
self._initialize_script()
示例14: PushBase
# 需要导入模块: from ableton.v2.control_surface.mode import ModesComponent [as 别名]
# 或者: from ableton.v2.control_surface.mode.ModesComponent import add_mode [as 别名]
#.........这里部分代码省略.........
self._mod_background = ModifierBackgroundComponent(is_root=True)
self._mod_background.layer = Layer(shift_button='shift_button', select_button='select_button', delete_button='delete_button', duplicate_button='duplicate_button', quantize_button='quantize_button')
def _create_background_layer(self):
return Layer(top_buttons='select_buttons', bottom_buttons='track_state_buttons', scales_button='scale_presets_button', octave_up='octave_up_button', octave_down='octave_down_button', side_buttons='side_buttons', repeat_button='repeat_button', accent_button='accent_button', double_button='double_button', param_controls='global_param_controls', param_touch='global_param_touch_buttons', touch_strip='touch_strip_control', nav_up_button='nav_up_button', nav_down_button='nav_down_button', nav_left_button='nav_left_button', nav_right_button='nav_right_button', aftertouch='aftertouch_control', _notification=self._notification.use_single_line(2), priority=consts.BACKGROUND_PRIORITY)
def _init_track_list(self):
pass
def _can_auto_arm_track(self, track):
routing = track.current_input_routing
return routing == 'Ext: All Ins' or routing == 'All Ins' or routing.startswith(self.input_target_name_for_auto_arm)
def _init_touch_strip_controller(self):
strip_controller = TouchStripControllerComponent()
strip_controller.set_enabled(False)
strip_controller.layer = Layer(touch_strip='touch_strip_control')
strip_controller.layer.priority = consts.DIALOG_PRIORITY
self._strip_connection = TouchStripEncoderConnection(strip_controller, self.elements.touch_strip_tap, is_root=True)
self.elements.tempo_control.set_observer(self._strip_connection)
self.elements.swing_control.set_observer(self._strip_connection)
self.elements.master_volume_control.set_observer(self._strip_connection)
for encoder in self.elements.global_param_controls.nested_control_elements():
encoder.set_observer(self._strip_connection)
self._pitch_mod_touch_strip = TouchStripPitchModComponent()
self._pitch_mod_touch_strip_layer = Layer(touch_strip='touch_strip_control', touch_strip_indication=self._with_firmware_version(1, 16, ComboElement('touch_strip_control', modifier='select_button')), touch_strip_toggle=self._with_firmware_version(1, 16, ComboElement('touch_strip_tap', modifier='select_button')))
def _create_session_mode(self):
raise NotImplementedError
def _create_slicing_modes(self):
slicing_modes = ModesComponent(name='Slicing_Modes', is_enabled=False)
slicing_modes.add_mode('64pads', [AddLayerMode(self._slicing_component, Layer(matrix='matrix')), LayerMode(self._pitch_mod_touch_strip, self._pitch_mod_touch_strip_layer)])
slicing_modes.add_mode('sequencer', [self._slice_step_sequencer, self._note_editor_settings_component, AddLayerMode(self._slicing_component, Layer(matrix=self.elements.matrix.submatrix[:4, 4:8], page_strip='touch_strip_control', scroll_strip=self._with_shift('touch_strip_control')))])
slicing_modes.selected_mode = '64pads'
return slicing_modes
def _init_matrix_modes(self):
self._auto_arm = AutoArmComponent(name='Auto_Arm')
self._auto_arm.can_auto_arm_track = self._can_auto_arm_track
self._auto_arm.layer = Layer(_notification=self._notification.use_single_line(2))
self._select_playing_clip = SelectPlayingClipComponent(name='Select_Playing_Clip', playing_clip_above_layer=Layer(action_button='nav_up_button'), playing_clip_below_layer=Layer(action_button='nav_down_button'))
self._select_playing_clip.layer = Layer(_notification=self._notification.use_single_line(2))
self._percussion_instrument_finder = PercussionInstrumentFinderComponent(device_parent=self.song.view.selected_track)
self.__on_percussion_instrument_changed.subject = self._percussion_instrument_finder
self._drum_modes = ModesComponent(name='Drum_Modes', is_enabled=False)
self._drum_modes.add_mode('sequencer', [self._drum_step_sequencer, self._note_editor_settings_component, AddLayerMode(self._drum_component, Layer(matrix=self.elements.matrix.submatrix[:4, 4:8]))])
self._drum_modes.add_mode('64pads', [AddLayerMode(self._drum_component, Layer(matrix='matrix'))])
self._drum_modes.selected_mode = 'sequencer'
self._slicing_modes = self._create_slicing_modes()
self._note_modes = ModesComponent(name='Note_Modes')
self._note_modes.add_mode('drums', [self._drum_component,
self._note_repeat_enabler,
self._accent_component,
self._drum_modes])
self._note_modes.add_mode('slicing', [self._slicing_component,
self._note_repeat_enabler,
self._accent_component,
self._slicing_modes])
self._note_modes.add_mode('looper', self._audio_loop if consts.PROTO_AUDIO_NOTE_MODE else self._matrix_background)
self._note_modes.add_mode('instrument', [self._note_repeat_enabler,
self._accent_component,
self._instrument,
self._scales_enabler])
self._note_modes.add_mode('disabled', self._matrix_background)
示例15: _create_slicing_modes
# 需要导入模块: from ableton.v2.control_surface.mode import ModesComponent [as 别名]
# 或者: from ableton.v2.control_surface.mode.ModesComponent import add_mode [as 别名]
def _create_slicing_modes(self):
slicing_modes = ModesComponent(name='Slicing_Modes', is_enabled=False)
slicing_modes.add_mode('64pads', [AddLayerMode(self._slicing_component, Layer(matrix='matrix')), LayerMode(self._pitch_mod_touch_strip, self._pitch_mod_touch_strip_layer)])
slicing_modes.add_mode('sequencer', [self._slice_step_sequencer, self._note_editor_settings_component, AddLayerMode(self._slicing_component, Layer(matrix=self.elements.matrix.submatrix[:4, 4:8], page_strip='touch_strip_control', scroll_strip=self._with_shift('touch_strip_control')))])
slicing_modes.selected_mode = '64pads'
return slicing_modes