本文整理汇总了Python中ableton.v2.control_surface.mode.ModesComponent.set_enabled方法的典型用法代码示例。如果您正苦于以下问题:Python ModesComponent.set_enabled方法的具体用法?Python ModesComponent.set_enabled怎么用?Python ModesComponent.set_enabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ableton.v2.control_surface.mode.ModesComponent
的用法示例。
在下文中一共展示了ModesComponent.set_enabled方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: OhmModes
# 需要导入模块: from ableton.v2.control_surface.mode import ModesComponent [as 别名]
# 或者: from ableton.v2.control_surface.mode.ModesComponent import set_enabled [as 别名]
class OhmModes(LividControlSurface):
_sysex_id = 2
_alt_sysex_id = 7
_model_name = 'Ohm'
_version_check = 'b996'
_host_name = 'Ohm'
def __init__(self, c_instance):
super(OhmModes, self).__init__(c_instance)
self._skin = Skin(OhmColors)
with self.component_guard():
self._define_sysex()
self._setup_controls()
self._setup_background()
self._setup_m4l_interface()
self._setup_translations()
self._setup_session_control()
self._setup_mixer_control()
self._setup_device_control()
self._setup_transport_control()
self._setup_drumgroup()
self._setup_keygroup()
self._setup_bassgroup()
self._setup_mod()
self._setup_modswitcher()
self._setup_modes()
self._on_device_changed.subject = self._device_provider
def _define_sysex(self):
#self._send_midi(tuple(switchxfader))
self._reverse_crossfader = SendLividSysexMode(self._livid_settings, call = 'reverse crossfader', message = [1])
def update_display(self):
super(OhmModes, self).update_display()
#self.strobe()
def _initialize_hardware(self):
super(OhmModes, self)._initialize_hardware()
#self._reverse_crossfader.enter_mode()
def _initialize_script(self):
super(OhmModes, self)._initialize_script()
self._main_modes.selected_mode = 'Mix'
self._session.update()
self._mixer.update()
def _setup_controls(self):
is_momentary = True
optimized = True
resource = PrioritizedResource
self._fader = [MonoEncoderElement(msg_type = MIDI_CC_TYPE, channel = CHANNEL, identifier = OHM_FADERS[index], name = 'Fader_' + str(index), num = index, script = self, optimized_send_midi = optimized, resource_type = resource) for index in range(8)]
self._button = [MonoButtonElement(is_momentary = is_momentary, msg_type = MIDI_NOTE_TYPE, channel = CHANNEL, identifier = OHM_BUTTONS[index], name = 'Button_' + str(index), script = self, skin = self._skin, optimized_send_midi = optimized, resource_type = resource) for index in range(8)]
self._dial = [MonoEncoderElement(msg_type = MIDI_CC_TYPE, channel = CHANNEL, identifier = OHM_DIALS[index], name = 'Encoder_' + str(index), num = index, script = self, optimized_send_midi = optimized, resource_type = resource) for index in range(16)]
self._menu = [MonoButtonElement(is_momentary = is_momentary, msg_type = MIDI_NOTE_TYPE, channel = CHANNEL, identifier = OHM_MENU[index], name = 'Menu_' + str(index), script = self, skin = self._skin, optimized_send_midi = optimized, resource_type = resource) for index in range(6)]
self._crossfader = MonoEncoderElement(msg_type = MIDI_CC_TYPE, channel = CHANNEL, identifier = CROSSFADER, name = 'Crossfader', script = self, optimized_send_midi = optimized, resource_type = resource)
self._livid = MonoButtonElement(is_momentary = is_momentary, msg_type = MIDI_NOTE_TYPE, channel = CHANNEL, identifier = LIVID, name = 'Livid_Button', skin = self._skin, script = self, optimized_send_midi = optimized, resource_type = resource)
self._shift_l = MonoButtonElement(is_momentary = is_momentary, msg_type = MIDI_NOTE_TYPE, channel = CHANNEL, identifier = SHIFT_L, name = 'Page_Button_Left', script = self, skin = self._skin, optimized_send_midi = optimized, resource_type = resource)
self._shift_r = MonoButtonElement(is_momentary = is_momentary, msg_type = MIDI_NOTE_TYPE, channel = CHANNEL, identifier = SHIFT_R, name = 'Page_Button_Right', script = self, skin = self._skin, optimized_send_midi = optimized, resource_type = resource)
self._grid = [[MonoButtonElement(is_momentary = is_momentary, msg_type = MIDI_NOTE_TYPE, channel = CHANNEL, identifier = column * 8 + row, name = 'Grid_' + str(column + (row*8)), script = self, skin = self._skin, optimized_send_midi = optimized, resource_type = resource) for column in range(8)] for row in range(8)]
self._matrix = ButtonMatrixElement(name = 'Matrix', rows = [[self._grid[row][column] for column in range(8)] for row in range(8)])
self._dial_matrix = ButtonMatrixElement(name = 'DialMatrix', rows = [self._dial[index*4:(index*4)+4] for index in range(4)])
self._menu_matrix = ButtonMatrixElement(name = 'MenuMatrix', rows = [self._menu])
self._fader_matrix = ButtonMatrixElement(name = 'FaderMatrix', rows = [self._fader])
self._button_matrix = ButtonMatrixElement(name = 'ButtonMatrix', rows = [self._button])
self._parameter_controls = ButtonMatrixElement(rows = [self._dial[:4], self._dial[4:8]])
def _setup_background(self):
self._background = BackgroundComponent(name = 'Background')
self._background.layer = Layer(priority = 3, matrix = self._matrix.submatrix[:,:],
livid_button = self._livid,
shift_l_button = self._shift_l,
shift_r_button = self._shift_r,
crossfader = self._crossfader,
dial_matrix = self._dial_matrix.submatrix[:,:],
menu_matrix = self._menu_matrix.submatrix[:,:],
fader_matrix = self._fader_matrix.submatrix[:,:],
button_matrix = self._button_matrix.submatrix[:,:])
self._background.set_enabled(False)
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
def _setup_translations(self):
controls = []
for array in self._grid:
#.........这里部分代码省略.........
示例2: Twister
# 需要导入模块: from ableton.v2.control_surface.mode import ModesComponent [as 别名]
# 或者: from ableton.v2.control_surface.mode.ModesComponent import set_enabled [as 别名]
class Twister(LividControlSurface):
__module__ = __name__
__doc__ = " Monomodular controller script for Livid CNTRLR "
_sysex_id = 8
_model_name = 'Twister'
_host_name = 'Twister'
_version_check = 'b996'
monomodular = None
device_provider_class = ModDeviceProvider
def __init__(self, *a, **k):
super(Twister, self).__init__(*a, **k)
self._skin = Skin(TwisterColors)
self._device_selection_follows_track_selection = True
with self.component_guard():
self._setup_monobridge()
self._setup_controls()
#self._define_sysex()
self._setup_background()
self._setup_m4l_interface()
self._setup_mod()
self._setup_device_control()
self._setup_modes()
self._on_device_changed.subject = self.song
self._on_selected_track_changed.subject = self.song.view
def _initialize_script(self):
super(Twister, self)._initialize_script()
self._connected = True
def _setup_controls(self):
is_momentary = True
optimized = True
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)
#.........这里部分代码省略.........
示例3: DS1
# 需要导入模块: from ableton.v2.control_surface.mode import ModesComponent [as 别名]
# 或者: from ableton.v2.control_surface.mode.ModesComponent import set_enabled [as 别名]
class DS1(LividControlSurface):
_sysex_id = 16
_model_name = 'DS1'
def __init__(self, c_instance):
super(DS1, self).__init__(c_instance)
self._skin = Skin(DS1Colors)
with self.component_guard():
self._define_sysex()
self._setup_controls()
self._setup_background()
self._setup_m4l_interface()
self._setup_session_control()
self._setup_mixer_control()
self._setup_transport_control()
self._setup_device_control()
self._setup_session_recording_component()
self._setup_main_modes()
def _initialize_script(self):
super(DS1, self)._initialize_script()
self._main_modes.set_enabled(True)
self._main_modes.selected_mode = 'Main'
def _initialize_hardware(self):
super(DS1, self)._initialize_hardware()
self.local_control_off.enter_mode()
self.encoder_absolute_mode.enter_mode()
self.encoder_speed_sysex.enter_mode()
def _define_sysex(self):
self.encoder_speed_sysex = SendLividSysexMode(livid_settings = self._livid_settings, call = 'set_encoder_mapping', message = ENCODER_SPEED)
self.encoder_absolute_mode = SendLividSysexMode(livid_settings = self._livid_settings, call = 'set_encoder_encosion_mode', message = [2])
self.local_control_off = SendLividSysexMode(livid_settings = self._livid_settings, call = 'set_local_control', message = [0])
def _setup_controls(self):
is_momentary = True
optimized = True
resource = PrioritizedResource
self._fader = [MonoEncoderElement(mapping_feedback_delay = -1, msg_type = MIDI_CC_TYPE, channel = CHANNEL, identifier = DS1_FADERS[index], name = 'Fader_' + str(index), num = index, script = self, optimized_send_midi = optimized, resource_type = resource) for index in range(8)]
self._dial = [[MonoEncoderElement(mapping_feedback_delay = -1, msg_type = MIDI_CC_TYPE, channel = CHANNEL, identifier = DS1_DIALS[x][y], name = 'Dial_' + str(x) + '_' + str(y), num = x + (y*5), script = self, optimized_send_midi = optimized, resource_type = resource) for x in range(8)] for y in range(5)]
self._side_dial = [MonoEncoderElement(mapping_feedback_delay = -1, msg_type = MIDI_CC_TYPE, channel = CHANNEL, identifier = DS1_SIDE_DIALS[x], name = 'Side_Dial_' + str(x), num = x, script = self, optimized_send_midi = optimized, resource_type = resource) for x in range(4)]
self._encoder = [MonoEncoderElement(mapping_feedback_delay = -1, msg_type = MIDI_CC_TYPE, channel = CHANNEL, identifier = DS1_ENCODERS[x], name = 'Encoder_' + str(x), num = x, script = self, optimized_send_midi = optimized, resource_type = resource) for x in range(4)]
self._encoder_button = [MonoButtonElement(is_momentary = is_momentary, msg_type = MIDI_NOTE_TYPE, channel = CHANNEL, identifier = DS1_ENCODER_BUTTONS[index], name = 'EncoderButton_' + str(index), script = self, skin = self._skin, optimized_send_midi = optimized, resource_type = resource) for index in range(4)]
self._master_fader = MonoEncoderElement(msg_type = MIDI_CC_TYPE, channel = CHANNEL, identifier = DS1_MASTER, name = 'MasterFader', num = 0, script = self, optimized_send_midi = optimized, resource_type = resource)
self._button = [MonoButtonElement(is_momentary = is_momentary, msg_type = MIDI_NOTE_TYPE, channel = CHANNEL, identifier = DS1_BUTTONS[index], name = 'Button_' + str(index), script = self, skin = self._skin, optimized_send_midi = optimized, resource_type = resource) for index in range(16)]
self._grid = [[MonoButtonElement(is_momentary = is_momentary, msg_type = MIDI_NOTE_TYPE, channel = CHANNEL, identifier = DS1_GRID[x][y], name = 'Button_' + str(x) + '_' + str(y), script = self, skin = self._skin, optimized_send_midi = optimized, resource_type = resource) for x in range(3)] for y in range(3)]
self._dummy = [MonoEncoderElement(msg_type = MIDI_CC_TYPE, channel = CHANNEL, identifier = 120+x, name = 'Dummy_Dial_' + str(x), num = x, script = self, optimized_send_midi = optimized, resource_type = resource) for x in range(5)]
self._fader_matrix = ButtonMatrixElement(name = 'FaderMatrix', rows = [self._fader])
self._top_buttons = ButtonMatrixElement(name = 'TopButtonMatrix', rows = [self._button[:8]])
self._bottom_buttons = ButtonMatrixElement(name = 'BottomButtonMatrix', rows = [self._button[8:]])
self._dial_matrix = ButtonMatrixElement(name = 'DialMatrix', rows = self._dial)
self._side_dial_matrix = ButtonMatrixElement(name = 'SideDialMatrix', rows = [self._side_dial])
self._encoder_matrix = ButtonMatrixElement(name = 'EncoderMatrix', rows = [self._encoder])
self._encoder_button_matrix = ButtonMatrixElement(name = 'EncoderButtonMatrix', rows = [self._encoder_button])
self._grid_matrix = ButtonMatrixElement(name = 'GridMatrix', rows = self._grid)
self._selected_parameter_controls = ButtonMatrixElement(name = 'SelectedParameterControls', rows = [self._dummy + self._encoder[:1] + self._encoder[2:]])
def _setup_background(self):
self._background = BackgroundComponent(name = 'Background')
self._background.layer = Layer(priority = 0, fader_matrix = self._fader_matrix,
top_buttons = self._top_buttons,
bottom_buttons = self._bottom_buttons,
dial_matrix = self._dial_matrix,
side_dial_matrix = self._side_dial_matrix,
encoder_button_matrix = self._encoder_button_matrix,
grid_matrix = self._grid_matrix)
self._background.set_enabled(True)
def _setup_autoarm(self):
self._auto_arm = AutoArmComponent(name='Auto_Arm')
self._auto_arm.can_auto_arm_track = self._can_auto_arm_track
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])
#.........这里部分代码省略.........
示例4: Push
# 需要导入模块: from ableton.v2.control_surface.mode import ModesComponent [as 别名]
# 或者: from ableton.v2.control_surface.mode.ModesComponent import set_enabled [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):
示例5: Codec
# 需要导入模块: from ableton.v2.control_surface.mode import ModesComponent [as 别名]
# 或者: from ableton.v2.control_surface.mode.ModesComponent import set_enabled [as 别名]
class Codec(LividControlSurface):
_sysex_id = 4
_model_name = 'Code'
_host_name = 'Codec'
_version_check = 'b996'
monomodular = None
def __init__(self, c_instance, *a, **k):
self.log_message = logger.warning
super(Codec, self).__init__(c_instance, *a, **k)
self._locked = False
self._shift_button = None
self._device_selection_follows_track_selection=FOLLOW
self._leds_last = 0
self._shift_latching = LatchingShiftedBehaviour if SHIFT_LATCHING else ShiftedBehaviour
self._skin = Skin(CodecColors)
with self.component_guard():
self._define_sysex()
self._setup_controls()
self._setup_background()
self._setup_mixer_controls()
self._setup_device_navigator()
self._setup_device_controls()
self._setup_special_device_control()
self._setup_device_chooser()
self._setup_device_selector()
self._setup_send_reset()
self._setup_default_buttons()
self._setup_shift_modes()
self._setup_mod()
self._setup_modswitcher()
self._setup_modes()
self._setup_m4l_interface()
self._background.set_enabled(True)
def _initialize_hardware(self):
super(Codec, self)._initialize_hardware()
def _initialize_script(self):
super(Codec, self)._initialize_script()
self._on_device_changed.subject = self._device_provider
self._main_modes.set_enabled(True)
self._main_modes.selected_mode = 'mix'
def _define_sysex(self):
self.fast_encoder_sysex = SendLividSysexMode(livid_settings = self._livid_settings, call = 'set_encoder_speed', message = FAST_ENCODER_MSG)
self.normal_encoder_sysex = SendLividSysexMode(livid_settings = self._livid_settings, call = 'set_encoder_speed', message = NORMAL_ENCODER_MSG)
self.slow_encoder_sysex = SendLividSysexMode(livid_settings = self._livid_settings, call = 'set_encoder_speed', message = SLOW_ENCODER_MSG)
def _setup_controls(self):
is_momentary = True
optimized = False
resource = PrioritizedResource
self._livid = DoublePressElement(MonoButtonElement(is_momentary = is_momentary, msg_type = MIDI_NOTE_TYPE, channel = CHANNEL, identifier = LIVID, name = 'Livid_Button', script = self, skin = self._skin, color_map = COLOR_MAP, optimized_send_midi = optimized, resource_type = resource, monobridge = self._monobridge))
self._dial = [[CodecEncoderElement(msg_type = MIDI_CC_TYPE, channel = CHANNEL, identifier = CODE_DIALS[row][column], name = 'Dial_' + str(column) + '_' + str(row), num = (column + (row*8)), script = self, optimized_send_midi = optimized, resource_type = resource, monobridge = self._monobridge) for row in range(4)] for column in range(8)]
self._button = [[MonoButtonElement(is_momentary = is_momentary, msg_type = MIDI_NOTE_TYPE, channel = CHANNEL, identifier = CODE_BUTTONS[row][column], name = 'Button_' + str(column) + '_' + str(row), script = self, skin = self._skin, color_map = COLOR_MAP, optimized_send_midi = optimized, resource_type = resource, monobridge = self._monobridge) for row in range(4)] for column in range(8)]
self._column_button = [MonoButtonElement(is_momentary = is_momentary, msg_type = MIDI_NOTE_TYPE, channel = CHANNEL, identifier = CODE_COLUMN_BUTTONS[index], name = 'Column_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(8)]
self._row_button = [MonoButtonElement(is_momentary = is_momentary, msg_type = MIDI_NOTE_TYPE, channel = CHANNEL, identifier = CODE_ROW_BUTTONS[index], name = 'Row_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(4)]
self._code_keys = ButtonMatrixElement(name = 'Code_Keys', rows = [self._column_button])
self._code_buttons = ButtonMatrixElement(name = 'Code_Buttons', rows = [self._row_button])
self._encoder_matrix = ButtonMatrixElement(name = 'Encoder_Matrix', rows = [[self._dial[column][row] for column in range(8)] for row in range(4)])
self._button_matrix = ButtonMatrixElement(name = 'Button_Matrix', rows = [[self._button[column][row] for column in range(8)] for row in range(4)])
def _setup_background(self):
self._background = BackgroundComponent()
self._background.layer = Layer(priority = 3, matrix = self._button_matrix, encoders = self._encoder_matrix, livid = self._livid, buttons = self._code_buttons, keys = self._code_keys)
self._background.set_enabled(False)
def _setup_transport_control(self):
self._transport = TransportComponent()
self._transport.name = 'Transport'
self._transport.set_enabled(False)
def _setup_mixer_controls(self):
self._session_ring = SessionRingComponent(name = 'Session_Ring', num_tracks = 8, num_scenes = 0)
self._session_navigation = SessionNavigationComponent(name = 'Session_Navigation', session_ring = self._session_ring)
self._session_navigation.layer = Layer(priority = 4, left_button = self._button[6][0], right_button = self._button[7][0])
self._session_navigation.set_enabled(False)
#self._session = SessionComponent(name = 'Session', session_ring = self._session_ring)
self._mixer = CodecMixerComponent(num_returns = 4, name = 'Mixer', tracks_provider = self._session_ring, invert_mute_feedback = True, auto_name = True)
self._mixer._mix_layer = AddLayerMode(self._mixer, Layer(priority = 4, volume_controls = self._encoder_matrix.submatrix[:8,3],
pan_controls = self._encoder_matrix.submatrix[:8,2],
send_controls = self._encoder_matrix.submatrix[:8, :2],
))
self._mixer._solo_mute_layer = AddLayerMode(self._mixer, Layer(priority = 4, solo_buttons = self._button_matrix.submatrix[:8,2],
mute_buttons = self._button_matrix.submatrix[:8,3],
))
self._mixer._select_layer = AddLayerMode(self._mixer, Layer(priority = 4, track_select_buttons = self._code_keys))
self._mixer._sends_layer = AddLayerMode(self._mixer, Layer(priority = 4, send_controls = self._encoder_matrix.submatrix[:, :]))
self._mixer.set_enabled(False)
#.........这里部分代码省略.........
示例6: Cntrlr
# 需要导入模块: from ableton.v2.control_surface.mode import ModesComponent [as 别名]
# 或者: from ableton.v2.control_surface.mode.ModesComponent import set_enabled [as 别名]
class Cntrlr(BaseCntrlr):
def __init__(self, *a, **k):
super(Cntrlr, self).__init__(*a, **k)
self._skin = Skin(CntrlrColors)
for button in self._grid:
button._skin = self._skin
def _open_log(self):
self.log_message("<<<<<<<<<<<<<<<<<<<<= " + str(self._host_name) + " for Georg Oswald " + str(self._version_check) + " log opened =>>>>>>>>>>>>>>>>>>>")
self.show_message(str(self._host_name) + ' Control Surface Loaded')
def _setup_transport_control(self):
super(Cntrlr, self)._setup_transport_control()
self._transport._overdub_toggle.view_transform = lambda value: 'Transport.OverdubOn' if value else 'Transport.OverdubOff'
self._transport.layer = Layer(priority = 4,
play_button = self._button[24])
self._transport.overdub_layer = AddLayerMode(self._transport, Layer(priority = 4,
overdub_button = self._button[25]))
def _setup_session_control(self):
super(Cntrlr, self)._setup_session_control()
self._session_navigation.nav_layer = AddLayerMode(self._session_navigation, Layer(priority = 4,
page_down_button = self._button[22],
page_up_button = self._button[23],
page_left_button = self._button[20],
page_right_button = self._button[21]))
self._session.stop_clips_layer = AddLayerMode(self._session, Layer(priority = 4,
stop_all_clips_button = self._button[29],))
def _setup_session_recording_component(self):
super(Cntrlr, self)._setup_session_recording_component()
self._recorder.main_layer = AddLayerMode(self._recorder, Layer(priority = 4))
self._recorder.shift_layer = AddLayerMode(self._recorder, Layer(priority = 4, automation_button = self._button[25]))
def _setup_mixer_control(self):
super(Cntrlr, self)._setup_mixer_control()
mute_buttons = ButtonMatrixElement(name = 'mute_buttons', rows = [self._button[:4] + self._button[12:16]])
select_buttons = ButtonMatrixElement(name = 'select_buttons', rows = [self._button[16:20] + self._button[28:32]])
self._G_session_ring = SessionRingComponent(num_tracks = 8, num_scenes = 4)
self._G_session_ring.set_enabled(False)
self._G_mixer = MonoMixerComponent(name = 'Mixer', num_returns = 4,tracks_provider = self._G_session_ring, track_assigner = simple_track_assigner, invert_mute_feedback = True, auto_name = True, enable_skinning = True)
if FREE_ENCODER_IS_CROSSFADER:
self._mixer.layer = Layer(priority = 4, crossfader_control = self._encoder[1])
#self._G_mixer.select_dial_layer = AddLayerMode(self._G_mixer, Layer(priority = 5,
# track_select_dial = self._encoder[3],))
self._G_mixer.main_faders_layer = AddLayerMode(self._G_mixer, Layer(priority = 4,
volume_controls = self._fader_matrix.submatrix[:8, :],))
self._G_mixer.main_buttons_layer = AddLayerMode(self._G_mixer, Layer(priority = 4,
mute_buttons = mute_buttons,
arming_track_select_buttons = select_buttons,
solo_buttons = self._key_matrix.submatrix[4:12, :1],))
self._G_mixer.shifted_buttons_layer = AddLayerMode(self._G_mixer, Layer(priority = 4,
mute_buttons = mute_buttons,))
self._G_mixer.solo_buttons_layer = AddLayerMode(self._G_mixer, Layer(priority = 4,
solo_buttons = self._key_matrix.submatrix[4:12, :1],))
self._G_mixer.mute_buttons_layer = AddLayerMode(self._G_mixer, Layer(priority = 4,
mute_buttons = mute_buttons,))
self._G_mixer.stop_layer = AddLayerMode(self._G_mixer, Layer(priority = 4,
stop_clip_buttons = self._key_matrix.submatrix[8:12, 1:],))
self._G_mixer.main_knobs_layer = AddLayerMode(self._G_mixer, Layer(priority = 4))
self._G_mixer.master_fader_layer = AddLayerMode(self._G_mixer.master_strip(), Layer(priority = 4,))
self._G_mixer.instrument_buttons_layer = AddLayerMode(self._G_mixer, Layer(priority = 4,
mute_buttons = mute_buttons,
track_select_buttons = select_buttons,))
self._G_mixer.set_enabled(False)
def _setup_device_control(self):
super(Cntrlr, self)._setup_device_control()
self._device_navigator.main_layer = AddLayerMode(self._device_navigator, Layer(priority = 4,
prev_button = self._encoder_button[8],
next_button = self._encoder_button[9],
exit_button = self._encoder_button[10],
enter_button = self._encoder_button[11],))
def _setup_instrument(self):
self._grid_resolution = self.register_disconnectable(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 = CntrlrMonoInstrumentComponent(name = 'InstrumentComponent', is_enabled = True, script = self, skin = self._skin, grid_resolution = self._grid_resolution, drum_group_finder = self._drum_group_finder, parent_task_group = self._task_group, settings = DEFAULT_INSTRUMENT_SETTINGS, device_provider = self._device_provider)
self._instrument.shift_button_layer = AddLayerMode(self._instrument, Layer(priority = 5, session_mode_button = self._button[26], shift_mode_button = self._button[27]))
self._instrument.audioloop_layer = AddLayerMode(self._instrument, Layer(priority = 5))
#.........这里部分代码省略.........
示例7: MonoPedal
# 需要导入模块: from ableton.v2.control_surface.mode import ModesComponent [as 别名]
# 或者: from ableton.v2.control_surface.mode.ModesComponent import set_enabled [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)
#.........这里部分代码省略.........
示例8: Minim
# 需要导入模块: from ableton.v2.control_surface.mode import ModesComponent [as 别名]
# 或者: from ableton.v2.control_surface.mode.ModesComponent import set_enabled [as 别名]
class Minim(LividControlSurface):
_sysex_id = 18
_model_name = 'Minim'
def __init__(self, c_instance, *a, **k):
super(Minim, self).__init__(c_instance, *a, **k)
self._shift_latching = LatchingShiftedBehaviour if SHIFT_LATCHING else ShiftedBehaviour
self._skin = Skin(MinimColors)
with self.component_guard():
self._define_sysex()
self._setup_monobridge()
self._setup_controls()
self._setup_background()
self._setup_autoarm()
self._setup_viewcontrol()
self._setup_session()
self._setup_mixer()
self._setup_transport()
self._setup_recorder()
self._setup_instrument()
self._setup_modes()
self._setup_m4l_interface()
self.log_message('<<<<<<<<<<<<<<<<<<<<<<<<< Minim log opened >>>>>>>>>>>>>>>>>>>>>>>>>')
self.show_message('Minim Control Surface Loaded')
self._background.set_enabled(True)
def _check_connection(self):
if not self._connected:
debug(self._model_name, '_check_connection')
self._livid_settings.new_query_surface()
#self._connection_routine.restart()
self.schedule_message(5, self._check_connection)
def _initialize_hardware(self):
debug('sending local control off')
self.local_control_off.enter_mode()
def _initialize_script(self):
self._on_device_changed.subject = self._device_provider
self._main_modes.set_enabled(True)
self._main_modes.selected_mode = 'session'
self._session_ring._update_highlight()
self.refresh_state()
def _setup_controls(self):
is_momentary = True
optimized = False
resource = PrioritizedResource
self._fader = MonoEncoderElement(msg_type = MIDI_CC_TYPE, channel = CHANNEL, identifier = MINIM_SLIDER, name = 'Fader', script = self, mapping_feedback_delay = -1, optimized_send_midi = optimized, resource_type = resource)
self._pad = [[MonoButtonElement(is_momentary = is_momentary, msg_type = MIDI_NOTE_TYPE, channel = CHANNEL, identifier = MINIM_PADS[row][column], name = 'Pad_' + str(column) + '_' + str(row), script = self, skin = self._skin, color_map = COLOR_MAP, optimized_send_midi = optimized, resource_type = resource) for column in range(4)] for row in range(2)]
self._button = [[MonoButtonElement(is_momentary = is_momentary, msg_type = MIDI_NOTE_TYPE, channel = CHANNEL, identifier = MINIM_BUTTONS[row][column], name = 'Button_' + str(column) + '_' + str(row), script = self, skin = self._skin, color_map = COLOR_MAP, optimized_send_midi = optimized, resource_type = resource) for column in range(4)] for row in range(2)]
self._side_button = [MonoButtonElement(is_momentary = is_momentary, msg_type = MIDI_NOTE_TYPE, channel = CHANNEL, identifier = MINIM_SIDE_BUTTONS[index], name = 'Side_Button_' + str(index), script = self, skin = self._skin, color_map = COLOR_MAP, optimized_send_midi = optimized, resource_type = resource) for index in range(5)]
self._top_button = [MonoButtonElement(is_momentary = is_momentary, msg_type = MIDI_NOTE_TYPE, channel = CHANNEL, identifier = MINIM_TOP_BUTTONS[index], name = 'Top_Button_' + str(index), script = self, skin = self._skin, color_map = COLOR_MAP, optimized_send_midi = optimized, resource_type = resource) for index in range(2)]
self._bottom_button = MonoButtonElement(is_momentary = is_momentary, msg_type = MIDI_NOTE_TYPE, channel = CHANNEL, identifier = MINIM_BOTTOM_BUTTON, name = 'Bottom_Button', script = self, skin = self._skin, color_map = COLOR_MAP, optimized_send_midi = optimized, resource_type = resource)
self._matrix = ButtonMatrixElement(name = 'Pad_Matrix', rows = [self._button[:][0], self._pad[:][0], self._pad[:][1],self._button[:][1]])
self._side_button_matrix = ButtonMatrixElement(name = 'Side_Button_Matrix', rows = [self._side_button])
self._top_button_matrix = ButtonMatrixElement(name = 'Button_Matrix', rows = [self._top_button])
def _setup_background(self):
self._background = BackgroundComponent()
self._background.layer = Layer(priority = 3, matrix = self._matrix.submatrix[:,:], side_buttons = self._side_button_matrix, top_buttons = self._top_button_matrix.submatrix[:,:], bottom_button = self._bottom_button)
self._background.set_enabled(False)
def _define_sysex(self):
self._livid_settings = LividSettings(model = 18, control_surface = self)
self.local_control_off = SendLividSysexMode(livid_settings = self._livid_settings, call = 'set_local_control', message = [42, 42])
def _setup_autoarm(self):
self._auto_arm = AutoArmComponent(name='Auto_Arm')
self._auto_arm.can_auto_arm_track = self._can_auto_arm_track
self._auto_arm._update_notification = lambda: None
def _setup_viewcontrol(self):
self._viewcontrol = ViewControlComponent()
self._viewcontrol.layer = Layer(priority = 4, prev_track_button = self._top_button[0], next_track_button = self._top_button[1])
self._viewcontrol.set_enabled(False)
def _setup_transport(self):
self._transport = TransportComponent(name = 'Transport')
self._transport.layer = Layer(priority = 4, play_button = self._side_button[0]) #, overdub_button = self._side_button[1])
self._transport.set_enabled(False)
def _setup_mixer(self):
self._mixer = MonoMixerComponent(name = 'Mixer',tracks_provider = self._session_ring, track_assigner = simple_track_assigner, invert_mute_feedback = True, auto_name = True, enable_skinning = True)
self._mixer._selected_strip.layer = Layer(priority = 4, volume_control = self._fader)
self._mixer.solo_mute_record_stop_layer = AddLayerMode(self._mixer, Layer(priority = 4,
#.........这里部分代码省略.........
示例9: PushBase
# 需要导入模块: from ableton.v2.control_surface.mode import ModesComponent [as 别名]
# 或者: from ableton.v2.control_surface.mode.ModesComponent import set_enabled [as 别名]
#.........这里部分代码省略.........
def port_settings_changed(self):
self._switch_to_live_mode()
def _switch_to_live_mode(self):
self._user.mode = sysex.LIVE_MODE
self._user.force_send_mode()
def _init_settings(self):
self._settings = self._create_settings()
def _create_settings(self):
raise RuntimeError
def update(self):
self.__on_session_record_changed()
self.reset_controlled_track()
self.set_feedback_channels(FEEDBACK_CHANNELS)
super(PushBase, self).update()
def _create_controls(self):
raise NotImplementedError
def _with_shift(self, button):
return ComboElement(button, modifier='shift_button')
def _with_firmware_version(self, major_version, minor_version, control_element):
raise NotImplementedError
def _init_background(self):
self._background = BackgroundComponent(is_root=True)
self._background.layer = self._create_background_layer()
self._matrix_background = BackgroundComponent()
self._matrix_background.set_enabled(False)
self._matrix_background.layer = Layer(matrix='matrix')
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