本文整理汇总了Python中_Framework.PhysicalDisplayElement.PhysicalDisplayElement类的典型用法代码示例。如果您正苦于以下问题:Python PhysicalDisplayElement类的具体用法?Python PhysicalDisplayElement怎么用?Python PhysicalDisplayElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PhysicalDisplayElement类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _setup_device_and_transport_control
def _setup_device_and_transport_control(self):
is_momentary = True
device_bank_buttons = []
device_param_controls = []
for index in range(8):
#device_bank_buttons.append(SysexButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, (58 + index)))
device_bank_buttons.append(SysexButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, KMK_PAD[index]))
#device_param_controls.append(RingedEncoderElement(MIDI_CC_TYPE, 0, (16 + index), Live.MidiMap.MapMode.absolute))
#device_param_controls[-1].set_ring_mode_button(ButtonElement((not is_momentary), MIDI_CC_TYPE, 0, (24 + index)))
device_param_controls.append(EncoderElement(MIDI_CC_TYPE, 0, KMK_ENCODER[index], Live.MidiMap.MapMode.relative_two_compliment))
#device = ShiftableDeviceComponent()
global device
device = kmkDisplayingDeviceComponent() # special component, inherits from ShiftableDeviceController and adds lcds
device.set_bank_buttons(tuple(device_bank_buttons))
device.set_shift_button(self._shift_button)
device.set_parameter_controls(tuple(device_param_controls))
device.set_on_off_button(device_bank_buttons[1])
""" WAC addition...................................."""
device.set_lock_button(SysexButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, KMK_PAD[10]))
parameter_displays = []
for index in range(8):
parameter_displays.append(PhysicalDisplayElement(8, 1))
parameter_displays[-1].set_message_parts((SYSEX_KMK_HEADER + (KMK_LCD_COMMAND, 9, (index + 48))), (247,))
device_name_display = PhysicalDisplayElement(8,1)
device_name_display.set_message_parts((SYSEX_KMK_HEADER + (KMK_LCD_COMMAND, 9, (8 + 32))), (247,))
device.set_display(parameter_displays, device_name_display)
"""------------------------------------------------"""
self.set_device_component(device)
detail_view_toggler = DetailViewControllerComponent()
detail_view_toggler.set_shift_button(self._shift_button)
detail_view_toggler.set_device_clip_toggle_button(device_bank_buttons[0])
detail_view_toggler.set_detail_toggle_button(device_bank_buttons[4])
detail_view_toggler.set_device_nav_buttons(device_bank_buttons[2], device_bank_buttons[3])
""" WAC addition...................................."""
detail_view_toggler.set_arrange_toggle_button(SysexButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, KMK_PAD[8]))
detail_view_toggler.set_browser_toggle_button(SysexButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, KMK_PAD[12]))
"""------------------------------------------------"""
transport = ShiftableTransportComponent()
transport.set_shift_button(self._shift_button)
#transport.set_play_button(ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 91))
transport.set_play_button(SysexButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, KMK_BUTTON[4]))
#transport.set_stop_button(ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 92))
transport.set_stop_button(SysexButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, KMK_BUTTON[5]))
#transport.set_record_button(ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 93))
transport.set_record_button(SysexButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, KMK_BUTTON[3]))
""" WAC addition...................................."""
transport.set_seek_buttons(SysexButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, KMK_BUTTON[1]),
SysexButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, KMK_BUTTON[0]))
transport.set_loop_button(SysexButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, KMK_BUTTON[2]))
"""------------------------------------------------"""
#transport.set_nudge_buttons(ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 100), ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 101))
#transport.set_tap_tempo_button(ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 99))
transport.set_quant_toggle_button(device_bank_buttons[5])
transport.set_overdub_button(device_bank_buttons[6])
transport.set_metronome_button(device_bank_buttons[7])
bank_button_translator = ShiftableTranslatorComponent()
bank_button_translator.set_controls_to_translate(tuple(device_bank_buttons))
bank_button_translator.set_shift_button(self._shift_button)
示例2: __init__
def __init__(self, width_in_chars, num_segments):
PhysicalDisplayElement.__init__(self, width_in_chars, num_segments)
self._logical_segments = []
self._translation_table = NumericalDisplayElement._ascii_translations
width_without_delimiters = self._width - num_segments + 1
width_per_segment = int(width_without_delimiters / num_segments)
for index in range(num_segments):
new_segment = NumericalDisplaySegment(width_per_segment, self.update)
self._logical_segments.append(new_segment)
示例3: _setup_displays
def _setup_displays(self):
self._name_display = PhysicalDisplayElement(12, 1)
self._name_display.name = "Name_Display"
self._name_display.set_message_parts(SYSEX_START + (21,), (0, 247))
self._name_display.set_clear_all_message(CLEAR_NAME)
self._name_display_data_source = DisplayDataSource()
self._name_display.segment(0).set_data_source(self._name_display_data_source)
self._value_display = NumericalDisplayElement(3, 1)
self._value_display.name = "Value_Display"
self._value_display.set_message_parts(SYSEX_START + (20, 48), (0, 247))
self._value_display.set_clear_all_message(CLEAR_VALUE)
self._value_display_data_source = DisplayDataSource()
self._value_display.segment(0).set_data_source(self._value_display_data_source)
self._bank_display = NumericalDisplayElement(3, 1)
self._bank_display.name = "Bank_Display"
self._bank_display.set_message_parts(SYSEX_START + (19,), (0, 247))
self._bank_display.set_clear_all_message(CLEAR_BANK)
self._bank_display_data_source = DisplayDataSource()
self._bank_display.segment(0).set_data_source(self._bank_display_data_source)
self._pad_display = NumericalDisplayElement(2, 1)
self._pad_display.name = "Pad_Display"
self._pad_display.set_message_parts(SYSEX_START + (18,), (0, 247))
self._pad_display.set_clear_all_message(CLEAR_PAD)
self._pad_display_data_source = DisplayDataSource()
self._pad_display.segment(0).set_data_source(self._pad_display_data_source)
示例4: Axiom_DirectLink
#.........这里部分代码省略.........
transport_view_modes.name = "Transport_View_Modes"
def _setup_device(self):
self._encoders = []
for offset in range(8):
self._encoders.append(
PeekableEncoderElement(
MIDI_CC_TYPE, 15, 17 + offset, Live.MidiMap.MapMode.relative_smooth_two_compliment
)
)
self._encoders[-1].set_feedback_delay(-1)
self._encoders[-1].add_value_listener(self._encoder_value, identify_sender=True)
self._encoders[-1].name = "Device_Control_" + str(offset)
prev_bank_button = ButtonElement(IS_MOMENTARY, MIDI_CC_TYPE, 15, 14)
next_bank_button = ButtonElement(IS_MOMENTARY, MIDI_CC_TYPE, 15, 15)
prev_bank_button.name = "Device_Bank_Down_Button"
next_bank_button.name = "Device_Bank_Up_Button"
device = BestBankDeviceComponent()
device.name = "Device_Component"
self.set_device_component(device)
device.set_parameter_controls(tuple(self._encoders))
device.set_bank_nav_buttons(prev_bank_button, next_bank_button)
self._device_bank_buttons = (prev_bank_button, next_bank_button)
prev_bank_button.add_value_listener(self._device_bank_value)
next_bank_button.add_value_listener(self._device_bank_value)
self._inst_button = ButtonElement(IS_MOMENTARY, MIDI_CC_TYPE, 15, 109)
self._inst_button.name = "Inst_Button"
self._inst_button.add_value_listener(self._inst_value)
self._device_navigation = DetailViewCntrlComponent()
self._device_navigation.name = "Device_Navigation_Component"
def _setup_display(self):
self._display = PhysicalDisplayElement(5, 1)
self._display.name = "Display"
self._display.set_message_parts(SYSEX_START + (17, 1, 0, 0), (247,))
self._display_data_source = DisplayDataSource()
self._display.segment(0).set_data_source(self._display_data_source)
def _on_selected_track_changed(self):
ControlSurface._on_selected_track_changed(self)
self._show_current_track_name()
def _shift_value(self, value):
if not value in range(128):
raise AssertionError
self._shift_pressed = value > 0
for encoder in self._encoders:
encoder.set_peek_mode(self._shift_pressed)
self._shift_pressed and self._mixer.set_select_buttons(None, None)
self._session.set_track_bank_buttons(self._next_nav_button, self._prev_nav_button)
self._device_component.set_bank_nav_buttons(None, None)
self._device_navigation.set_device_nav_buttons(self._device_bank_buttons[0], self._device_bank_buttons[1])
else:
self._session.set_track_bank_buttons(None, None)
self._mixer.set_select_buttons(self._next_nav_button, self._prev_nav_button)
self._device_navigation.set_device_nav_buttons(None, None)
self._device_component.set_bank_nav_buttons(self._device_bank_buttons[0], self._device_bank_buttons[1])
self.request_rebuild_midi_map()
return
def _encoder_value(self, value, sender):
if not sender in self._encoders:
raise AssertionError
if not value in range(128):
示例5: _setup_display
def _setup_display(self):
self._display = PhysicalDisplayElement(5, 1)
self._display.name = "Display"
self._display.set_message_parts(SYSEX_START + (17, 1, 0, 0), (247,))
self._display_data_source = DisplayDataSource()
self._display.segment(0).set_data_source(self._display_data_source)
示例6: Novation_Impulse
#.........这里部分代码省略.........
loop_button.name = 'Loop_Button'
play_button.name = 'Play_Button'
stop_button.name = 'Stop_Button'
rec_button.name = 'Record_Button'
transport = ShiftableTransportComponent()
transport.name = 'Transport'
transport.set_stop_button(stop_button)
transport.set_play_button(play_button)
transport.set_record_button(rec_button)
transport.set_shift_button(self._shift_button)
self._transport_view_modes = TransportViewModeSelector(transport, self._session, ffwd_button, rwd_button, loop_button)
self._transport_view_modes.name = 'Transport_View_Modes'
def _setup_device(self):
encoders = []
for index in range(8):
encoders.append(PeekableEncoderElement(MIDI_CC_TYPE, 1, index, Live.MidiMap.MapMode.relative_binary_offset))
encoders[-1].set_feedback_delay(-1)
encoders[-1].add_value_listener(self._encoder_value, identify_sender=True)
encoders[-1].name = 'Device_Control_' + str(index)
self._encoders = tuple(encoders)
self._prev_bank_button = ButtonElement(IS_MOMENTARY, MIDI_CC_TYPE, 1, 12)
self._next_bank_button = ButtonElement(IS_MOMENTARY, MIDI_CC_TYPE, 1, 11)
self._prev_bank_button.name = 'Device_Bank_Down_Button'
self._next_bank_button.name = 'Device_Bank_Up_Button'
device = DeviceComponent()
device.name = 'Device_Component'
self.set_device_component(device)
device.set_parameter_controls(self._encoders)
device.set_bank_nav_buttons(self._prev_bank_button, self._next_bank_button)
def _setup_name_display(self):
self._name_display = PhysicalDisplayElement(16, 1)
self._name_display.name = 'Display'
self._name_display.set_message_parts(SYSEX_START + (8,), (247,))
self._name_display_data_source = DisplayDataSource()
self._name_display.segment(0).set_data_source(self._name_display_data_source)
def _encoder_value(self, value, sender):
if not sender in self._encoders:
raise AssertionError
if not value in range(128):
raise AssertionError
display_string = self._device_component.is_enabled() and ' - '
display_string = sender.mapped_parameter() != None and sender.mapped_parameter().name
self._set_string_to_display(display_string)
def _slider_value(self, value, sender):
if not sender in tuple(self._sliders) + (self._master_slider,):
raise AssertionError
if not value in range(128):
raise AssertionError
if self._mixer.is_enabled():
display_string = ' - '
if sender.mapped_parameter() != None:
master = self.song().master_track
tracks = self.song().tracks
returns = self.song().return_tracks
track = None
if sender == self._master_slider:
track = self._has_sliders and master
else:
track = self.song().view.selected_track
else:
track = self._mixer.channel_strip(self._sliders.index(sender))._track
示例7: _setup_name_display
def _setup_name_display(self):
self._name_display = PhysicalDisplayElement(16, 1)
self._name_display.name = 'Display'
self._name_display.set_message_parts(SYSEX_START + (8,), (247,))
self._name_display_data_source = DisplayDataSource()
self._name_display.segment(0).set_data_source(self._name_display_data_source)
示例8: __init__
def __init__(self, c_instance):
ControlSurface.__init__(self, c_instance)
with self.component_guard():
is_momentary = True
self._device_selection_follows_track_selection = True
self.set_pad_translations(PAD_TRANSLATIONS)
self._suggested_input_port = 'HyperControl'
self._suggested_output_port = 'HyperControl'
self._display_on_button = ButtonElement(not is_momentary, MIDI_CC_TYPE, 15, 79)
self._waiting_for_first_response = True
mixer1 = DisplayingMixerComponent(0)
mixer1.set_select_buttons(ButtonElement(is_momentary, MIDI_CC_TYPE, 15, 111), ButtonElement(is_momentary, MIDI_CC_TYPE, 15, 110))
mixer1.set_mute_button(ButtonElement(is_momentary, MIDI_CC_TYPE, 15, 12))
mixer1.set_solo_button(ButtonElement(is_momentary, MIDI_CC_TYPE, 15, 13))
mixer2 = NotifyingMixerComponent(8)
mixer2.set_bank_buttons(ButtonElement(is_momentary, MIDI_CC_TYPE, 15, 15), ButtonElement(is_momentary, MIDI_CC_TYPE, 15, 14))
mixer2.master_strip().set_volume_control(SliderElement(MIDI_CC_TYPE, 15, 41))
for index in range(8):
mixer2.channel_strip(index).set_volume_control(SliderElement(MIDI_CC_TYPE, 15, 33 + index))
device = PageableDeviceComponent()
self.set_device_component(device)
ffwd_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 15, 115)
rwd_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 15, 114)
loop_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 15, 113)
transport = TransportComponent()
transport.set_stop_button(ButtonElement(is_momentary, MIDI_CC_TYPE, 15, 116))
transport.set_play_button(ButtonElement(is_momentary, MIDI_CC_TYPE, 15, 117))
transport.set_record_button(ButtonElement(is_momentary, MIDI_CC_TYPE, 15, 118))
session = SessionComponent(0, 0)
transport_view_modes = TransportViewModeSelector(transport, session, ffwd_button, rwd_button, loop_button)
select_button_modes = SelectButtonModeSelector(mixer2, tuple([ ButtonElement(is_momentary, MIDI_CC_TYPE, 15, 49 + offset) for offset in range(8) ]))
select_button_modes.set_mode_toggle(ButtonElement(is_momentary, MIDI_CC_TYPE, 15, 57))
self._mixer_encoder_modes = EncoderMixerModeSelector(mixer2)
encoders = []
for offset in range(8):
encoders.append(PeekableEncoderElement(MIDI_CC_TYPE, 15, 17 + offset, Live.MidiMap.MapMode.relative_smooth_two_compliment))
encoders[-1].set_feedback_delay(-1)
mixer_or_device = MixerOrDeviceModeSelector(self._mixer_encoder_modes, device, tuple(encoders), tuple([ ButtonElement(is_momentary, MIDI_CC_TYPE, 15, 74 + offset) for offset in range(4) ]))
mixer_or_device.set_mode_toggle(ButtonElement(is_momentary, MIDI_CC_TYPE, 15, 109))
mixer_or_device.set_peek_button(ButtonElement(is_momentary, MIDI_CC_TYPE, 15, 78))
self._track_display = PhysicalDisplayElement(8, 1)
self._track_display.set_clear_all_message(SYSEX_START + (16, 247))
self._track_display.set_message_parts(SYSEX_START + (17, 1, 0, 0), (247,))
self._track_display.segment(0).set_data_source(mixer1.selected_strip().track_name_data_source())
device_display = PhysicalDisplayElement(8, 1)
device_display.set_message_parts(SYSEX_START + (17, 1, 0, 10), (247,))
parameter_display = PhysicalDisplayElement(16, 1)
parameter_display.set_message_parts(SYSEX_START + (17, 2, 0, 0), (247,))
select_button_modes.set_mode_display(parameter_display)
mixer1.set_display(parameter_display)
mixer2.set_bank_display(parameter_display)
page_displays = []
for index in range(4):
page_displays.append(PhysicalDisplayElement(5, 1))
page_displays[-1].set_message_parts(SYSEX_START + (17,
4,
index,
0), (247,))
encoder_display = PhysicalDisplayElement(80, 8)
encoder_display.set_message_parts(SYSEX_START + (17, 3), (247,))
for index in range(8):
pos_id = tuple()
if index != 0:
pos_id += (0,)
if index > 3:
pos_id += (index % 4, 13)
else:
pos_id += (index % 4, 0)
encoder_display.segment(index).set_position_identifier(pos_id)
mixer_or_device.set_displays(encoder_display, parameter_display, device_display, tuple(page_displays))
for component in self.components:
component.set_enabled(False)
示例9: AxiomPro
class AxiomPro(ControlSurface):
""" Script for the M-Audio Axiom Pro """
def __init__(self, c_instance):
ControlSurface.__init__(self, c_instance)
with self.component_guard():
is_momentary = True
self._device_selection_follows_track_selection = True
self.set_pad_translations(PAD_TRANSLATIONS)
self._suggested_input_port = 'HyperControl'
self._suggested_output_port = 'HyperControl'
self._display_on_button = ButtonElement(not is_momentary, MIDI_CC_TYPE, 15, 79)
self._waiting_for_first_response = True
mixer1 = DisplayingMixerComponent(0)
mixer1.set_select_buttons(ButtonElement(is_momentary, MIDI_CC_TYPE, 15, 111), ButtonElement(is_momentary, MIDI_CC_TYPE, 15, 110))
mixer1.set_mute_button(ButtonElement(is_momentary, MIDI_CC_TYPE, 15, 12))
mixer1.set_solo_button(ButtonElement(is_momentary, MIDI_CC_TYPE, 15, 13))
mixer2 = NotifyingMixerComponent(8)
mixer2.set_bank_buttons(ButtonElement(is_momentary, MIDI_CC_TYPE, 15, 15), ButtonElement(is_momentary, MIDI_CC_TYPE, 15, 14))
mixer2.master_strip().set_volume_control(SliderElement(MIDI_CC_TYPE, 15, 41))
for index in range(8):
mixer2.channel_strip(index).set_volume_control(SliderElement(MIDI_CC_TYPE, 15, 33 + index))
device = PageableDeviceComponent()
self.set_device_component(device)
ffwd_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 15, 115)
rwd_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 15, 114)
loop_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 15, 113)
transport = TransportComponent()
transport.set_stop_button(ButtonElement(is_momentary, MIDI_CC_TYPE, 15, 116))
transport.set_play_button(ButtonElement(is_momentary, MIDI_CC_TYPE, 15, 117))
transport.set_record_button(ButtonElement(is_momentary, MIDI_CC_TYPE, 15, 118))
session = SessionComponent(0, 0)
transport_view_modes = TransportViewModeSelector(transport, session, ffwd_button, rwd_button, loop_button)
select_button_modes = SelectButtonModeSelector(mixer2, tuple([ ButtonElement(is_momentary, MIDI_CC_TYPE, 15, 49 + offset) for offset in range(8) ]))
select_button_modes.set_mode_toggle(ButtonElement(is_momentary, MIDI_CC_TYPE, 15, 57))
self._mixer_encoder_modes = EncoderMixerModeSelector(mixer2)
encoders = []
for offset in range(8):
encoders.append(PeekableEncoderElement(MIDI_CC_TYPE, 15, 17 + offset, Live.MidiMap.MapMode.relative_smooth_two_compliment))
encoders[-1].set_feedback_delay(-1)
mixer_or_device = MixerOrDeviceModeSelector(self._mixer_encoder_modes, device, tuple(encoders), tuple([ ButtonElement(is_momentary, MIDI_CC_TYPE, 15, 74 + offset) for offset in range(4) ]))
mixer_or_device.set_mode_toggle(ButtonElement(is_momentary, MIDI_CC_TYPE, 15, 109))
mixer_or_device.set_peek_button(ButtonElement(is_momentary, MIDI_CC_TYPE, 15, 78))
self._track_display = PhysicalDisplayElement(8, 1)
self._track_display.set_clear_all_message(SYSEX_START + (16, 247))
self._track_display.set_message_parts(SYSEX_START + (17, 1, 0, 0), (247,))
self._track_display.segment(0).set_data_source(mixer1.selected_strip().track_name_data_source())
device_display = PhysicalDisplayElement(8, 1)
device_display.set_message_parts(SYSEX_START + (17, 1, 0, 10), (247,))
parameter_display = PhysicalDisplayElement(16, 1)
parameter_display.set_message_parts(SYSEX_START + (17, 2, 0, 0), (247,))
select_button_modes.set_mode_display(parameter_display)
mixer1.set_display(parameter_display)
mixer2.set_bank_display(parameter_display)
page_displays = []
for index in range(4):
page_displays.append(PhysicalDisplayElement(5, 1))
page_displays[-1].set_message_parts(SYSEX_START + (17,
4,
index,
0), (247,))
encoder_display = PhysicalDisplayElement(80, 8)
encoder_display.set_message_parts(SYSEX_START + (17, 3), (247,))
for index in range(8):
pos_id = tuple()
if index != 0:
pos_id += (0,)
if index > 3:
pos_id += (index % 4, 13)
else:
pos_id += (index % 4, 0)
encoder_display.segment(index).set_position_identifier(pos_id)
mixer_or_device.set_displays(encoder_display, parameter_display, device_display, tuple(page_displays))
for component in self.components:
component.set_enabled(False)
def refresh_state(self):
ControlSurface.refresh_state(self)
self._waiting_for_first_response = True
self.schedule_message(10, self._send_midi, SYSEX_START + (32, 46, 247))
def handle_sysex(self, midi_bytes):
if midi_bytes[0:-2] == SYSEX_START + (32,):
msg_id_byte = midi_bytes[-2]
is_setup_response = msg_id_byte in (46, 38)
has_sliders = msg_id_byte == 46
if is_setup_response:
if self._waiting_for_first_response:
self._waiting_for_first_response = False
self._display_on_button.send_value(0)
for component in self.components:
component.set_enabled(True)
self._display_on_button.send_value(127)
self._send_midi(SYSEX_START + (16, 247))
self._send_midi(SYSEX_START + (17, 3, 0, 1, 65, 98, 108, 101, 116, 111, 110, 32, 76, 105, 118, 101, 32, 67, 111, 110, 116, 114, 111, 108, 32, 0, 1, 4, 83, 117, 114, 102, 97, 99, 101, 32, 118, 49, 46, 48, 46, 48, 46, 247))
#.........这里部分代码省略.........
示例10: Axiom_AIR_25_49_61
#.........这里部分代码省略.........
self._encoders = []
for index in range(8):
self._encoders.append(create_encoder(17 + index, "Encoder_%d" % index))
self._encoders[-1].add_value_listener(self._encoder_value, identify_sender=True)
self._encoder_group_midi_button = create_configurable_button(27, "Encoder_Group_MIDI_Button", 0, 72)
self._encoder_group_midi_button.add_value_listener(self._midi_button_value, identify_sender=True)
self._encoder_group_mix_button = create_configurable_button(25, "Encoder_Group_Mix_Button", 0, 72)
self._encoder_group_mix_button.add_value_listener(self._hyper_button_value, identify_sender=True)
self._encoder_group_fx_button = create_configurable_button(26, "Encoder_Group_Inst_FX_Button", 0, 72)
self._encoder_group_fx_button.add_value_listener(self._hyper_button_value, identify_sender=True)
def _setup_drum_pads(self):
self._drum_pads = []
num_pads = 12 if self._has_faders else 16
for index in range(8):
self._drum_pads.append(create_configurable_button(81 + index, "Pad_%d" % index, 0, 0, MIDI_CC_TYPE))
for index in range(num_pads - 8):
self._drum_pads.append(
ConfigurableButtonElement(
IS_MOMENTARY, MIDI_NOTE_TYPE, GLOBAL_CHANNEL - 1, 81 + index, GLOBAL_SEND_CHANNEL, 8, MIDI_CC_TYPE
)
)
self._drum_pads[-1].name = "Pad_" + str(index + 8)
self._drum_group_midi_button = create_configurable_button(91, "Drum_Group_MIDI_Button", 2, -2)
self._drum_group_midi_button.add_value_listener(self._midi_button_value, identify_sender=True)
self._drum_group_roll_button = create_configurable_button(90, "Drum_Group_Roll_Button", -1)
self._drum_group_hyper_button = create_configurable_button(89, "Drum_Group_HyperControl_Button", 2, 2)
self._drum_group_hyper_button.add_value_listener(self._hyper_button_value, identify_sender=True)
def _setup_displays(self):
self._name_display = PhysicalDisplayElement(12, 1)
self._name_display.name = "Name_Display"
self._name_display.set_message_parts(SYSEX_START + (21,), (0, 247))
self._name_display.set_clear_all_message(CLEAR_NAME)
self._name_display_data_source = DisplayDataSource()
self._name_display.segment(0).set_data_source(self._name_display_data_source)
self._value_display = NumericalDisplayElement(3, 1)
self._value_display.name = "Value_Display"
self._value_display.set_message_parts(SYSEX_START + (20, 48), (0, 247))
self._value_display.set_clear_all_message(CLEAR_VALUE)
self._value_display_data_source = DisplayDataSource()
self._value_display.segment(0).set_data_source(self._value_display_data_source)
self._bank_display = NumericalDisplayElement(3, 1)
self._bank_display.name = "Bank_Display"
self._bank_display.set_message_parts(SYSEX_START + (19,), (0, 247))
self._bank_display.set_clear_all_message(CLEAR_BANK)
self._bank_display_data_source = DisplayDataSource()
self._bank_display.segment(0).set_data_source(self._bank_display_data_source)
self._pad_display = NumericalDisplayElement(2, 1)
self._pad_display.name = "Pad_Display"
self._pad_display.set_message_parts(SYSEX_START + (18,), (0, 247))
self._pad_display.set_clear_all_message(CLEAR_PAD)
self._pad_display_data_source = DisplayDataSource()
self._pad_display.segment(0).set_data_source(self._pad_display_data_source)
def _setup_mixer(self):
self._mixer_for_encoders = SpecialMixerComponent(self._name_display, self._value_display, 8)
self._mixer_for_encoders.name = "Mixer_for_encoders"
self._mixer_for_faders = SpecialMixerComponent(self._name_display, self._value_display, 8)
self._mixer_for_faders.name = "Mixer_for_faders"
def _setup_session(self):
self._session = SpecialSessionComponent(8, 0)
示例11: Novation_Impulse2
#.........这里部分代码省略.........
play_button.name = 'Play_Button'
stop_button.name = 'Stop_Button'
rec_button.name = 'Record_Button'
self._transport = ShiftableTransportComponent(self.c_instance,self._session, self, ffwd_button, rwd_button)
self._transport.name = 'Transport'
self._transport.set_stop_buttonOnInit(stop_button)
self._transport.set_play_button(play_button)
self._transport.set_record_buttonOnInit(rec_button)
# self._transport.set_shift_button(self._shift_button)
self._transport.set_mixer9_button(self._button9)
self._transport_view_modes = TransportViewModeSelector(self,self.c_instance,self._transport, self._session, ffwd_button, rwd_button, loop_button)
self._transport_view_modes.name = 'Transport_View_Modes'
def _setup_device(self):
encoders = []
for index in range(8):
encoders.append(PeekableEncoderElement(MIDI_CC_TYPE, 1, index, Live.MidiMap.MapMode.relative_binary_offset))
encoders[-1].set_feedback_delay(-1)
encoders[-1].add_value_listener(self._encoder_value, identify_sender=True)
encoders[-1].name = 'Device_Control_' + str(index)
self._encoders = tuple(encoders)
self._prev_bank_button = ButtonElement(IS_MOMENTARY, MIDI_CC_TYPE, 1, 12)
self._next_bank_button = ButtonElement(IS_MOMENTARY, MIDI_CC_TYPE, 1, 11)
self._prev_bank_button.name = 'Device_Bank_Down_Button'
self._next_bank_button.name = 'Device_Bank_Up_Button'
device = DeviceComponent()
device.name = 'Device_Component'
self.set_device_component(device)
device.set_parameter_controls(self._encoders)
device.set_bank_nav_buttons(self._prev_bank_button, self._next_bank_button)
def _setup_name_display(self):
self._name_display = PhysicalDisplayElement(16, 1)
self._name_display.name = 'Display'
self._name_display.set_message_parts(SYSEX_START + (8,), (247,))
self._name_display_data_source = DisplayDataSource()
self._name_display.segment(0).set_data_source(self._name_display_data_source)
def _encoder_value(self, value, sender):
if not sender in self._encoders:
raise AssertionError
if not value in range(128):
raise AssertionError
# display_string = self._device_component.is_enabled() and ' - '
# display_string = sender.mapped_parameter() != None and sender.mapped_parameter().name
display_string = ''
if self._device_component.is_enabled():
# display_string = sender.name
# track = self.song().view.selected_track
# display_string = str(list(tracks).index(track) + 1)
pass
if (sender.mapped_parameter() != None):
# display_string = display_string + '-'
display_string = display_string + sender.mapped_parameter().name
self._set_string_to_display(display_string)
def _slider_value(self, value, sender):
self.log ('_slider_value ' + str(value) + ' ' +str(sender))
if not sender in tuple(self._sliders) + (self._master_slider,):
raise AssertionError
if not value in range(128):
raise AssertionError
if self._mixer.is_enabled():
display_string = ' - '
master = self.song().master_track