本文整理汇总了Python中_Mono_Framework.MonoBridgeElement.MonoBridgeElement._send方法的典型用法代码示例。如果您正苦于以下问题:Python MonoBridgeElement._send方法的具体用法?Python MonoBridgeElement._send怎么用?Python MonoBridgeElement._send使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类_Mono_Framework.MonoBridgeElement.MonoBridgeElement
的用法示例。
在下文中一共展示了MonoBridgeElement._send方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: DS1
# 需要导入模块: from _Mono_Framework.MonoBridgeElement import MonoBridgeElement [as 别名]
# 或者: from _Mono_Framework.MonoBridgeElement.MonoBridgeElement import _send [as 别名]
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: BlockMod
# 需要导入模块: from _Mono_Framework.MonoBridgeElement import MonoBridgeElement [as 别名]
# 或者: from _Mono_Framework.MonoBridgeElement.MonoBridgeElement import _send [as 别名]
#.........这里部分代码省略.........
self._mixer2.channel_strip(column).set_solo_button(None)
self._mixer2.channel_strip(column).set_arm_button(None)
for row in range(5):
self._scene[row].clip_slot(column).set_launch_button(None)
self._scene2[row].clip_slot(column).set_launch_button(None)
for index in range(5):
self._scene[index].set_launch_button(None)
self._scene2[index].set_launch_button(None)
self._scene_main[index].set_launch_button(None)
self._session_zoom.set_nav_buttons(None, None, None, None)
self._session_zoom2.set_nav_buttons(None, None, None, None)
self._session_zoom_main.set_nav_buttons(None, None, None, None)
self._session.set_track_bank_buttons(None, None)
self._session.set_scene_bank_buttons(None, None)
self._session2.set_track_bank_buttons(None, None)
self._session2.set_scene_bank_buttons(None, None)
self._session_main.set_track_bank_buttons(None, None)
self._session_main.set_scene_bank_buttons(None, None)
for column in range(8):
self._mixer.channel_strip(column).set_select_button(None)
self._mixer.channel_strip(column).set_crossfade_toggle(None)
self._mixer.channel_strip(column).set_mute_button(None)
self._mixer.channel_strip(column).set_solo_button(None)
self._mixer.channel_strip(column).set_arm_button(None)
for row in range(5):
self._scene_main[row].clip_slot(column).set_launch_button(None)
for row in range(8):
self._grid[column][row].set_channel(0)
self._grid[column][row].release_parameter()
self._grid[column][row].use_default_message()
self._grid[column][row].set_enabled(True)
self._grid[column][row].set_on_off_values(127, 0)
self._grid[column][row].send_value(0, True)
self._send_reset.set_buttons(tuple(None for index in range(4)))
def zoom_off(self):
for column in range(4):
self._grid[column][5].set_on_value(MUTE[self._rgb])
self._mixer.channel_strip(column).set_mute_button(self._grid[column][5])
self._grid[column][6].set_on_value(ARM[self._rgb])
self._mixer.channel_strip(column).set_arm_button(self._grid[column][6])
for row in range(5):
self._scene[row].clip_slot(column).set_launch_button(self._grid[column][row])
if(self._r_function_mode._mode_index in range(0,3)):
self._grid[column + 4][5].set_on_value(MUTE[self._rgb])
self._mixer2.channel_strip(column).set_mute_button(self._grid[column + 4][5])
self._grid[column + 4][6].set_on_value(ARM[self._rgb])
self._mixer2.channel_strip(column).set_arm_button(self._grid[column + 4][6])
for row in range(5):
self._scene2[row].clip_slot(column).set_launch_button(self._grid[column + 4][row])
elif(self._r_function_mode._mode_index is 3):
self._grid[column + 4][5].set_on_value(MUTE[self._rgb])
self._mixer2.return_strip(column).set_mute_button(self._grid[column + 4][5])
for row in range(5):
self._grid[column + 4][row].send_value(USER1_COLOR[self._rgb], True)
self._grid[column + 4][row].set_channel(RIGHT_USER1_CHANNEL)
self._grid[column + 4][row].set_identifier(RIGHT_USER1_MAP[column][row])
self._grid[column + 4][row].set_enabled(False) #this has to happen for translate to work
#self._session_zoom2.set_ignore_buttons(True)
if(self._r_function_mode._mode_index is 0):
for index in range(4):
self._grid[index + 4][7].send_value(SEND_RESET[self._rgb], True)
self._send_reset.set_buttons(tuple(self._grid[index + 4][7] for index in range(4)))
示例3: Codec
# 需要导入模块: from _Mono_Framework.MonoBridgeElement import MonoBridgeElement [as 别名]
# 或者: from _Mono_Framework.MonoBridgeElement.MonoBridgeElement import _send [as 别名]
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'
#.........这里部分代码省略.........
示例4: AumPC40
# 需要导入模块: from _Mono_Framework.MonoBridgeElement import MonoBridgeElement [as 别名]
# 或者: from _Mono_Framework.MonoBridgeElement.MonoBridgeElement import _send [as 别名]
#.........这里部分代码省略.........
self._monomod.reset()
self.modhandler.set_enabled(True)
self._detail_toggle_button.send_value(self._monomod_mode._mode_index)
"""m4l bridge"""
def generate_strip_string(self, display_string):
#self.log_message(display_string)
NUM_CHARS_PER_DISPLAY_STRIP = 12
if (not display_string):
return (' ' * NUM_CHARS_PER_DISPLAY_STRIP)
if ((len(display_string.strip()) > (NUM_CHARS_PER_DISPLAY_STRIP - 1)) and (display_string.endswith('dB') and (display_string.find('.') != -1))):
display_string = display_string[:-2]
if (len(display_string) > (NUM_CHARS_PER_DISPLAY_STRIP - 1)):
for um in [' ',
'i',
'o',
'u',
'e',
'a']:
while ((len(display_string) > (NUM_CHARS_PER_DISPLAY_STRIP - 1)) and (display_string.rfind(um, 1) != -1)):
um_pos = display_string.rfind(um, 1)
display_string = (display_string[:um_pos] + display_string[(um_pos + 1):])
else:
display_string = display_string.center((NUM_CHARS_PER_DISPLAY_STRIP - 1))
ret = u''
for i in range((NUM_CHARS_PER_DISPLAY_STRIP - 1)):
if ((ord(display_string[i]) > 127) or (ord(display_string[i]) < 0)):
ret += ' '
else:
ret += display_string[i]
ret += ' '
assert (len(ret) == NUM_CHARS_PER_DISPLAY_STRIP)
return ret
def notification_to_bridge(self, name, value, sender):
if isinstance(sender, (MonoRingedEncoderElement, MonoEncoderElement)):
self._monobridge._send(sender.name, 'lcd_name', str(self.generate_strip_string(name)))
self._monobridge._send(sender.name, 'lcd_value', str(self.generate_strip_string(value)))
def touched(self):
if self._touched is 0:
self._monobridge._send('touch', 'on')
self.schedule_message(2, self.check_touch)
self._touched +=1
def check_touch(self):
if self._touched > 5:
self._touched = 5
elif self._touched > 0:
self._touched -= 1
if self._touched is 0:
self._monobridge._send('touch', 'off')
else:
self.schedule_message(2, self.check_touch)
def get_clip_names(self):
clip_names = []
for scene in self._session._scenes:
for clip_slot in scene._clip_slots:
if clip_slot.has_clip() is True:
clip_names.append(clip_slot._clip_slot)##.clip.name)
return clip_slot._clip_slot
##self.log_message(str(clip_slot._clip_slot.clip.name))
return clip_names
def update_display(self):
super(AumPC40, self).update_display()
self._timer = (self._timer + 1) % 256
self.flash()
def flash(self):
if self.flash_status:
for control, _ in self._monomod.iterbuttons():
if isinstance(control, MonoButtonElement):
control.flash(self._timer)
def _make_current_bank_details(self, device_component):
def _current_bank_details():
if not self.modhandler.active_mod() is None:
if self.modhandler.active_mod() and self.modhandler.active_mod()._param_component._device_parent != None:
bank_name = self.modhandler.active_mod()._param_component._bank_name
bank = [param._parameter for param in self.modhandler.active_mod()._param_component._params]
if self.modhandler._alt_value.subject and self.modhandler._alt_value.subject.is_pressed():
bank = bank[8:]
#self.log_message('current mod bank details: ' + str(bank_name) + ' ' + str(bank))
return (bank_name, bank)
else:
return DeviceComponent._current_bank_details(device_component)
else:
return DeviceComponent._current_bank_details(device_component)
return _current_bank_details
示例5: Cntrlr
# 需要导入模块: from _Mono_Framework.MonoBridgeElement import MonoBridgeElement [as 别名]
# 或者: from _Mono_Framework.MonoBridgeElement.MonoBridgeElement import _send [as 别名]
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)
#.........这里部分代码省略.........
示例6: AumPC20
# 需要导入模块: from _Mono_Framework.MonoBridgeElement import MonoBridgeElement [as 别名]
# 或者: from _Mono_Framework.MonoBridgeElement.MonoBridgeElement import _send [as 别名]
#.........这里部分代码省略.........
self._shift_modes._note_mode_active = False
self._session_zoom.set_ignore_buttons(False)
self._shift_modes._transport.update()
self._shift_modes._on_note_mode_changed()
self._shift_modes.set_enabled(False)
self._session.set_clip_launch_buttons(None)
for track in range(8):
self._mixer.channel_strip(track).set_select_button(None)
self._mixer.channel_strip(track).set_mute_button(None)
self._session.set_track_bank_buttons(None, None)
self._session.set_scene_bank_buttons(None, None)
for scene in range(5):
self._scene_launch_buttons[scene].turn_off()
self._transport.set_enabled(False)
self._session.set_enabled(False)
self._session_zoom.set_enabled(False)
self.flash_status = True
self._monomod.reset()
self.modhandler.set_enabled(True)
self._master_select_button.send_value(self._monomod_mode._mode_index)
"""m4l bridge"""
def generate_strip_string(self, display_string):
#self.log_message(display_string)
NUM_CHARS_PER_DISPLAY_STRIP = 12
if (not display_string):
return (' ' * NUM_CHARS_PER_DISPLAY_STRIP)
if ((len(display_string.strip()) > (NUM_CHARS_PER_DISPLAY_STRIP - 1)) and (display_string.endswith('dB') and (display_string.find('.') != -1))):
display_string = display_string[:-2]
if (len(display_string) > (NUM_CHARS_PER_DISPLAY_STRIP - 1)):
for um in [' ',
'i',
'o',
'u',
'e',
'a']:
while ((len(display_string) > (NUM_CHARS_PER_DISPLAY_STRIP - 1)) and (display_string.rfind(um, 1) != -1)):
um_pos = display_string.rfind(um, 1)
display_string = (display_string[:um_pos] + display_string[(um_pos + 1):])
else:
display_string = display_string.center((NUM_CHARS_PER_DISPLAY_STRIP - 1))
ret = u''
for i in range((NUM_CHARS_PER_DISPLAY_STRIP - 1)):
if ((ord(display_string[i]) > 127) or (ord(display_string[i]) < 0)):
ret += ' '
else:
ret += display_string[i]
ret += ' '
assert (len(ret) == NUM_CHARS_PER_DISPLAY_STRIP)
return ret
def notification_to_bridge(self, name, value, sender):
if isinstance(sender, (MonoRingedEncoderElement, MonoEncoderElement)):
self._monobridge._send(sender.name, 'lcd_name', str(self.generate_strip_string(name)))
self._monobridge._send(sender.name, 'lcd_value', str(self.generate_strip_string(value)))
def touched(self):
if self._touched is 0:
self._monobridge._send('touch', 'on')
self.schedule_message(2, self.check_touch)
self._touched +=1
def check_touch(self):
if self._touched > 5:
self._touched = 5
elif self._touched > 0:
self._touched -= 1
if self._touched is 0:
self._monobridge._send('touch', 'off')
else:
self.schedule_message(2, self.check_touch)
def get_clip_names(self):
clip_names = []
for scene in self._session._scenes:
for clip_slot in scene._clip_slots:
if clip_slot.has_clip() is True:
clip_names.append(clip_slot._clip_slot)##.clip.name)
return clip_slot._clip_slot
##self.log_message(str(clip_slot._clip_slot.clip.name))
return clip_names
def update_display(self):
super(AumPC20, self).update_display()
self._timer = (self._timer + 1) % 256
self.flash()
def flash(self):
if self.flash_status:
for control, _ in self._monomod.iterbuttons():
if isinstance(control, MonoButtonElement):
control.flash(self._timer)
示例7: AumPC20
# 需要导入模块: from _Mono_Framework.MonoBridgeElement import MonoBridgeElement [as 别名]
# 或者: from _Mono_Framework.MonoBridgeElement.MonoBridgeElement import _send [as 别名]
#.........这里部分代码省略.........
strip.set_mute_button(mute_button)
strip.set_shift_button(self._shift_button)
strip.set_invert_mute_feedback(True)
master_volume_control = SliderElement(MIDI_CC_TYPE, 0, 14)
prehear_control = EncoderElement(MIDI_CC_TYPE, 0, 47, Live.MidiMap.MapMode.relative_two_compliment)
master_volume_control.name = 'Master_Volume_Control'
prehear_control.name = 'Prehear_Volume_Control'
self._mixer.set_prehear_volume_control(prehear_control)
self._mixer.master_strip().set_volume_control(master_volume_control)
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"
示例8: Alias
# 需要导入模块: from _Mono_Framework.MonoBridgeElement import MonoBridgeElement [as 别名]
# 或者: from _Mono_Framework.MonoBridgeElement.MonoBridgeElement import _send [as 别名]
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):
#.........这里部分代码省略.........
示例9: OhmModes
# 需要导入模块: from _Mono_Framework.MonoBridgeElement import MonoBridgeElement [as 别名]
# 或者: from _Mono_Framework.MonoBridgeElement.MonoBridgeElement import _send [as 别名]
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'
#.........这里部分代码省略.........
示例10: Crate
# 需要导入模块: from _Mono_Framework.MonoBridgeElement import MonoBridgeElement [as 别名]
# 或者: from _Mono_Framework.MonoBridgeElement.MonoBridgeElement import _send [as 别名]
#.........这里部分代码省略.........
if (not display_string):
return (' ' * NUM_CHARS_PER_DISPLAY_STRIP)
if ((len(display_string.strip()) > (NUM_CHARS_PER_DISPLAY_STRIP - 1)) and (display_string.endswith('dB') and (display_string.find('.') != -1))):
display_string = display_string[:-2]
if (len(display_string) > (NUM_CHARS_PER_DISPLAY_STRIP - 1)):
for um in [' ',
'i',
'o',
'u',
'e',
'a']:
while ((len(display_string) > (NUM_CHARS_PER_DISPLAY_STRIP - 1)) and (display_string.rfind(um, 1) != -1)):
um_pos = display_string.rfind(um, 1)
display_string = (display_string[:um_pos] + display_string[(um_pos + 1):])
else:
display_string = display_string.center((NUM_CHARS_PER_DISPLAY_STRIP - 1))
ret = u''
for i in range((NUM_CHARS_PER_DISPLAY_STRIP - 1)):
if ((ord(display_string[i]) > 127) or (ord(display_string[i]) < 0)):
ret += ' '
else:
ret += display_string[i]
ret += ' '
ret = ret.replace(' ', '_')
assert (len(ret) == NUM_CHARS_PER_DISPLAY_STRIP)
return ret
def notification_to_bridge(self, name, value, sender):
if(isinstance(sender, (MonoEncoderElement, CodecEncoderElement))):
pn = str(self.generate_strip_string(name))
pv = str(self.generate_strip_string(value))
self._monobridge._send(sender.name, 'lcd_name', pn)
self._monobridge._send(sender.name, 'lcd_value', pv)
def touched(self):
if self._touched is 0:
self._monobridge._send('touch', 'on')
self.schedule_message(2, self.check_touch)
self._touched +=1
def check_touch(self):
if self._touched > 5:
self._touched = 5
elif self._touched > 0:
self._touched -= 1
if self._touched is 0:
self._monobridge._send('touch', 'off')
else:
self.schedule_message(2, self.check_touch)
def handle_sysex(self, midi_bytes):
pass
def disconnect(self):
self.log_message("<<<<<<<<<<<<<<<<<<<<<<<<< " + str(self._host_name) + " log closed >>>>>>>>>>>>>>>>>>>>>>>>>")
super(Crate, self).disconnect()
def handle_sysex(self, midi_bytes):
#debug('sysex: ', str(midi_bytes))
示例11: GuitarWing
# 需要导入模块: from _Mono_Framework.MonoBridgeElement import MonoBridgeElement [as 别名]
# 或者: from _Mono_Framework.MonoBridgeElement.MonoBridgeElement import _send [as 别名]
#.........这里部分代码省略.........
if isinstance(__builtins__, dict):
if not 'monomodular' in __builtins__.keys() or not isinstance(__builtins__['monomodular'], ModRouter):
__builtins__['monomodular'] = ModRouter()
else:
if not hasattr(__builtins__, 'monomodular') or not isinstance(__builtins__['monomodular'], ModRouter):
setattr(__builtins__, 'monomodular', ModRouter())
self.monomodular = __builtins__['monomodular']
if not self.monomodular.has_host():
self.monomodular.set_host(self)
self.monomodular.name = 'monomodular_switcher'
self.modhandler = GuitarWingModHandler(script = self)
self.modhandler.name = 'ModHandler'
# self.log_message('mod is: ' + str(self.monomodular) + ' ' + str(__builtins__['monomodular']))
def _setup_OSC_layer(self):
self._OSC_id = 0
if hasattr(__builtins__, 'control_surfaces') or (isinstance(__builtins__, dict) and 'control_surfaces' in __builtins__.keys()):
for cs in __builtins__['control_surfaces']:
if cs is self:
break
elif isinstance(cs, GuitarWing):
self._OSC_id += 1
self._prefix = '/Live/GuitarWing/'+str(self._OSC_id)
self._outPrt = OSC_OUTPORT
if not self.oscServer is None:
self.oscServer.shutdown()
self.oscServer = RemixNet.OSCServer('localhost', self._outPrt, 'localhost', 10001)
def _deassign_all(self):
self.modhandler._fader_color_override = False
self._send_midi(tuple([240, 0, 1, 97, 12, 50, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 247]))
self._send_midi(tuple([191, 122, 64])) #turn local OFF for CapFaders
#for index in range(8):
# self._send_midi(tuple([191, index+10, 125]))
#self._send_midi(tuple([191, 18, 105]))
self._current_nav_buttons = []
with self.component_guard():
self.release_controlled_track()
self._step_sequencer.set_loop_selector_matrix(None)
self._step_sequencer.set_quantization_buttons(None)
self._step_sequencer.set_follow_button(None)
self._step_sequencer.set_button_matrix(None)
self._step_sequencer.set_drum_matrix(None)
self._step_sequencer.set_drum_bank_up_button(None)
self._step_sequencer.set_drum_bank_down_button(None)
self._step_sequencer.set_mute_button(None)
self._step_sequencer.set_solo_button(None)
self._step_sequencer.set_playhead(None)
self._on_note_matrix_pressed.subject = None
self._note_sequencer.set_loop_selector_matrix(None)
self._note_sequencer.set_quantization_buttons(None)
self._note_sequencer.set_follow_button(None)
self._note_sequencer.set_button_matrix(None)
self._note_sequencer.set_playhead(None)
self._drumgroup.set_drum_matrix(None)
self.modhandler._assign_keys(None)
self.modhandler._assign_base_grid(None)
self.modhandler._assign_base_grid_CC(None)
self.modhandler.set_shift_button(None)
示例12: AumPC40
# 需要导入模块: from _Mono_Framework.MonoBridgeElement import MonoBridgeElement [as 别名]
# 或者: from _Mono_Framework.MonoBridgeElement.MonoBridgeElement import _send [as 别名]
#.........这里部分代码省略.........
elif(self._monomod_mode._mode_index == 1):
self._transport.set_nudge_buttons(None, None)
for track in range(8):
self._mixer.channel_strip(track).set_select_button(None)
self._mixer.channel_strip(track).set_solo_button(None)
self._session.set_enabled(False)
self._session_zoom.set_enabled(False)
self._session.set_track_bank_buttons(None, None)
self._session.set_scene_bank_buttons(None, None)
self.flash_status = 1
self._monomod.reset()
self._host._set_button_matrix(self._monomod)
self._host._set_nav_buttons([self._up_button, self._down_button, self._left_button, self._right_button])
self._host._set_shift_button(self._shift_button)
self._host._set_lock_button(self._nudge_up_button)
self._host._set_alt_button(self._nudge_down_button)
self._host.set_enabled(True)
self.request_rebuild_midi_map()
self._master_select_button.turn_on()
#self.log_message('mod mode')
"""m4l bridge"""
def generate_strip_string(self, display_string):
#self.log_message(display_string)
NUM_CHARS_PER_DISPLAY_STRIP = 12
if (not display_string):
return (' ' * NUM_CHARS_PER_DISPLAY_STRIP)
if ((len(display_string.strip()) > (NUM_CHARS_PER_DISPLAY_STRIP - 1)) and (display_string.endswith('dB') and (display_string.find('.') != -1))):
display_string = display_string[:-2]
if (len(display_string) > (NUM_CHARS_PER_DISPLAY_STRIP - 1)):
for um in [' ',
'i',
'o',
'u',
'e',
'a']:
while ((len(display_string) > (NUM_CHARS_PER_DISPLAY_STRIP - 1)) and (display_string.rfind(um, 1) != -1)):
um_pos = display_string.rfind(um, 1)
display_string = (display_string[:um_pos] + display_string[(um_pos + 1):])
else:
display_string = display_string.center((NUM_CHARS_PER_DISPLAY_STRIP - 1))
ret = u''
for i in range((NUM_CHARS_PER_DISPLAY_STRIP - 1)):
if ((ord(display_string[i]) > 127) or (ord(display_string[i]) < 0)):
ret += ' '
else:
ret += display_string[i]
ret += ' '
assert (len(ret) == NUM_CHARS_PER_DISPLAY_STRIP)
return ret
def notification_to_bridge(self, name, value, sender):
if isinstance(sender, (MonoRingedEncoderElement, MonoEncoderElement)):
self._monobridge._send(sender.name, 'lcd_name', str(self.generate_strip_string(name)))
self._monobridge._send(sender.name, 'lcd_value', str(self.generate_strip_string(value)))
def touched(self):
if self._touched is 0:
self._monobridge._send('touch', 'on')
self.schedule_message(2, self.check_touch)
self._touched +=1
def check_touch(self):
if self._touched > 5:
self._touched = 5
elif self._touched > 0:
self._touched -= 1
if self._touched is 0:
self._monobridge._send('touch', 'off')
else:
self.schedule_message(2, self.check_touch)
def get_clip_names(self):
clip_names = []
for scene in self._session._scenes:
for clip_slot in scene._clip_slots:
if clip_slot.has_clip() is True:
clip_names.append(clip_slot._clip_slot)##.clip.name)
return clip_slot._clip_slot
##self.log_message(str(clip_slot._clip_slot.clip.name))
return clip_names
def update_display(self):
ControlSurface.update_display(self)
self._timer = (self._timer + 1) % 256
self.flash()
def flash(self):
if self.flash_status:
for control in self.controls:
if isinstance(control, MonoButtonElement):
control.flash(self._timer)