本文整理汇总了Python中_Mono_Framework.MonoBridgeElement.MonoBridgeElement类的典型用法代码示例。如果您正苦于以下问题:Python MonoBridgeElement类的具体用法?Python MonoBridgeElement怎么用?Python MonoBridgeElement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MonoBridgeElement类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: DS1
class DS1(ControlSurface):
__module__ = __name__
__doc__ = " DS1 controller script "
def __init__(self, c_instance):
super(DS1, self).__init__(c_instance)
self._connected = False
self._host_name = "DS1"
self.oscServer = None
self._rgb = 0
self._timer = 0
self.flash_status = 1
self._touched = 0
self._update_linked_device_selection = None
self._skin = Skin(DS1Colors)
with self.component_guard():
self._setup_monobridge()
self._setup_controls()
self._setup_m4l_interface()
self._define_sysex()
self._initialize_hardware()
self._setup_mixer_control()
self._setup_session_control()
self._setup_transport_control()
self._setup_device_control()
self._setup_session_recording_component()
# self._setup_translations()
self._setup_main_modes()
# self._device.add_device_listener(self._on_new_device_set)
self.log_message("<<<<<<<<<<<<<<<<<= DS1 log opened =>>>>>>>>>>>>>>>>>>>>>")
# self.schedule_message(3, self._initialize_hardware)
"""script initialization methods"""
def _initialize_hardware(self):
self.local_control_off.enter_mode()
self.encoder_absolute_mode.enter_mode()
self.encoder_speed_sysex.enter_mode()
def _check_connection(self):
if not self._connected:
self._send_midi(QUERYSURFACE)
self.schedule_message(100, self._check_connection)
def _setup_monobridge(self):
self._monobridge = MonoBridgeElement(self)
self._monobridge.name = "MonoBridge"
def _setup_controls(self):
is_momentary = True
self._fader = [
MonoEncoderElement(
MIDI_CC_TYPE,
CHANNEL,
DS1_FADERS[index],
Live.MidiMap.MapMode.absolute,
"Fader_" + str(index),
index,
self,
)
for index in range(8)
]
for fader in self._fader:
fader._mapping_feedback_delay = -1
self._dial = [
[
MonoEncoderElement(
MIDI_CC_TYPE,
CHANNEL,
DS1_DIALS[x][y],
Live.MidiMap.MapMode.absolute,
"Dial_" + str(x) + "_" + str(y),
x + (y * 5),
self,
)
for x in range(8)
]
for y in range(5)
]
for row in self._dial:
for dial in row:
dial._mapping_feedback_delay = -1
self._side_dial = [
MonoEncoderElement(
MIDI_CC_TYPE, CHANNEL, DS1_SIDE_DIALS[x], Live.MidiMap.MapMode.absolute, "Side_Dial_" + str(x), x, self
)
for x in range(4)
]
for dial in self._side_dial:
dial._mapping_feedback_delay = -1
self._encoder = [
MonoEncoderElement(
MIDI_CC_TYPE, CHANNEL, DS1_ENCODERS[x], Live.MidiMap.MapMode.absolute, "Encoder_" + str(x), x, self
)
for x in range(4)
]
for encoder in self._encoder:
encoder._mapping_feedback_delay = -1
self._encoder_button = [
MonoButtonElement(
#.........这里部分代码省略.........
示例2: _setup_monobridge
def _setup_monobridge(self):
self._monobridge = MonoBridgeElement(self)
self._monobridge.name = "MonoBridge"
示例3: BlockMod
class BlockMod(MonOhm):
__module__ = __name__
__doc__ = " Monomodular controller script for Livid Block "
def __init__(self, *a, **k):
self._shift_button = None
self._shift_pressed = 0
self._shift_pressed_timer = 0
self._shift_thresh = SHIFT_THRESH
super(BlockMod, self).__init__(*a, **k)
self._host_name = 'BlockMod'
self._color_type = 'Monochrome'
self._link_mixer = LINK_MIXER
self._rgb = 1
self._ohm = 127
self._ohm_type = 'static'
self._pad_translations = PAD_TRANSLATION
self._mem = [4, 8, 12, 16]
self._host._navbox_selected = 8
"""script initialization methods"""
def _setup_monobridge(self):
self._monobridge = MonoBridgeElement(self)
self._monobridge.name = 'MonoBridge'
def _setup_controls(self):
is_momentary = True
self._fader = [None for index in range(8)]
self._dial = [None for index in range(16)]
self._button = [None for index in range(8)]
self._menu = [None for index in range(6)]
for index in range(2):
self._fader[index] = MonoEncoderElement(MIDI_CC_TYPE, CHANNEL, SLIDER_CC[index], Live.MidiMap.MapMode.absolute, 'Fader_' + str(index), index, self)
#for index in range(8):
# self._button[index] = MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, OHM_BUTTONS[index], 'Button_' + str(index), self)
for index in range(8):
self._dial[index] = MonoEncoderElement(MIDI_CC_TYPE, CHANNEL, KNOB_CC[index], Live.MidiMap.MapMode.absolute, 'Dial_' + str(index), index + 8, self)
for index in range(4):
self._menu[index] = MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, FUNCTION_NOTES[index], 'Menu_' + str(index), self)
self._livid = MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, LIVID, 'Livid_Button', self)
self._shift_l = MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, SHIFT_L, 'Shift_Button_Left', self)
self._shift_r = MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, SHIFT_R, 'Shift_Button_Right', self)
self._matrix = ButtonMatrixElement()
self._matrix.name = 'Matrix'
self._monomod = ButtonMatrixElement()
self._monomod.name = 'Monomod'
self._grid = [None for index in range(8)]
for column in range(8):
self._grid[column] = [None for index in range(8)]
for row in range(8):
self._grid[column][row] = MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, (column * 8) + row, 'Grid_' + str(column) + '_' + str(row), self)
for row in range(5):
button_row = []
for column in range(7):
button_row.append(self._grid[column][row])
self._matrix.add_row(tuple(button_row))
for row in range(8):
button_row = []
for column in range(8):
button_row.append(self._grid[column][row])
self._monomod.add_row(tuple(button_row))
self._dummy_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 15, 125)
self._dummy_button.name = 'Dummy1'
self._dummy_button2 = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 15, 126)
self._dummy_button2.name = 'Dummy2'
self._dummy_button3 = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 15, 127)
self._dummy_button2.name = 'Dummy3'
def _setup_transport_control(self):
self._transport = TransportComponent()
self._transport.name = 'Transport'
def _setup_crossfader(self):
pass
def _setup_modes(self):
self._monomod_mode = MonomodModeComponent(self, self.monomod_mode_update)
self._monomod_mode.name = 'Monomod_Mode'
self.set_shift_button(self._livid)
self._shift_mode = BlockModShiftModeComponent(self, self.shift_update)
self._shift_mode.name = 'Shift_Mode'
self._shift_mode.set_mode_toggle(self._shift_l, self._shift_r)
self._l_function_mode = FunctionModeComponent(self, self.l_function_update)
self._l_function_mode.name = 'Left_Function_Mode'
self._r_function_mode = FunctionModeComponent(self, self.r_function_update)
self._r_function_mode.name = 'Right_Function_Mode'
self._m_function_mode = FunctionModeComponent(self, self.m_function_update)
self._m_function_mode.name = 'Main_Function_Mode'
self._function_modes = [self._l_function_mode, self._r_function_mode, self._m_function_mode]
"""livid double press mechanism"""
def set_shift_button(self, button):
#.........这里部分代码省略.........
示例4: Codec
class Codec(ControlSurface):
__module__ = __name__
__doc__ = " MonoCode controller script "
def __init__(self, c_instance, *a, **k):
super(Codec, self).__init__(c_instance, *a, **k)
self._monomod_version = 'b995'
self._version_check = 'b995'
self._host_name = 'Codec'
self._color_type = 'Monochrome'
self._link_mixer = LINK_MIXER
self._hosts = []
self._linked_script = None
self._local_ring_control = True
self._last_device = None
self._device_list = [None, None, None, None]
self._device_select_buttons = None
self._last_device_component = None
self._timer = 0
self._touched = 0
self._locked = False
self.flash_status = 1
self._shift_button = None
self._shift_pressed = 0
self._shift_pressed_timer = 0
self._shift_thresh = SHIFT_THRESH
self._use_device_selector = USE_DEVICE_SELECTOR
self._device_selection_follows_track_selection=FOLLOW
with self.component_guard():
#self.local_ring_control(True)
#self.set_absolute_mode(True)
self._setup_controls()
self._setup_monobridge()
self._setup_device_controls()
self._setup_special_device_control()
self._device.append(self._special_device) #necessary for device browsing to work with special device
self._setup_device_chooser()
self._setup_mixer_controls()
self._setup_monomod()
self._setup_modes()
self._setup_device_selector()
self._setup_send_reset()
self._setup_default_buttons()
self.set_local_ring_control(1)
self.song().view.add_selected_track_listener(self._update_selected_device)
self._initialize_code()
#self._shift_mode.set_mode(0)
#self._monomod_mode.set_mode(0)
self.log_message('<<<<<<<<<<<<<<<<<<<<<<<<< Codec ' + str(self._monomod_version) + ' log opened >>>>>>>>>>>>>>>>>>>>>>>>>')
self.show_message('Codec Control Surface Loaded')
self.request_rebuild_midi_map()
"""script initialization methods"""
def _initialize_code(self):
self._send_midi(factoryreset)
self._send_midi(btn_channels)
self._send_midi(enc_channels)
def _setup_monobridge(self):
self._monobridge = MonoBridgeElement(self)
self._monobridge.name = 'MonoBridge'
def _setup_controls(self):
is_momentary = True
self._livid = CodecMonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, LIVID, 'Livid_Button', self)
self._dial = [None for index in range(8)]
for column in range(8):
self._dial[column] = [None for index in range(4)]
for row in range(4):
self._dial[column][row] = CodecEncoderElement(MIDI_CC_TYPE, CHANNEL, CODE_DIALS[row][column], Live.MidiMap.MapMode.absolute, 'Dial_' + str(column) + '_' + str(row), (column + (row*8)), self) #CODE_DIALS[row][column]
self._button = [None for index in range(8)]
for column in range(8):
self._button[column] = [None for index in range(4)]
for row in range(4):
self._button[column][row] = CodecMonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, CODE_BUTTONS[row][column], 'Button_' + str(column) + '_' + str(row), self)
self._column_button = [None for index in range(8)]
for index in range(8):
self._column_button[index] = CodecMonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, CODE_COLUMN_BUTTONS[index], 'Column_Button_' + str(index), self)
self._row_button = [None for index in range(4)]
for index in range(4):
self._row_button[index] = CodecMonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, CODE_ROW_BUTTONS[index], 'Row_Button_' + str(index), self)
self._dial_matrix = EncoderMatrixElement(self)
self._dial_matrix.name = 'Encoder_Matrix'
for row in range(4):
dial_row = tuple([self._dial[column][row] for column in range(8)])
self._dial_matrix.add_row(dial_row)
self._button_matrix = ButtonMatrixElement()
self._button_matrix.name = 'Button_Matrix'
#.........这里部分代码省略.........
示例5: AumPC40
#.........这里部分代码省略.........
self._overdub_button = self._device_bank_buttons[6]
self._metronome_button = self._device_bank_buttons[7]
self._monomod = ButtonMatrixElement(name = 'Monomod')
for row in self._matrix_rows_raw:
self._monomod.add_row(row)
self._monomod.add_row(self._track_stop_buttons)
self._monomod.add_row(self._select_buttons)
self._monomod.add_row(self._original_mute_buttons)
#self._doublepress_detail_button = DoublePressElement(self._detail_toggle_button)
def wrap_matrix(control_list, wrapper = nop):
return ButtonMatrixElement(rows=[map(wrapper, control_list)])
self._scene_launch_buttons = wrap_matrix(self._scene_launch_buttons)
self._track_stop_buttons = wrap_matrix(self._track_stop_buttons)
self._volume_controls = wrap_matrix(self._volume_controls)
self._arm_buttons = wrap_matrix(self._arm_buttons)
self._original_solo_buttons = wrap_matrix(self._original_solo_buttons)
self._original_mute_buttons = wrap_matrix(self._original_mute_buttons)
self._select_buttons = wrap_matrix(self._select_buttons)
self._device_param_controls = wrap_matrix(self._device_param_controls_raw)
self._device_bank_buttons = wrap_matrix(self._device_bank_buttons, partial(DeviceBankButtonElement, modifiers=[self._shift_button]))
self._solo_buttons = self._original_solo_buttons
self._mute_buttons = self._original_mute_buttons
def _create_detail_view_control(self):
self._detail_view_toggler = DetailViewCntrlComponent(name='Detail_View_Control', is_enabled=False, layer=Layer(device_clip_toggle_button=self._device_clip_toggle_button, device_nav_left_button=self._detail_left_button, device_nav_right_button=self._detail_right_button)) #detail_toggle_button=self._detail_toggle_button
def _setup_monobridge(self):
self._monobridge = MonoBridgeElement(self)
self._monobridge.name = 'MonoBridge'
def _setup_mod(self):
self.monomodular = get_monomodular(self)
self.monomodular.name = 'monomodular_switcher'
self.modhandler = APCModHandler(self)
self.modhandler.name = 'ModHandler'
self.modhandler.layer = Layer(priority = 5,
grid = self._monomod,
nav_up_button = self._up_button,
nav_down_button = self._down_button,
nav_left_button = self._left_button,
nav_right_button = self._right_button,
shiftlock_button = self._nudge_up_button,
alt_button = self._nudge_down_button,
shift_button = self._shift_button)
self.modhandler.set_device_component(self._device_component)
self.modhandler.set_enabled(False)
self._monomod_mode = MonomodModeComponent(self._monomod_mode_update, self)
self._monomod_mode.name = "Monomod_Mode_Component"
self._monomod_mode.layer = Layer(priority = 5, mode_toggle = self._detail_toggle_button)
self._on_shift_value.subject = self._shift_button
@subject_slot('value')
def _on_shift_value(self, value):
#self._monomod_mode.set_enabled(value>0)
self._monomod_mode.set_enabled(value is 0)
#self.modhandler.is_enabled() and self.modhanlder._shift_value(value)
if value:
self.modhandler.set_lock_button(self._detail_toggle_button)
示例6: Cntrlr
class Cntrlr(ControlSurface):
__module__ = __name__
__doc__ = " Monomodular controller script for Livid CNTRLR "
def __init__(self, *a, **k):
super(Cntrlr, self).__init__(*a, **k)
self._version_check = 'b996'
self._host_name = 'Cntrlr'
self._color_type = 'OhmRGB'
self._client = [None for index in range(4)]
self._active_client = None
self._rgb = 0
self._timer = 0
self._touched = 0
self.flash_status = 1
self._skin = Skin(CntrlrColors)
self._device_selection_follows_track_selection = FOLLOW
with self.component_guard():
self._setup_monobridge()
self._setup_controls()
self._define_sysex()
self._setup_transport_control()
self._setup_autoarm()
self._setup_session_recording_component()
self._setup_mixer_control()
self._setup_send_resets()
self._setup_session_control()
self._setup_device_control()
self._setup_device_selector()
self._setup_translations()
self._setup_viewcontrol()
self._setup_mod()
self._setup_instrument()
self._setup_modswitcher()
self._setup_modes()
self._setup_m4l_interface()
self._on_device_changed.subject = self.song()
self.set_feedback_channels(range(14, 15))
self._main_modes.selected_mode = 'MixMode'
self.schedule_message(1, self._open_log)
def _open_log(self):
self.log_message("<<<<<<<<<<<<<<<<<<<<= " + str(self._host_name) + " " + str(self._version_check) + " 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):
is_momentary = True
self._fader = [MonoEncoderElement(MIDI_CC_TYPE, CHANNEL, CNTRLR_FADERS[index], Live.MidiMap.MapMode.absolute, 'Fader_' + str(index), index, self) for index in range(8)]
self._dial_left = [MonoEncoderElement(MIDI_CC_TYPE, CHANNEL, CNTRLR_KNOBS_LEFT[index], Live.MidiMap.MapMode.absolute, 'Dial_Left_' + str(index), CNTRLR_KNOBS_LEFT[index], self) for index in range(12)]
self._dial_right = [MonoEncoderElement(MIDI_CC_TYPE, CHANNEL, CNTRLR_KNOBS_RIGHT[index], Live.MidiMap.MapMode.absolute, 'Dial_Right_' + str(index), CNTRLR_KNOBS_RIGHT[index], self) for index in range(12)]
self._encoder = [CodecEncoderElement(MIDI_CC_TYPE, CHANNEL, CNTRLR_DIALS[index], Live.MidiMap.MapMode.absolute, 'Encoder_' + str(index), CNTRLR_DIALS[index], self) for index in range(12)]
self._encoder_button = [MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, CNTRLR_DIAL_BUTTONS[index], name = 'Encoder_Button_' + str(index), script = self, skin = self._skin) for index in range(12)]
self._grid = [MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, CNTRLR_GRID[index], name = 'Grid_' + str(index), script = self, skin = self._skin) for index in range(16)]
self._button = [MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, CNTRLR_BUTTONS[index], name = 'Button_' + str(index), script = self, skin = self._skin) for index in range(32)]
self._knobs = self._dial_left + self._dial_right
self._fader_matrix = ButtonMatrixElement(name = 'Fader_Matrix', rows = [self._fader])
self._matrix = ButtonMatrixElement(name = 'Matrix', rows = [self._grid[index*4:(index*4)+4] for index in range(4)])
self._knob_left_matrix = ButtonMatrixElement(name = 'Knob_Left_Matrix', rows = [self._dial_left[index*4:(index*4)+4] for index in range(3)])
self._knob_right_matrix = ButtonMatrixElement(name = 'Knob_Right_Matrix', rows = [self._dial_right[index*4:(index*4)+4] for index in range(3)])
self._dial_matrix = ButtonMatrixElement(name = 'Dial_Matrix', rows = [self._encoder[index*4:(index*4)+4] for index in range(3)])
self._dial_button_matrix = ButtonMatrixElement(name = 'Dial_Button_Matrix', rows = [self._encoder_button[index*4:(index*4)+4] for index in range(1,3)])
self._key_matrix = ButtonMatrixElement(name = 'Key_Matrix', rows = [self._button[0:16], self._button[16:32]])
self._translated_controls = self._fader + self._knobs + self._encoder[4:] + self._grid + self._button
def _define_sysex(self):
self.encoder_navigation_on = SendSysexMode(script = self, sysex = (240, 0, 1, 97, 8, 17, 15, 0, 0, 0, 0, 0, 0, 0, 247))
self.encoder_navigation_off = SendSysexMode(script = self, sysex = (240, 0, 1, 97, 8, 17, 0, 0, 0, 0, 0, 0, 0, 0, 247))
def _setup_transport_control(self):
self._transport = CntrlrTransportComponent()
self._transport.name = 'Transport'
self._transport.layer = Layer(priority = 4,
play_button = self._button[28],
record_button = self._button[30],
stop_button = self._button[29])
def _setup_autoarm(self):
self._auto_arm = AutoArmComponent(name='Auto_Arm')
self._auto_arm.can_auto_arm_track = self._can_auto_arm_track
def _setup_session_recording_component(self):
self._clip_creator = ClipCreator()
self._clip_creator.name = 'ClipCreator'
self._recorder = CntrlrSessionRecordingComponent(self._clip_creator, ViewControlComponent()) # is_enabled = False)
self._recorder.layer = Layer(priority = 4, new_button = self._button[28], record_button = self._button[29], automation_button = self._button[30])
self._recorder.set_enabled(False)
#.........这里部分代码省略.........
示例7: AumPC20
class AumPC20(APC20):
def __init__(self, c_instance, *a, **k):
self._monomod_version = 'b996'
self._host_name = 'AumPC'
self._color_type = 'APC'
self._timer = 0
self._touched = 0
self.flash_status = False
super(AumPC20, self).__init__(c_instance, *a, **k)
with self.component_guard():
self._setup_mod()
def disconnect(self):
super(AumPC20, self).disconnect()
rebuild_sys()
def _create_controls(self):
make_color_button = partial(make_button, skin=self._skin)
self._shift_button = make_button(0, 81, name='Shift_Button', num = 0, cs = self)
self._matrix = ButtonMatrixElement(name='Button_Matrix')
self._scene_launch_buttons_raw = [ make_color_button(0, index + 82, name='Scene_%d_Launch_Button' % index, num = index, cs = self) for index in xrange(SESSION_HEIGHT) ]
self._track_stop_buttons = [ make_color_button(index, 52, name='Track_%d_Stop_Button' % index, num = index, cs = self) for index in xrange(SESSION_WIDTH) ]
self._matrix_rows_raw = []
for scene_index in xrange(SESSION_HEIGHT):
row = [ make_color_button(track_index, scene_index + 53, name='%d_Clip_%d_Button' % (track_index, scene_index), num = index, cs = self) for track_index in xrange(SESSION_WIDTH) ]
self._matrix_rows_raw.append(row)
self._matrix.add_row(row)
self._selected_scene_launch_button = make_pedal_button(64, name='Selected_Scene_Launch_Button')
self._scene_launch_buttons = ButtonMatrixElement(rows=[self._scene_launch_buttons_raw])
self._solo_buttons = [ make_button(track_index, 49, name='%d_Solo_Button' % track_index, num = track_index, cs = self) for track_index in xrange(MIXER_SIZE) ]
self._mute_buttons = [ make_button(track_index, 50, name='%d_Mute_Button' % track_index, num = track_index, cs = self) for track_index in xrange(MIXER_SIZE) ]
self._master_volume_control = make_slider(0, 14, name='Master_Volume_Control', num = 0, script = self)
self._prehear_control = EncoderElement(MIDI_CC_TYPE, 0, 47, MapMode.relative_two_compliment, name='Prehear_Volume_Control', num = 0, script = self)
self._master_select_button = make_button(0, 80, name='Master_Select_Button', num = index, cs = self)
self._select_buttons = [ make_button(track_index, 51, name='%d_Select_Button' % track_index, num = track_index, cs = self ) for track_index in xrange(8) ]
self._arm_buttons = [ make_button(track_index, 48, name='%d_Arm_Button' % track_index, num = track_index, cs = self) for track_index in xrange(8) ]
self._sliders = [ make_slider(track_index, 7, name='%d_Volume_Control' % track_index, num = track_index, script = self) for track_index in xrange(8) ]
self._monomod = ButtonMatrixElement(name = 'Monomod')
for row in self._matrix_rows_raw:
self._monomod.add_row(row)
self._monomod.add_row(self._track_stop_buttons)
self._monomod.add_row(self._select_buttons)
self._monomod.add_row(self._mute_buttons)
self._setup_monobridge() #had to put this here b/c the original author foolishly placed assignment methods inside of creation methods...argh.
def _setup_monobridge(self):
self._monobridge = MonoBridgeElement(self)
self._monobridge.name = 'MonoBridge'
def _setup_mod(self):
self.monomodular = get_monomodular(self)
self.monomodular.name = 'monomodular_switcher'
self.modhandler = APCModHandler(self)
self.modhandler.name = 'ModHandler'
self.modhandler.layer = Layer(priority = 5,
grid = self._monomod,
nav_up_button = self._scene_launch_buttons_raw[2],
nav_down_button = self._scene_launch_buttons_raw[3],
lock_button = self._scene_launch_buttons_raw[4],
shiftlock_button = self._scene_launch_buttons_raw[0],
alt_button = self._scene_launch_buttons_raw[1],
shift_button = self._shift_button)
self.modhandler.set_enabled(False)
self._monomod_mode = MonomodModeComponent(self._monomod_mode_update, self)
self._monomod_mode.name = "Monomod_Mode_Component"
self._monomod_mode.layer = Layer(priority = 5, mode_toggle = self._master_select_button)
self._on_shift_value.subject = self._shift_button
self._on_master_value.subject = self._master_select_button
@subject_slot('value')
def _on_shift_value(self, value):
self._monomod_mode.set_enabled(value>0)
@subject_slot('value')
def _on_master_value(self, value):
if not self._shift_button.is_pressed() and not self.modhandler.is_enabled():
self.schedule_message(1, self._shift_modes.update)
def _monomod_mode_update(self):
#self.log_message('mode update: ' + str(self._monomod_mode._mode_index))
if(self._monomod_mode._mode_index == 0):
self.flash_status = False
self.modhandler.set_enabled(False)
self._slider_modes.set_enabled(True)
self._shift_modes.set_enabled(True)
self._scene_launch_buttons[2].set_on_off_values(127, 0)
self._scene_launch_buttons[3].set_on_off_values(127, 0)
self._monomod.reset()
#.........这里部分代码省略.........
示例8: AumPC20
#.........这里部分代码省略.........
def _setup_custom_components(self):
is_momentary = True
master_select_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 80)
master_select_button.name = 'Master_Select_Button'
self._master_select_button = master_select_button
select_buttons = []
arm_buttons = []
sliders = []
for track in range(8):
select_buttons.append(AumPCMonoButtonElement(is_momentary, MIDI_NOTE_TYPE, track, 51, str(track) + '_Select_Button', self))
arm_buttons.append(ButtonElement(is_momentary, MIDI_NOTE_TYPE, track, 48))
sliders.append(MonoEncoderElement(MIDI_CC_TYPE, track, 7, Live.MidiMap.MapMode.absolute, 'Slider_' + str(track), track, self))
select_buttons[-1].name = str(track) + '_Select_Button'
arm_buttons[-1].name = str(track) + '_Arm_Button'
#sliders[-1].name = str(track) + '_Volume_Control'
self._select_buttons = select_buttons
transport = TransportComponent()
transport.name = 'Transport'
slider_modes = SliderModesComponent(self._mixer, tuple(sliders))
slider_modes.name = 'Slider_Modes'
self._shift_modes = AumPC20ShiftableSelectorComponent(tuple(select_buttons), master_select_button, tuple(arm_buttons), self._matrix, self._session, self._session_zoom, self._mixer, transport, slider_modes, self._send_introduction_message, self)
self._shift_modes.name = 'Shift_Modes'
self._shift_modes.set_mode_toggle(self._shift_button)
self._device = DeviceComponent()
def _product_model_id_byte(self):
return 123
def _setup_monobridge(self):
self._monobridge = MonoBridgeElement(self)
self._monobridge.name = 'MonoBridge'
def _setup_monomod(self):
self._host = AumPC20MonomodComponent(self)
self._host.name = 'Monomod_Host'
self._host._navbox_selected = 16
self._host._navbox_unselected = 1
self.hosts = [self._host]
self._monomod = ButtonMatrixElement()
self._monomod.name = 'Monomod'
for row in range(5):
button_row = []
for column in range(8):
button_row.append(self._matrix.get_button(column, row))
self._monomod.add_row(tuple(button_row))
self._monomod.add_row(tuple(self._track_stop_buttons))
self._monomod.add_row(tuple(self._select_buttons))
self._monomod.add_row(tuple(self._solo_buttons))
self._monomod_mode = MonomodModeComponent(self._monomod_mode_update, self)
self._monomod_mode.name = "Monomod_Mode_Component"
#self._shift_button.add_value_listener(self._shift_value)
def _shift_value(self, value):
if value > 0:
self._mixer.master_strip().set_select_button(None)
self._monomod_mode.set_mode_toggle(self._master_select_button)
else:
self._mixer.master_strip().set_select_button(self._master_select_button)
self._monomod_mode.set_mode_toggle(None)
示例9: Alias
class Alias(ControlSurface):
__module__ = __name__
__doc__ = " Alias 8 controller script "
def __init__(self, c_instance):
super(Alias, self).__init__(c_instance)
with self.component_guard():
self._host_name = "Alias"
self._color_type = "OhmRGB"
self.log_message("--------------= Alias log opened =--------------")
self._rgb = 0
self._timer = 0
self.flash_status = 1
self._clutch_device_selection = False
self._touched = 0
self._update_linked_device_selection = None
self._setup_monobridge()
self._setup_controls()
self._setup_m4l_interface()
self._setup_mixer_control()
self._setup_session_control()
self._setup_mixer_nav()
"""script initialization methods"""
def _setup_monobridge(self):
self._monobridge = MonoBridgeElement(self)
self._monobridge.name = "MonoBridge"
def _setup_controls(self):
is_momentary = True
self._fader = [
MonoEncoderElement(
MIDI_CC_TYPE,
CHANNEL,
ALIAS_FADERS[index],
Live.MidiMap.MapMode.absolute,
"Fader_" + str(index),
index,
self,
)
for index in range(9)
]
self._button = [
MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, ALIAS_BUTTONS[index], "Button_" + str(index), self)
for index in range(16)
]
self._dial = [
MonoEncoderElement(
MIDI_CC_TYPE,
CHANNEL,
ALIAS_DIALS[index],
Live.MidiMap.MapMode.absolute,
"Dial_" + str(index),
index + 8,
self,
)
for index in range(16)
]
self._encoder = MonoEncoderElement(
MIDI_CC_TYPE, CHANNEL, ALIAS_ENCODER, Live.MidiMap.MapMode.absolute, "Encoder", 0, self
)
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_mixer_control(self):
is_momentary = True
self._num_tracks = 8 # A mixer is one-dimensional;
self._mixer = AliasMixerComponent(8, 0, False, False)
self._mixer.name = "Mixer"
self._mixer.set_track_offset(0) # Sets start point for mixer strip (offset from left)
for index in range(8):
self._mixer.channel_strip(index).set_volume_control(self._fader[index])
self._mixer.channel_strip(index).set_send_controls(tuple([self._dial[index], self._dial[index + 8]]))
self._mixer.channel_strip(index).set_mute_button(self._button[index])
self._button[index].set_on_off_values(MUTE_TOG, 0)
self._mixer.channel_strip(index)._invert_mute_feedback = True
self._mixer.channel_strip(index).set_arm_button(self._button[index + 8])
self._button[index + 8].set_on_off_values(REC_TOG, 0)
self._mixer.channel_strip(index).name = "Mixer_ChannelStrip_" + str(index)
self._mixer.master_strip().set_volume_control(self._fader[8])
self.song().view.selected_track = self._mixer.channel_strip(0)._track
def _setup_session_control(self):
self._session = SessionComponent(8, 1)
self._session.set_mixer(self._mixer)
self.set_highlighting_session_component(self._session)
def _setup_mixer_nav(self):
if not self._encoder.value_has_listener(self._nav_change):
self._encoder.add_value_listener(self._nav_change)
"""shift/zoom methods"""
def _nav_change(self, value):
#.........这里部分代码省略.........
示例10: OhmModes
class OhmModes(ControlSurface):
__module__ = __name__
__doc__ = ' OhmModes controller script '
def __init__(self, c_instance):
super(OhmModes, self).__init__(c_instance)
self._version_check = 'b996'
self._host_name = 'Ohm'
self._color_type = 'OhmRGB'
self._rgb = 0
self._timer = 0
self._touched = 0
self.flash_status = 1
self._backlight = 127
self._backlight_type = 'static'
self._ohm = 127
self._ohm_type = 'static'
self._pad_translations = PAD_TRANSLATION
self._device_selection_follows_track_selection = FOLLOW
self._keys_octave = 5
self._keys_scale = 0
self._tempo_buttons = None
with self.component_guard():
self._setup_monobridge()
self._setup_controls()
self._setup_m4l_interface()
self._setup_transport_control()
self._setup_mixer_control()
self._setup_session_control()
self._setup_device_control()
self._setup_crossfader()
self._setup_translations()
self._setup_mod()
self._setup_modes()
self._assign_page_constants()
self._last_device = None
self.song().view.add_selected_track_listener(self._update_selected_device)
self.show_message('OhmModes Control Surface Loaded')
self._send_midi(tuple(switchxfader))
if FORCE_TYPE is True:
self._rgb = FORCE_COLOR_TYPE
else:
self.schedule_message(10, self.query_ohm, None)
self.log_message('<<<<<<<<<<<<<<<<<<<<<<<<< OhmModes ' + str(self._version_check) + ' log opened >>>>>>>>>>>>>>>>>>>>>>>>>')
debug('DEBUG ON for OhmModes script.')
def query_ohm(self):
self._send_midi(tuple(check_model))
def update_display(self):
super(OhmModes, self).update_display()
self._timer = (self._timer + 1) % 256
self.flash()
self.strobe()
def _setup_monobridge(self):
self._monobridge = MonoBridgeElement(self)
self._monobridge.name = 'MonoBridge'
def get_device_bank(self):
return self._device._bank_index
def _setup_controls(self):
is_momentary = True
self._fader = [ None for index in range(8) ]
self._dial = [ None for index in range(16) ]
self._button = [ None for index in range(8) ]
self._menu = [ None for index in range(6) ]
for index in range(8):
self._fader[index] = MonoEncoderElement(MIDI_CC_TYPE, CHANNEL, OHM_FADERS[index], Live.MidiMap.MapMode.absolute, 'Fader_' + str(index), index, self)
for index in range(8):
self._button[index] = MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, OHM_BUTTONS[index], 'Button_' + str(index), self)
for index in range(16):
self._dial[index] = MonoEncoderElement(MIDI_CC_TYPE, CHANNEL, OHM_DIALS[index], Live.MidiMap.MapMode.absolute, 'Encoder_' + str(index), index, self)
self._knobs = []
for index in range(12):
self._knobs.append(self._dial[index])
for index in range(6):
self._menu[index] = MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, OHM_MENU[index], 'Menu_' + str(index), self)
self._crossfader = EncoderElement(MIDI_CC_TYPE, CHANNEL, CROSSFADER, Live.MidiMap.MapMode.absolute)
self._crossfader.name = 'Crossfader'
self._livid = MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, LIVID, 'Livid_Button', self)
self._shift_l = MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, SHIFT_L, 'Page_Button_Left', self)
self._shift_r = MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, SHIFT_R, 'Page_Button_Right', self)
self._matrix = ButtonMatrixElement()
self._matrix.name = 'Matrix'
self._grid = [ None for index in range(8) ]
self._monomod = ButtonMatrixElement()
self._monomod.name = 'Monomod'
#.........这里部分代码省略.........
示例11: Crate
class Crate(ControlSurface):
__module__ = __name__
__doc__ = " Monomodular controller script for Crate "
def __init__(self, *a, **k):
super(Crate, self).__init__(*a, **k)
self._host_name = 'Crate'
self._version_check = '1.0'
self._rgb = 0
self._timer = 0
self._touched = 0
self.flash_status = 1
with self.component_guard():
self._setup_monobridge()
self._setup_controls()
self._setup_session()
self._setup_next_buttons()
self._setup_tempo()
self._setup_modes()
self._create_fallback_control_owner()
self.schedule_message(1, self._open_log)
self.schedule_message(3, self._initialize_surface)
def _open_log(self):
self.log_message("<<<<<<<<<<<<<<<<<<<<= " + str(self._host_name) + " " + str(self._version_check) + " log opened =>>>>>>>>>>>>>>>>>>>")
self.show_message(str(self._host_name) + ' Control Surface Loaded')
def _initialize_surface(self):
debug('setting to main mode')
#self._main_modes.selected_mod = 'Main'
#self._session.set_enabled(True)
def port_settings_changed(self):
debug('port settings changed!')
self._connected = False
super(Crate, self).port_settings_changed()
def _setup_monobridge(self):
self._monobridge = MonoBridgeElement(self)
self._monobridge.name = 'MonoBridge'
def _with_shift(self, button):
return ComboElement(button, modifiers=[self._shift_button])
def _setup_controls(self):
self._button = [CrateButtonElement(True, MIDI_NOTE_TYPE, 0, index, name = 'Button_' + str(index), script = self) for index in range(20)]
self._track_button = [CrateButtonElement(True, MIDI_NOTE_TYPE, 0, index+50, name = 'Button_' + str(index+50), script = self) for index in range(6)]
self._next_button = [CrateButtonElement(True, MIDI_NOTE_TYPE, 0, index+60, name = 'Button_' + str(index+60), script = self) for index in range(2)]
self._crate_button = [CrateButtonElement(True, MIDI_NOTE_TYPE, 0, index+70, name = 'Button_' + str(index+70), script = self) for index in range(3)]
#self._tempo_slider = EncoderElement(MIDI_CC_TYPE, 0, 0, Live.MidiMap.MapMode.absolute, name = 'Slider')
self._matrix = ButtonMatrixElement(name = 'Matrix', rows = [[self._button[index]] for index in range(20)])
self._left_matrix = ButtonMatrixElement(name = 'Left_Matrix', rows = [[self._button[index]] for index in range(10)])
self._right_matrix = ButtonMatrixElement(name = 'Right_Matrix', rows = [[self._button[index+10]] for index in range(10)])
self._track_select_matrix = ButtonMatrixElement(name = 'Track_Matrix', rows = [self._track_button])
def _setup_session(self):
self._left_session = CrateSessionComponent(script = self, name = 'Session_Component_A', num_tracks = 1, num_scenes = 20, autonaming = True, is_enabled = False, layer = Layer(priority = 1, clip_launch_buttons = self._matrix, track_nav_buttons = self._track_select_matrix))
self._left_session.set_group_track('DECK A')
self._left_session_zooming = SessionZoomingComponent(session = self._left_session)
self._right_session = CrateSessionComponent(script = self, name = 'Session_Component_B', num_tracks = 1, num_scenes = 20, autonaming = True, is_enabled = False, layer = Layer(priority = 1, clip_launch_buttons = self._matrix, track_nav_buttons = self._track_select_matrix))
self._right_session.set_group_track('DECK B')
self._right_session_zooming = SessionZoomingComponent(session = self._right_session)
self._left_set_session = CrateSetSessionComponent(script = self, name = 'Session_Component_SETA', num_tracks = 1, num_scenes = 10, autonaming = True, is_enabled = False, layer = Layer(priority = 1, clip_launch_buttons = self._left_matrix))
self._left_set_session.set_group_track('SET A')
self._left_set_session_zooming = SessionZoomingComponent(session = self._left_set_session)
self._right_set_session = CrateSetSessionComponent(script = self, name = 'Session_Component_SETB', num_tracks = 1, num_scenes = 10, autonaming = True, is_enabled = False, layer = Layer(priority = 1, clip_launch_buttons = self._right_matrix))
self._right_set_session.set_group_track('SET B')
self._right_set_session_zooming = SessionZoomingComponent(session = self._right_set_session)
def _setup_next_buttons(self):
self._next_a_button = FireNextClipComponent()
self._next_a_button.set_track('SET A')
self._next_a_button.layer = Layer(button = self._next_button[0])
self._next_b_button = FireNextClipComponent()
self._next_b_button.set_track('SET B')
self._next_b_button.layer = Layer(button = self._next_button[1])
def _setup_tempo(self):
self._on_tempo_changed.subject = self.song()
self._on_tempo_changed()
#.........这里部分代码省略.........
示例12: GuitarWing
class GuitarWing(ControlSurface):
__module__ = __name__
__doc__ = " GuitarWing controller script "
def __init__(self, c_instance):
super(GuitarWing, self).__init__(c_instance)
self._connected = False
self._host_name = 'GuitarWing'
self._color_type = 'OhmRGB'
self.oscServer = None
self.log_message("<<<<<<<<<<<<<<<<<= GuitarWing log opened =>>>>>>>>>>>>>>>>>>>>>")
self._timer = 0
self._current_nav_buttons = []
self.flash_status = 1
self._clutch_device_selection = False
self._touched = 0
self._last_selected_track = None
self._last_selected_track_arm = False
self._device_selection_follows_track_selection = True
with self.component_guard():
self._setup_monobridge()
self._setup_controls()
self._setup_m4l_interface()
#self._setup_OSC_layer()
self._setup_device_control()
self._setup_transport_control()
#self._setup_selected_session_control()
self._setup_mixer_control()
self._setup_session_control()
#self._setup_step_sequencer()
#self._device.add_device_listener(self._on_new_device_set)
self._device.set_parameter_controls(tuple([self._fader[0], self._fader[1], self._fader[2], self._accel[2], self._ccs[0], self._ccs[1], self._ccs[2], self._ccs[3]])) #, self._fader_button[0], self._fader_button[1], self._fader_button[2], self._padCC[4]]))
self._mixer.set_select_buttons(self._button[1], self._button[0])
#self._session.set_scene_launch_buttons(self._pad[:4])
for index in range(4):
self._scene[index].set_launch_button(self._pad[index])
#for index in range(4):
# self._pad[index].set_identifier(36+index)
# self._pad[index].set_channel(CHANNEL)
# self._pad[index].set_enabled(False)
self._transport.set_stop_button(self._button[6])
self._transport.set_loop_button(self._button[7])
self._transport.set_seek_backward_button(self._button[8])
self._transport.set_record_button(self._button[9])
#self._on_select_track_down_value.subject = self._button[0]
#self._on_select_track_up_value.subject = self._button[1]
@subject_slot('value')
def _on_select_track_up_value(self, value):
if value:
pass
@subject_slot('value')
def _on_select_track_down_value(self, value):
if value:
pass
def _setup_monobridge(self):
self._monobridge = MonoBridgeElement(self)
self._monobridge.name = 'MonoBridge'
def _setup_controls(self):
is_momentary = True
self._button = [MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, BUTTONS[index], 'Button_' + str(index), self) for index in range(10)]
self._fader = [MonoEncoderElement(MIDI_CC_TYPE, CHANNEL, SLIDERS[index], Live.MidiMap.MapMode.absolute, 'Fader_' + str(index), index, self) for index in range(3)]
#self._fader_button = [MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, index, 'Fader_Button_' + str(index), self) for index in range(3)]
self._fader_button = [MonoEncoderElement(MIDI_NOTE_TYPE, CHANNEL, SLIDERS[index], Live.MidiMap.MapMode.absolute, 'Fader_Button_' + str(index), index, self) for index in range(3)]
self._ccs = [MonoEncoderElement(MIDI_CC_TYPE, CHANNEL, CCS[index], Live.MidiMap.MapMode.absolute, 'CCs_' + str(index), index, self) for index in range(4)]
self._pad = [MonoButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, PADS[index], 'Pad_' + str(index), self) for index in range(5)]
self._padCC = [MonoEncoderElement(MIDI_CC_TYPE, CHANNEL, PADS[index], Live.MidiMap.MapMode.absolute, 'PadCC_' + str(index), index, self) for index in range(5)]
self._accel = [MonoEncoderElement(MIDI_CC_TYPE, CHANNEL, ACCELS[index], Live.MidiMap.MapMode.absolute, 'Accel_' + str(index), index, self) for index in range(3)]
def _setup_mixer_control(self):
is_momentary = True
self._num_tracks = (1) #A mixer is one-dimensional;
self._mixer = MixerComponent(1, 0, False, False)
self._mixer.name = 'Mixer'
self._mixer.set_track_offset(0) #Sets start point for mixer strip (offset from left)
for index in range(1):
self._mixer.channel_strip(index)._invert_mute_feedback = True
self._mixer.channel_strip(index).name = 'Mixer_ChannelStrip_' + str(index)
#for index in range(4):
# self._mixer.return_strip(index).name = 'Mixer_ReturnStrip_' + str(index)
self._mixer.selected_strip().name = 'Mixer_SelectedStrip'
self.song().view.selected_track = self._mixer.channel_strip(0)._track
def _setup_session_control(self):
self._session = GuitarWingSessionComponent(1, 4, self)
#.........这里部分代码省略.........
示例13: AumPC40
#.........这里部分代码省略.........
def _setup_global_control(self):
is_momentary = True
global_bank_buttons = []
global_param_controls = []
for index in range(8):
ring_button = ButtonElement(not is_momentary, MIDI_CC_TYPE, 0, 56 + index)
ringed_encoder = MonoRingedEncoderElement(MIDI_CC_TYPE, 0, 48 + index, Live.MidiMap.MapMode.absolute, index + 8, self)
ringed_encoder.name = 'Track_Control_' + str(index)
ring_button.name = ringed_encoder.name + '_Ring_Mode_Button'
ringed_encoder.set_ring_mode_button(ring_button)
global_param_controls.append(ringed_encoder)
global_bank_buttons = []
global_bank_labels = ('Pan_Button', 'Send_A_Button', 'Send_B_Button', 'Send_C_Button')
for index in range(4):
global_bank_buttons.append(ButtonElement(not is_momentary, MIDI_NOTE_TYPE, 0, 87 + index))
global_bank_buttons[-1].name = global_bank_labels[index]
encoder_modes = EncModeSelectorComponent(self._mixer)
encoder_modes.name = 'Track_Control_Modes'
encoder_modes.set_modes_buttons(global_bank_buttons)
encoder_modes.set_controls(tuple(global_param_controls))
global_translation_selector = ChannelTranslationSelector()
global_translation_selector.name = 'Global_Translations'
global_translation_selector.set_controls_to_translate(tuple(global_param_controls))
global_translation_selector.set_mode_buttons(tuple(global_bank_buttons))
def _product_model_id_byte(self):
return 115
def _setup_monobridge(self):
self._monobridge = MonoBridgeElement(self)
self._monobridge.name = 'MonoBridge'
def _setup_monomod(self):
self._host = MonomodComponent(self)
self._host.name = 'Monomod_Host'
self._host._navbox_selected = 16
self._host._navbox_unselected = 1
self.hosts = [self._host]
self._monomod = ButtonMatrixElement()
self._monomod.name = 'Monomod'
for row in range(5):
button_row = []
for column in range(8):
button_row.append(self._matrix.get_button(column, row))
self._monomod.add_row(tuple(button_row))
self._monomod.add_row(tuple(self._track_stop_buttons))
self._monomod.add_row(tuple(self._select_buttons))
self._monomod.add_row(tuple(self._solo_buttons))
self._monomod_mode = MonomodModeComponent(self._monomod_mode_update, self)
self._monomod_mode.name = "Monomod_Mode_Component"
self._shift_button.add_value_listener(self._shift_value)
def _shift_value(self, value):
if value > 0:
self._mixer.master_strip().set_select_button(None)
self._monomod_mode.set_mode_toggle(self._master_select_button)
else:
self._mixer.master_strip().set_select_button(self._master_select_button)
self._monomod_mode.set_mode_toggle(None)