本文整理汇总了Python中_Framework.EncoderElement.EncoderElement类的典型用法代码示例。如果您正苦于以下问题:Python EncoderElement类的具体用法?Python EncoderElement怎么用?Python EncoderElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EncoderElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _setup_mixer_control
def _setup_mixer_control(self):
is_momentary = True
self._mixer = SpecialMixerComponent(8)
self._mixer.name = 'Mixer'
self._mixer.master_strip().name = 'Master_Channel_Strip'
self._mixer.selected_strip().name = 'Selected_Channel_Strip'
self._solo_buttons = []
for track in range(8):
strip = self._mixer.channel_strip(track)
strip.name = 'Channel_Strip_' + str(track)
solo_button = FlashingButtonElement(is_momentary, MIDI_NOTE_TYPE, track, 50, self)
self._solo_buttons.append(solo_button)
mute_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, track, 49)
solo_button.name = str(track) + '_Solo_Button'
mute_button.name = str(track) + '_Mute_Button'
strip.set_solo_button(solo_button)
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)
示例2: __init__
def __init__(self, identifier):
EncoderElement.__init__(
self,
msg_type=MIDI_CC_TYPE,
channel=self.channel,
identifier=identifier,
map_mode=self.map_mode)
示例3: install_connections
def install_connections(self, install_translation_callback, install_mapping_callback, install_forwarding_callback):
EncoderElement.install_connections(
self, install_translation_callback, install_mapping_callback, install_forwarding_callback
)
if not self._is_mapped and self.value_listener_count() == 0:
self._is_being_forwarded = install_forwarding_callback(self)
self._update_ring_mode()
示例4: _setup_mixer_control
def _setup_mixer_control(self):
is_momentary = True # We use non-latching buttons (keys) throughout, so we'll set this as a constant
num_tracks = 7 # Here we define the mixer width in tracks (a mixer has only one dimension)
global mixer # We want to instantiate the global mixer as a MixerComponent object (it was a global "None" type up until now...)
mixer = MixerComponent(num_tracks, 0) #(num_tracks, num_returns, with_eqs, with_filters)
mixer.set_track_offset(0) #Sets start point for mixer strip (offset from left)
"""set up the mixer buttons"""
self.song().view.selected_track = mixer.channel_strip(0)._track
mixer.selected_strip().set_mute_button(ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, 64))
#mixer.selected_strip().set_solo_button(ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, 44))
mixer.selected_strip().set_arm_button(ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, 72))
track_select_notes = [65, 73, 66, 74, 67, 75, 68, 76] #more note numbers need to be added if num_scenes is increased
slider_select_notes = [23, 22, 15, 14, 5, 7, 6, 4]
pan_select_notes = [21, 20, 13, 12, 3, 1, 0, 2]
master_volume_control = SliderElement(MIDI_CC_TYPE, 0, 4)
master_select_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 76)
prehear_control = EncoderElement(MIDI_CC_TYPE, 0, 26, Live.MidiMap.MapMode.absolute)
crossfader = SliderElement(MIDI_CC_TYPE, 0, 24)
for index in range(num_tracks):
mixer.channel_strip(index).set_select_button(ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, track_select_notes[index]))
mixer.channel_strip(index).set_volume_control(SliderElement(MIDI_CC_TYPE, CHANNEL, slider_select_notes[index]))
mixer.channel_strip(index).set_pan_control(EncoderElement(MIDI_CC_TYPE, CHANNEL, pan_select_notes[index], Live.MidiMap.MapMode.absolute))
crossfader.name = 'Crossfader'
master_volume_control.name = 'Master_Volume_Control'
master_select_button.name = 'Master_Select_Button'
prehear_control.name = 'Prehear_Volume_Control'
mixer.set_crossfader_control(crossfader)
mixer.set_prehear_volume_control(prehear_control)
mixer.master_strip().set_volume_control(master_volume_control)
mixer.master_strip().set_select_button(master_select_button)
示例5: __init__
def __init__(self, msg_type, channel, identifier, map_mode, send_channel=None, identifier_send_offset=0):
EncoderElement.__init__(self, msg_type, channel, identifier, map_mode)
self._identify_mode = False
self._send_channel = send_channel
self._identifier_send_offset = identifier_send_offset
self._on_value = 127
self._off_value = 0
self._force_next_value = False
示例6: connect_to
def connect_to(self, parameter):
if ((parameter != self._parameter_to_map_to) and (not self.is_mapped_manually())):
force_send = True
#self._ring_mode_button.send_value(RING_OFF_VALUE, force_send)
EncoderElement.connect_to(self, parameter)
if (self._parameter_to_map_to.value_has_listener(self.update_ring)):
self._parameter_to_map_to.remove_value_listener(self.update_ring)
self._parameter_to_map_to.add_value_listener(self.update_ring)
示例7: install_connections
def install_connections(self): #this override has to be here so that translation will happen when buttons are disabled
if self._is_enabled:
EncoderElement.install_connections(self)
elif ((self._msg_channel != self._original_channel) or (self._msg_identifier != self._original_identifier)):
self._install_translation(self._msg_type, self._original_identifier, self._original_channel, self._msg_identifier, self._msg_channel)
#if ((not self._is_mapped) and (len(self._value_notifications) == 0)):
# self._is_being_forwarded = self._install_forwarding(self)
self._update_ring_mode()
示例8: _init_device_component
def _init_device_component(self, device_controls, bank_controls, global_channel, macro_map_mode):
is_momentary = True
if device_controls:
device = DeviceComponent()
device.name = 'Device_Component'
if bank_controls:
next_button = None
prev_button = None
if 'NEXTBANK' in bank_controls.keys() and bank_controls['NEXTBANK'] in range(128):
next_button = ButtonElement(is_momentary, MIDI_CC_TYPE, global_channel, bank_controls['NEXTBANK'])
next_button.name = 'Device_Next_Bank_Button'
if 'PREVBANK' in bank_controls.keys() and bank_controls['PREVBANK'] in range(128):
prev_button = ButtonElement(is_momentary, MIDI_CC_TYPE, global_channel, bank_controls['PREVBANK'])
prev_button.name = 'Device_Previous_Bank_Button'
device.set_bank_nav_buttons(prev_button, next_button)
if 'TOGGLELOCK' in bank_controls.keys() and bank_controls['TOGGLELOCK'] in range(128):
lock_button = ButtonElement(is_momentary, MIDI_CC_TYPE, global_channel, bank_controls['TOGGLELOCK'])
lock_button.name = 'Device_Lock_Button'
device.set_lock_button(lock_button)
bank_buttons = []
for index in range(8):
key = 'BANK' + str(index + 1)
if key in bank_controls.keys():
control_info = bank_controls[key]
channel = global_channel
cc = -1
if isinstance(control_info, (tuple, list)):
cc = control_info[0]
if control_info[1] in range(16):
channel = control_info[1]
else:
cc = control_info
if cc in range(128) and channel in range(16):
button = ButtonElement(is_momentary, MIDI_CC_TYPE, channel, cc)
button.name = 'Device_Bank_' + str(index) + '_Button'
bank_buttons.append(button)
if len(bank_buttons) > 0:
device.set_bank_buttons(tuple(bank_buttons))
parameter_encoders = []
for control_info in device_controls:
channel = global_channel
cc = -1
if isinstance(control_info, (tuple, list)):
cc = control_info[0]
if control_info[1] in range(16):
channel = control_info[1]
else:
cc = control_info
if cc in range(128) and channel in range(16):
encoder = EncoderElement(MIDI_CC_TYPE, channel, cc, macro_map_mode)
encoder.name = 'Device_Parameter_' + str(list(device_controls).index(control_info)) + '_Control'
parameter_encoders.append(encoder)
if len(parameter_encoders) > 0:
device.set_parameter_controls(tuple(parameter_encoders))
self.set_device_component(device)
return
示例9: Alias8
class Alias8(ControlSurface):
num_tracks = 8
knobs_top = [1, 2, 3, 4, 5, 6, 7, 8]
knobs_bottom = [9, 10, 11, 12, 13, 14, 15, 16]
faders = [17, 18, 19, 20, 21, 22, 23, 24]
master_fader = 25
encoder = 42
buttons_top = [0, 1, 2, 3, 4, 5, 6, 7]
buttons_bottom = [8, 9, 10, 11, 12, 13, 14, 15]
def __init__(self, instance):
super(Alias8, self).__init__(instance, False)
with self.component_guard():
self._set_suppress_rebuild_requests(True)
self.init_session()
self.init_mixer()
# Connect mixer to session.
self.session.set_mixer(self.mixer)
self.session.update()
# New in Live 9: must explicitly activate session component.
self.set_highlighting_session_component(self.session)
self._set_suppress_rebuild_requests(False)
def init_session(self):
self.session = SessionComponent(self.num_tracks, 1)
self.session.name = 'Alias 8 Session'
self.session.update()
# Connect the encoder to track scroller.
def scroll_cb(value):
if value == 1:
self.session._horizontal_banking.scroll_down()
elif value == 127:
self.session._horizontal_banking.scroll_up()
self.track_encoder = EncoderElement(MIDI_CC_TYPE, 0, self.encoder,
Live.MidiMap.MapMode.absolute)
self.track_encoder.add_value_listener(scroll_cb)
def init_mixer(self):
self.mixer = MixerComponent(self.num_tracks, 0)
self.mixer.id = 'Mixer'
self.song().view.selected_track = self.mixer.channel_strip(0)._track
for i in range(self.num_tracks):
self.mixer.channel_strip(i).set_volume_control(
fader(self.faders[i]))
self.mixer.channel_strip(i).set_solo_button(
button(self.buttons_top[i], color=CYAN))
self.mixer.channel_strip(i).set_arm_button(
button(self.buttons_bottom[i], color=RED))
self.mixer.channel_strip(i).set_pan_control(
knob(self.knobs_bottom[i]))
self.mixer.master_strip().set_volume_control(fader(self.master_fader))
self.mixer.update()
示例10: __init__
def __init__(self, msg_type, channel, identifier, map_mode, name, num, script):
EncoderElement.__init__(self, msg_type, channel, identifier, map_mode=Live.MidiMap.MapMode.absolute)
self.name = name
self.num = num
self._parameter = None
self._script = script
self._is_enabled = True
self._paramter_lcd_name = ' '
self._parameter_last_value = None
self._mapped_to_midi_velocity = False
self._report = True
self.set_report_values(True, False)
示例11: install_connections
def install_connections(
self
): # this override has to be here so that translation will happen when buttons are disabled
if self._is_enabled:
EncoderElement.install_connections(self)
elif (self._msg_channel != self._original_channel) or (self._msg_identifier != self._original_identifier):
self._install_translation(
self._msg_type,
self._original_identifier,
self._original_channel,
self._msg_identifier,
self._msg_channel,
)
示例12: __init__
def __init__(self, msg_type, channel, identifier, map_mode, name, num, script):
EncoderElement.__init__(self, msg_type, channel, identifier, map_mode=Live.MidiMap.MapMode.absolute)
self.name = name
self.num = num
self._parameter = None
self._script = script
self._is_enabled = True
self._mapping_feedback_delay = -1
#self._report_input = True
#self._report_output = True
#self._last_sent_val = -1
self._paramter_lcd_name = ' '
self._parameter_last_value = None
self._mapped_to_midi_velocity = False
示例13: _setup_mixer_control
def _setup_mixer_control(self):
is_momentary = True # We use non-latching buttons (keys) throughout, so we'll set this as a constant
num_tracks = 4 # Here we define the mixer width in tracks (a mixer has only one dimension)
global mixer # We want to instantiate the global mixer as a MixerComponent object (it was a global "None" type up until now...)
mixer = MixerComponent(num_tracks, 2, with_eqs=True, with_filters=False) #(num_tracks, num_returns, with_eqs, with_filters)
mixer.set_track_offset(0) #Sets start point for mixer strip (offset from left)
"""set up the mixer buttons"""
self.song().view.selected_track = mixer.channel_strip(0)._track
#mute_notes = [1,5,9,13]
#solo_notes = [2,6,10,14]
#arm_notes = [3,7,11,15]
track_select_notes = [38,39,40,41]#more note numbers need to be added if num_scenes is increased
send_ccs = [2,6,10,14,1,5,9,13]
pan_ccs = [3,7,11,15]
slider_ccs = [4,8,12,16]
for index in range(num_tracks):
mixer.channel_strip(index).set_select_button(ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHAN, track_select_notes[index]))
mixer.channel_strip(index).set_volume_control(SliderElement(MIDI_CC_TYPE, CHAN, slider_ccs[index]))
mixer.channel_strip(index).set_pan_control(EncoderElement(MIDI_CC_TYPE, CHAN, pan_ccs[index], Live.MidiMap.MapMode.absolute))
#put send A and send B controllers into an array, which is then "tupled" for set_send_controls:
send_controlers = [EncoderElement(MIDI_CC_TYPE, CHAN, send_ccs[index], Live.MidiMap.MapMode.absolute), EncoderElement(MIDI_CC_TYPE, CHAN, send_ccs[index+num_tracks], Live.MidiMap.MapMode.absolute)]
mixer.channel_strip(index).set_send_controls(tuple(send_controlers))
crossfader = SliderElement(MIDI_CC_TYPE, CHAN, 28)
master_volume_control = SliderElement(MIDI_CC_TYPE, CHAN, 32)
returna_pan_control = SliderElement(MIDI_CC_TYPE, CHAN, 19)
returna_volume_control = SliderElement(MIDI_CC_TYPE, CHAN, 20)
returnb_pan_control = SliderElement(MIDI_CC_TYPE, CHAN, 23)
returnb_volume_control = SliderElement(MIDI_CC_TYPE, CHAN, 24)
master_select_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHAN, 31)
prehear_control = EncoderElement(MIDI_CC_TYPE, CHAN, 30, Live.MidiMap.MapMode.absolute)
crossfader.name = 'Crossfader'
master_volume_control.name = 'Master_Volume_Control'
returna_pan_control.name = 'ReturnA_Pan_Control'
returna_volume_control.name = 'ReturnA_Volume_Control'
returnb_pan_control.name = 'ReturnB_Pan_Control'
returnb_volume_control.name = 'ReturnB_Volume_Control'
master_select_button.name = 'Master_Select_Button'
prehear_control.name = 'Prehear_Volume_Control'
mixer.set_crossfader_control(crossfader)
mixer.master_strip().set_volume_control(master_volume_control)
mixer.master_strip().set_select_button(master_select_button)
mixer.set_prehear_volume_control(prehear_control)
mixer.return_strip(0).set_pan_control(returna_pan_control)
mixer.return_strip(0).set_volume_control(returna_volume_control)
mixer.return_strip(1).set_pan_control(returnb_pan_control)
mixer.return_strip(1).set_volume_control(returnb_volume_control)
示例14: _setup_mixer_control
def _setup_mixer_control(self):
is_momentary = True
self._mixer = SpecialMixerComponent(8)
self._mixer.name = 'Mixer'
self._mixer.master_strip().name = 'Master_Channel_Strip'
self._mixer.selected_strip().name = 'Selected_Channel_Strip'
self._solo_buttons = [] # added a
self._select_buttons = [] # added a
for track in range(8):
strip = self._mixer.channel_strip(track)
strip.name = 'Channel_Strip_' + str(track)
volume_control = EncoderElement(MIDI_CC_TYPE, track, 7, Live.MidiMap.MapMode.absolute) # 'Slider_' + str(track), track, self)
arm_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, track, 48)
solo_button = AumPCMonoButtonElement(is_momentary, MIDI_NOTE_TYPE, track, 50, str(track) + '_Solo_Button', self)
self._solo_buttons.append(solo_button) # added a
mute_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, track, 49)
select_button = AumPCMonoButtonElement(is_momentary, MIDI_NOTE_TYPE, track, 51, str(track) + '_Select_Button', self)
self._select_buttons.append(select_button) # added a
#volume_control.name = str(track) + '_Volume_Control'
arm_button.name = str(track) + '_Arm_Button'
#solo_button.name = str(track) + '_Solo_Button'
mute_button.name = str(track) + '_Mute_Button'
#select_button.name = str(track) + '_Select_Button'
strip.set_volume_control(volume_control)
strip.set_arm_button(arm_button)
strip.set_solo_button(solo_button)
strip.set_mute_button(mute_button)
strip.set_select_button(select_button)
strip.set_shift_button(self._shift_button)
strip.set_invert_mute_feedback(True)
crossfader = SliderElement(MIDI_CC_TYPE, 0, 15)
self._crossfader = crossfader
self._crossfader.name = 'Crossfader'
master_volume_control = SliderElement(MIDI_CC_TYPE, 0, 14)
master_select_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 80)
self._master_select_button = master_select_button
prehear_control = EncoderElement(MIDI_CC_TYPE, 0, 47, Live.MidiMap.MapMode.relative_two_compliment)
crossfader.name = 'Crossfader'
master_volume_control.name = 'Master_Volume_Control'
master_select_button.name = 'Master_Select_Button'
prehear_control.name = 'Prehear_Volume_Control'
self._mixer.set_crossfader_control(crossfader)
self._mixer.set_prehear_volume_control(prehear_control)
self._mixer.master_strip().set_volume_control(master_volume_control)
self._mixer.master_strip().set_select_button(master_select_button)
示例15: __init__
def __init__(self, msg_type, channel, identifier, map_mode, name, num, script):
EncoderElement.__init__(self, msg_type, channel, identifier, map_mode)
self._script = script
self.name = name
self.num = num
self._parameter = None
self._ring_mode = 0
self._ring_value = 0
self._raw_custom = None
self._ring_custom = [[0, 0]]
self._ring_green = 0
self._is_enabled = True
#self._report_input = True
#self._report_output = True
self._paramter_lcd_name = ' '
self._parameter_last_value = None
self._mapped_to_midi_velocity = False
self.set_report_values(True, False)