本文整理汇总了Python中_Framework.ChannelTranslationSelector.ChannelTranslationSelector类的典型用法代码示例。如果您正苦于以下问题:Python ChannelTranslationSelector类的具体用法?Python ChannelTranslationSelector怎么用?Python ChannelTranslationSelector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ChannelTranslationSelector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _mode_value
def _mode_value(self, value, sender):
ChannelTranslationSelector._mode_value(self, value, sender)
if ((value != 0) or (not sender.is_momentary())):
if (self._mode_index != 8):
self.show_modes()
else:
#self._mixer._extra_device.show_device()
self._mixer._extra_device.show_device_parameters()
示例2: disconnect
def disconnect(self):
ChannelTranslationSelector.disconnect(self)
if (self._master_mode_button != None):
self._master_mode_button.remove_value_listener(self.master_mode_value)
self._master_mode_button = None
self._mixer = None
self._sliders = None
#self._mode_button = None
return None
示例3: __init__
def __init__(self, mixer, pots):
assert DEFAULT_POT_MODE < 8
ChannelTranslationSelector.__init__(self)
self._master_mode = False
self._mode_names = [' TRACK ',' PAN ',' SEND A ',' SEND B ',' SEND C ',' SEND D ',' SEND E ',' SEND F ',' DEVICE ']
self._mixer = mixer
self._pots = pots
#self._extra_device = None
self.set_mode(DEFAULT_POT_MODE)
示例4: __init__
def __init__(self, mixer, session, sliders, button_modes, shift_mode, encoder_modes, pot_modes):
assert len(sliders) == 8
ChannelTranslationSelector.__init__(self)
self._master_mode = False
self._master_mode_button = None
self._sliders = sliders
self._mixer = mixer
self._session = session
self._button_modes = button_modes
self._shift_mode = shift_mode
self._encoder_modes = encoder_modes
self._pot_modes = pot_modes
self.update_master_mode_button()
self.set_mode(0)
示例5: _setup_device_control
def _setup_device_control(self):
is_momentary = True
device_bank_buttons = []
device_param_controls = []
for index in range(8):
device_bank_buttons.append(ButtonElement(is_momentary, MIDI_NOTE_TYPE, 12, (70 + index)))
device_param_controls.append(EncoderElement(MIDI_CC_TYPE, 12, (12 + index), Live.MidiMap.MapMode.absolute))
device = DeviceComponent()
device.set_bank_buttons(tuple(device_bank_buttons))
device.set_parameter_controls(tuple(device_param_controls))
device_translation_selector = ChannelTranslationSelector()
device_translation_selector.set_controls_to_translate(tuple(device_param_controls))
device_translation_selector.set_mode_buttons(tuple(device_bank_buttons))
self.set_device_component(device)
示例6: __init__
def __init__(self):
DeviceComponent.__init__(self)
self.device_listener = None
self.device_parm_listener = None
self._control_translation_selector = ChannelTranslationSelector(8)
self.clear_mode = True
self.touch_mode = False
self.del_parm_map = {}
self.del_clip_map = {}
self.del_touch_buttons = []
示例7: _setup_global_control
def _setup_global_control(self):
is_momentary = True
self._global_bank_buttons = []
self._global_param_controls = []
for index in range(8):
ring_button = ButtonElement(not is_momentary, MIDI_CC_TYPE, 0, 56 + index)
ringed_encoder = RingedEncoderElement(MIDI_CC_TYPE, 0, 48 + index, Live.MidiMap.MapMode.absolute)
ringed_encoder.name = 'Track_Control_' + str(index)
ringed_encoder.set_feedback_delay(-1)
ring_button.name = ringed_encoder.name + '_Ring_Mode_Button'
ringed_encoder.set_ring_mode_button(ring_button)
self._global_param_controls.append(ringed_encoder)
self._global_bank_buttons = []
global_bank_labels = ('Pan_Button', 'Send_A_Button', 'Send_B_Button', 'Send_C_Button')
for index in range(4):
self._global_bank_buttons.append(ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 87 + index))
self._global_bank_buttons[-1].name = global_bank_labels[index]
self._encoder_modes = EncModeSelectorComponent(self._mixer)
self._encoder_modes.name = 'Track_Control_Modes'
self._encoder_modes.set_controls(tuple(self._global_param_controls))
self._encoder_device_modes = EncoderDeviceComponent(self._mixer, self._device, self)
self._encoder_device_modes.name = 'Alt_Device_Control_Modes'
self._encoder_eq_modes = EncoderEQComponent(self._mixer, self)
self._encoder_eq_modes.name = 'EQ_Control_Modes'
global_translation_selector = ChannelTranslationSelector()
global_translation_selector.name = 'Global_Translations'
global_translation_selector.set_controls_to_translate(tuple(self._global_param_controls))
global_translation_selector.set_mode_buttons(tuple(self._global_bank_buttons))
encoder_user_modes = EncoderUserModesComponent(self, self._encoder_modes, tuple(self._global_param_controls), tuple(self._global_bank_buttons), self._mixer, self._device, self._encoder_device_modes, self._encoder_eq_modes)
encoder_user_modes.name = 'Encoder_User_Modes'
self._encoder_shift_modes = ShiftableEncoderSelectorComponent(self, tuple(self._global_bank_buttons), encoder_user_modes, self._encoder_modes, self._encoder_eq_modes, self._encoder_device_modes)
self._encoder_shift_modes.name = 'Encoder_Shift_Modes'
self._encoder_shift_modes.set_mode_toggle(self._shift_button)
示例8: _setup_global_control
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 = RingedEncoderElement(MIDI_CC_TYPE, 0, 48 + index, Live.MidiMap.MapMode.absolute)
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(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))
示例9: _setup_global_control
def _setup_global_control(self):
is_momentary = True
self._global_bank_buttons = []
self._global_param_controls = []
for index in range(8):
ring_button = ButtonElement(not is_momentary, MIDI_CC_TYPE, 0, 56 + index)
ringed_encoder = RingedEncoderElement(MIDI_CC_TYPE, 0, 48 + index, Live.MidiMap.MapMode.absolute)
ringed_encoder.name = 'Track_Control_' + str(index)
ringed_encoder.set_feedback_delay(-1)
ring_button.name = ringed_encoder.name + '_Ring_Mode_Button'
ringed_encoder.set_ring_mode_button(ring_button)
self._global_param_controls.append(ringed_encoder)
self._global_bank_buttons = []
global_bank_labels = ('Pan_Button', 'Send_A_Button', 'Send_B_Button', 'Send_C_Button')
for index in range(4):
self._global_bank_buttons.append(ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 87 + index))#(not is_momentary, MIDI_NOTE_TYPE, 0, 87 + index))
self._global_bank_buttons[-1].name = global_bank_labels[index]
self._encoder_modes = EncoderMixerModeSelectorComponent(self._mixer)
self._encoder_modes.name = 'Track_Control_Modes'
#self._encoder_modes.set_modes_buttons(self._global_bank_buttons) # set in ShiftableEncoderSelectorComponent
self._encoder_modes.set_controls(tuple(self._global_param_controls))
#self._encoder_device_modes = EncoderDeviceModeSelectorComponent(self._mixer, self._device) #new
self._encoder_device_modes = EncoderDeviceComponent(self._mixer, self._device, self)
self._encoder_device_modes.name = 'Alt_Device_Control_Modes' #new
self._encoder_eq_modes = EncoderEQComponent(self._mixer, self)#EncoderEQModeSelectorComponent(self._mixer) #new
self._encoder_eq_modes.name = 'EQ_Control_Modes' #new
global_translation_selector = ChannelTranslationSelector() #translate track encoders to channels 1 through 4, based on button selection (pan = 1, send A = 2, send B = 3, send C = 4)
global_translation_selector.name = 'Global_Translations'
global_translation_selector.set_controls_to_translate(tuple(self._global_param_controls))
global_translation_selector.set_mode_buttons(tuple(self._global_bank_buttons))
encoder_user_modes = EncoderUserModesComponent(self, self._encoder_modes, tuple(self._global_param_controls), tuple(self._global_bank_buttons), self._mixer, self._device, self._encoder_device_modes, self._encoder_eq_modes) #self._mixer, tuple(sliders)) #added
encoder_user_modes.name = 'Encoder_User_Modes' #added
self._encoder_shift_modes = ShiftableEncoderSelectorComponent(self, tuple(self._global_bank_buttons), encoder_user_modes, self._encoder_modes, self._encoder_eq_modes, self._encoder_device_modes) #tuple(select_buttons), master_select_button, tuple(arm_buttons), self._matrix, self._session, self._session_zoom, self._mixer, slider_modes, matrix_modes) #, self._send_introduction_message) #also added self for _parent
self._encoder_shift_modes.name = 'Encoder_Shift_Modes'
self._encoder_shift_modes.set_mode_toggle(self._shift_button)
示例10: MaschineDeviceComponent
class MaschineDeviceComponent(DeviceComponent):
""" Class representing a device in Live """
def __init__(self, surface):
DeviceComponent.__init__(self)
self.surface = surface
self.device_listener = None
self.device_parm_listener = None
self._control_translation_selector = ChannelTranslationSelector(8)
def set_device(self, device):
DeviceComponent.set_device(self, device)
if self.device_listener != None:
self.device_listener(device)
def set_parameter_controls(self, controls):
DeviceComponent.set_parameter_controls(self, controls)
self._control_translation_selector.set_controls_to_translate(controls)
self._control_translation_selector.set_mode(self._bank_index)
def _on_parameters_changed(self):
DeviceComponent._on_parameters_changed(self)
if self.device_parm_listener != None:
self.device_parm_listener()
def set_device_changed_listener(self, listener):
self.device_listener = listener
def set_device_parm_listener(self, listener):
self.device_parm_listener = listener
def show_message(self, message):
self.surface.show_message(message)
def disconnect(self):
DeviceComponent.disconnect(self)
self._control_translation_selector.disconnect()
self.surface = None
self.device_listener = None
self.device_parm_listener = None
示例11: ShiftableDeviceComponent
class ShiftableDeviceComponent(DeviceComponent):
""" DeviceComponent that only uses bank buttons if a shift button is pressed """
def __init__(self):
DeviceComponent.__init__(self)
self._shift_button = None
self._shift_pressed = False
self._control_translation_selector = ChannelTranslationSelector(8)
def disconnect(self):
DeviceComponent.disconnect(self)
self._control_translation_selector.disconnect()
if self._shift_button != None:
self._shift_button.remove_value_listener(self._shift_value)
self._shift_button = None
def set_parameter_controls(self, controls):
DeviceComponent.set_parameter_controls(self, controls)
self._control_translation_selector.set_controls_to_translate(controls)
self._control_translation_selector.set_mode(self._bank_index)
def set_device(self, device):
DeviceComponent.set_device(self, device)
self._control_translation_selector.set_mode(self._bank_index)
def set_shift_button(self, button):
if not (button == None or isinstance(button, ButtonElement) and button.is_momentary()):
raise AssertionError
if self._shift_button != button:
if self._shift_button != None:
self._shift_button.remove_value_listener(self._shift_value)
self._shift_button = button
self._shift_button != None and self._shift_button.add_value_listener(self._shift_value)
self.update()
def update(self):
if self._parameter_controls != None:
for control in self._parameter_controls:
control.release_parameter()
if self.is_enabled() and self._device != None:
self._device_bank_registry.set_device_bank(self._device, self._bank_index)
if self._parameter_controls != None:
if self._bank_index < number_of_parameter_banks(self._device):
old_bank_name = self._bank_name
self._assign_parameters()
if self._bank_name != old_bank_name:
self._show_msg_callback(self._device.name + ' Bank: ' + self._bank_name)
self._shift_pressed or self._on_on_off_changed()
elif self._bank_buttons != None:
for index in range(len(self._bank_buttons)):
if index == self._bank_index:
self._bank_buttons[index].turn_on()
else:
self._bank_buttons[index].turn_off()
def _shift_value(self, value):
raise self._shift_button != None or AssertionError
raise value in range(128) or AssertionError
self._shift_pressed = value != 0
self.update()
def _bank_value(self, value, sender):
if not (sender != None and sender in self._bank_buttons):
raise AssertionError
if self._shift_pressed and self.is_enabled():
self._bank_name = (value != 0 or not sender.is_momentary()) and ''
self._bank_index = list(self._bank_buttons).index(sender)
self._control_translation_selector.set_mode(self._bank_index)
self.update()
def _on_off_value(self, value):
if not self._shift_pressed:
DeviceComponent._on_off_value(self, value)
def _on_on_off_changed(self):
if not self._shift_pressed:
DeviceComponent._on_device_on_off_changed(self)
示例12: __init__
def __init__(self):
DeviceComponent.__init__(self)
self._shift_button = None
self._shift_pressed = False
self._control_translation_selector = ChannelTranslationSelector(8)
示例13: ShiftableDeviceComponent
class ShiftableDeviceComponent(DeviceComponent):
' DeviceComponent that only uses bank buttons if a shift button is pressed '
__module__ = __name__
def __init__(self):
DeviceComponent.__init__(self)
self._shift_button = None
self._shift_pressed = False
self._control_translation_selector = ChannelTranslationSelector(8)
def disconnect(self):
DeviceComponent.disconnect(self)
self._control_translation_selector.disconnect()
if (self._shift_button != None):
self._shift_button.remove_value_listener(self._shift_value)
self._shift_button = None
def set_parameter_controls(self, controls):
DeviceComponent.set_parameter_controls(self, controls)
self._control_translation_selector.set_controls_to_translate(controls)
self._control_translation_selector.set_mode(self._bank_index)
def set_device(self, device):
DeviceComponent.set_device(self, device)
self._control_translation_selector.set_mode(self._bank_index)
def set_shift_button(self, button):
assert ((button == None) or (isinstance(button, ButtonElement) and button.is_momentary()))
if (self._shift_button != button):
if (self._shift_button != None):
self._shift_button.remove_value_listener(self._shift_value)
self._shift_button = button
if (self._shift_button != None):
self._shift_button.add_value_listener(self._shift_value)
self.update()
def update(self):
if (self._parameter_controls != None):
for control in self._parameter_controls:
control.release_parameter()
if (self.is_enabled() and (self._device != None)):
self._device_bank_registry[self._device] = self._bank_index
if ((self._parameter_controls != None) and (self._bank_index < number_of_parameter_banks(self._device))):
old_bank_name = self._bank_name
self._assign_parameters()
if (self._bank_name != old_bank_name):
self._show_msg_callback(((self._device.name + ' Bank: ') + self._bank_name))
if (not self._shift_pressed):
self._on_on_off_changed()
elif (self._bank_buttons != None):
for index in range(len(self._bank_buttons)):
if (index == self._bank_index):
self._bank_buttons[index].turn_on()
else:
self._bank_buttons[index].turn_off()
#self._rebuild_callback()
def _shift_value(self, value):
assert (self._shift_button != None)
assert (value in range(128))
self._shift_pressed = (value != 0)
self.update()
def _bank_value(self, value, sender):
assert ((sender != None) and (sender in self._bank_buttons))
if (self._shift_pressed and self.is_enabled()):
if ((value != 0) or (not sender.is_momentary())):
self._bank_name = ''
self._bank_index = list(self._bank_buttons).index(sender)
self._control_translation_selector.set_mode(self._bank_index)
self.update()
def _on_off_value(self, value):
if not self._shift_pressed:
DeviceComponent._on_off_value(self, value)
def _on_on_off_changed(self):
if not self._shift_pressed:
DeviceComponent._on_on_off_changed(self)
#.........这里部分代码省略.........
示例14: MaschineDeviceComponent
class MaschineDeviceComponent(DeviceComponent):
""" Class representing a device in Live """
def __init__(self):
DeviceComponent.__init__(self)
self.device_listener = None
self.device_parm_listener = None
self._control_translation_selector = ChannelTranslationSelector(8)
self.clear_mode = True
self.touch_mode = False
self.del_parm_map = {}
self.del_clip_map = {}
self.del_touch_buttons = []
def _on_device_name_changed(self):
if self._device != None:
self.canonical_parent.send_to_display('Device: ' + self._device.name, 1)
else:
self.canonical_parent.send_to_display('<No Device>', 1)
def update(self):
if self.is_enabled() and self._device != None:
self._device_bank_registry.set_device_bank(self._device, self._bank_index)
if self._parameter_controls != None:
old_bank_name = self._bank_name
self._assign_parameters()
if self._bank_name != old_bank_name:
self._show_msg_callback(self._device.name + ' Bank: ' + self._bank_name)
self.canonical_parent.update_bank_display()
if self._bank_up_button != None and self._bank_down_button != None:
can_bank_up = self._bank_index == None or self._number_of_parameter_banks() > self._bank_index + 1
can_bank_down = self._bank_index == None or self._bank_index > 0
self._bank_up_button.set_light(can_bank_up)
self._bank_down_button.set_light(can_bank_down)
if self._bank_buttons != None:
for index, button in enumerate(self._bank_buttons):
button.set_light(index == self._bank_index)
else:
if self._lock_button != None:
self._lock_button.turn_off()
if self._bank_up_button != None:
self._bank_up_button.turn_off()
if self._bank_down_button != None:
self._bank_down_button.turn_off()
if self._bank_buttons != None:
for button in self._bank_buttons:
button.turn_off()
if self._parameter_controls != None:
self._release_parameters(self._parameter_controls)
def set_touch_mode(self, touchchannel):
self.touch_mode = True
nr_dev_ctrl = len(self._parameter_controls)
for ctrl in self._parameter_controls:
touch_button = ButtonElement(False, MIDI_CC_TYPE, touchchannel, ctrl.message_identifier())
self.del_touch_buttons.append(touch_button)
touch_button.add_value_listener(self._clear_param, True)
def enter_clear_mode(self):
self.clear_mode = True
self.del_parm_map = {}
self.del_clip_map = {}
for control in self._parameter_controls:
key = control.message_identifier()
self.del_parm_map[key] = control.mapped_parameter()
self.touch_mode or control.add_value_listener(self._clear_param, True)
self.touch_mode or self.set_enabled(False)
def exit_clear_mode(self):
self.clear_mode = False
self.touch_mode or self.set_enabled(True)
for control in self._parameter_controls:
self.touch_mode or control.remove_value_listener(self._clear_param)
def _get_track_of_device(self, obj):
if obj != None:
parent = obj.canonical_parent
if isinstance(parent, Live.Track.Track):
return parent
else:
return self._get_track_of_device(parent)
def _get_clip_of_device(self):
track = self._get_track_of_device(self._device)
if track:
if track.can_be_armed:
for clip_slot in track.clip_slots:
if clip_slot.has_clip and clip_slot.is_playing:
return clip_slot.clip
def _clear_param(self, value, control):
key = control.message_identifier()
if self._device and key in self.del_parm_map:
if not (key in self.del_clip_map and self.del_clip_map[key]):
prev_clip = None
clip = self._get_clip_of_device()
clip and clip != prev_clip and clip.clear_envelope(self.del_parm_map[key])
#.........这里部分代码省略.........
示例15: APC40
#.........这里部分代码省略.........
self.transport.set_nudge_buttons(nudge_up_button, nudge_down_button)
self.transport.set_undo_button(nudge_down_button) #shifted nudge
self.transport.set_redo_button(nudge_up_button) #shifted nudge
self.transport.set_tap_tempo_button(tap_tempo_button)
self.transport.set_quant_toggle_button(self.device_bank_buttons[5])
self.transport.set_overdub_button(self.device_bank_buttons[6])
self.transport.set_metronome_button(self.device_bank_buttons[7])
self._prehear_control = EncoderElement(MIDI_CC_TYPE, 0, 47, Live.MidiMap.MapMode.relative_two_compliment)
self.transport.set_tempo_encoder(self._prehear_control) #shifted prehear
bank_button_translator = ShiftTranslatorComponent()
bank_button_translator.set_controls_to_translate(tuple(self.device_bank_buttons))
bank_button_translator.set_shift_button(self._shift_button)
def _setup_global_control(self):
is_momentary = True
global_bank_buttons = []
self.global_param_controls = []
for index in range(8):
ring_button = ButtonElement(not is_momentary, MIDI_CC_TYPE, 0, 56 + index)
ringed_encoder = RingedEncoderElement(MIDI_CC_TYPE, 0, 48 + index, Live.MidiMap.MapMode.absolute)
ringed_encoder.name = 'Track_Control_' + str(index)
ring_button.name = ringed_encoder.name + '_Ring_Mode_Button'
ringed_encoder.set_ring_mode_button(ring_button)
self.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]
self.encoder_modes = EncModeSelectorComponent(self._mixer)
self.encoder_modes.name = 'Track_Control_Modes'
self.encoder_modes.set_modes_buttons(global_bank_buttons)
self.encoder_modes.set_controls(tuple(self.global_param_controls))
self.global_translation_selector = ChannelTranslationSelector()
self.global_translation_selector.name = 'Global_Translations'
self.global_translation_selector.set_controls_to_translate(tuple(self.global_param_controls))
self.global_translation_selector.set_mode_buttons(tuple(global_bank_buttons))
def _on_selected_track_changed(self):
ControlSurface._on_selected_track_changed(self)
## Quirksmode
if(self._newDjModeToggle_state):
if self.application().view.is_view_visible('Detail/Clip'):
self.application().view.show_view('Detail/DeviceChain')
self.application().view.is_view_visible('Detail/DeviceChain')
else:
self.application().view.show_view('Detail/Clip')
self.application().view.is_view_visible('Detail/Clip')
if(self.song().view.selected_track != self.song().master_track):
if (self.song().view.selected_track.playing_slot_index > -1):
self.song().view.selected_scene = self.song().scenes[self.song().view.selected_track.playing_slot_index]
track_index = 0
for track in self.song().tracks:
if track == self.song().view.selected_track:
break
track_index += 1
self.current_track = track_index
track = self.song().view.selected_track