def __init__(self, mixer_modes, device, encoders, page_buttons): raise isinstance(mixer_modes, EncoderMixerModeSelector) or AssertionError raise isinstance(device, PageableDeviceComponent) or AssertionError raise isinstance(encoders, tuple) or AssertionError raise isinstance(page_buttons, tuple) or AssertionError ModeSelectorComponent.__init__(self) self._mixer_modes = mixer_modes self._device = device self._encoders = encoders self._page_buttons = page_buttons self._peek_button = None self._encoders_display = None self._value_display = None self._device_display = None self._page_displays = None self._device_dummy_source = DisplayDataSource() self._parameter_source = DisplayDataSource() self._device_dummy_source.set_display_string('Mixer') self._clean_value_display_in = -1 self._must_update_encoder_display = False self._register_timer_callback(self._on_timer) identify_sender = True for encoder in self._encoders: encoder.add_value_listener(self._parameter_value, identify_sender) self.set_mode(0)
def __init__(self, num_options=8, num_labels=4, *a, **k): super(OptionsComponent, self).__init__(*a, **k) self._data_sources = [DisplayDataSource() for _ in xrange(num_options)] self._label_data_sources = [ DisplayDataSource() for _ in xrange(num_labels) ] self._select_buttons = None
def __init__(self, *a, **k): super(ClipControlComponent, self).__init__(*a, **k) self._clip_param_sources = [DisplayDataSource() for _ in xrange(8)] self._clip_value_sources = [DisplayDataSource() for _ in xrange(8)] self._clip_name_data_sources = [ DisplayDataSource() for _ in xrange(self.num_label_segments) ] self._clip_name_data_sources[0].set_display_string('Clip Selection:') self._no_settings = NoClipSettingsComponent(self._clip_param_sources, self._clip_value_sources) self._midi_clip_settings = MidiClipSettingsComponent( self._clip_param_sources[4:], self._clip_value_sources[4:]) self._midi_clip_settings.set_enabled(False) self._audio_clip_settings = AudioClipSettingsComponent( self._clip_param_sources[4:], self._clip_value_sources[4:]) self._audio_clip_settings.set_enabled(False) self._loop_settings = LoopSettingsComponent( self._clip_param_sources[:4], self._clip_value_sources[:4]) self._loop_settings.set_enabled(False) self._clip_name = ClipNameComponent(self._clip_name_data_sources[1]) self._clip_name.set_enabled(False) self.register_components(self._no_settings, self._loop_settings, self._midi_clip_settings, self._audio_clip_settings, self._clip_name) self.add_mode('no_clip', (self._no_settings, self._clip_name)) self.add_mode( 'midi', (self._loop_settings, self._midi_clip_settings, self._clip_name)) self.add_mode( 'audio', (self._loop_settings, self._audio_clip_settings, self._clip_name)) self.selected_mode = 'no_clip' self._update_clip() self._on_detail_clip_changed.subject = self.song().view
def __init__(self, *a, **k): super(UserSettingsComponent, self).__init__(*a, **k) self._name_sources = [DisplayDataSource() for _ in xrange(4)] self._value_sources = [DisplayDataSource() for _ in xrange(4)] self._info_source = DisplayDataSource() self._settings = [] self._encoders = []
def __init__(self, display_label = ' ', display_seg_start = 0, *a, **k): super(ValueDisplayComponentBase, self).__init__(*a, **k) self._label_data_source = DisplayDataSource(display_label) self._value_data_source = DisplayDataSource() self._graphic_data_source = DisplayDataSource() self._display_label = display_label self._display_seg_start = display_seg_start
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 __init__(self, grid_resolution = None, *a, **k): super(NoteSetting, self).__init__(*a, **k) self._encoder = None self._grid_resolution = grid_resolution self.value_source = DisplayDataSource() self.label_source = DisplayDataSource() self.label_source.set_display_string(self.get_label())
def __init__(self, num_options = 8, num_labels = 4, num_display_segments = None, *a, **k): super(OptionsComponent, self).__init__(*a, **k) num_display_segments = num_display_segments or num_options self._label_data_sources = [ DisplayDataSource() for _ in xrange(num_labels) ] self._data_sources = [ DisplayDataSource() for _ in xrange(num_display_segments) ] self._select_buttons = None self._option_names = []
def _add_setting(self, setting): raise len(self._settings) < 8 or AssertionError, 'Cannot show more than 8 settings' self._settings.append(setting) self._update_encoders() self._top_data_sources = [ DisplayDataSource() for _ in xrange(8 - len(self._settings)) ] + [ s.label_source for s in self._settings ] self._bottom_data_sources = [ DisplayDataSource() for _ in xrange(8 - len(self._settings)) ] + [ s.value_source for s in self._settings ] self.register_disconnectable(setting) self.register_slot(setting, self.notify_setting_changed, 'setting_changed')
def __init__(self, parent, *a, **k): super(MonoScaleDisplayComponent, self).__init__(*a, **k) self.num_segments = 4 self._parent = parent self._name_display_line = None self._value_display_line = None self._name_data_sources = [ DisplayDataSource(DISPLAY_NAMES[index]) for index in xrange(4) ] self._value_data_sources = [ DisplayDataSource() for _ in range(self.num_segments) ]
def __init__(self, parent, display_strings, value_strings, *a, **k): assert len(display_strings) == len(value_strings) super(MonomodDisplayComponent, self).__init__(*a, **k) self.num_segments = len(display_strings) self._parent = parent self._name_display_line = None self._value_display_line = None self._name_data_sources = [ DisplayDataSource(string) for string in display_strings ] self._value_data_sources = [ DisplayDataSource(string) for string in value_strings ]
def __init__(self, grid_resolution = None, *a, **k): super(NoteSettingsComponent, self).__init__(*a, **k) self._top_data_sources = [ DisplayDataSource() for _ in xrange(8) ] self._bottom_data_sources = [ DisplayDataSource() for _ in xrange(8) ] self._info_data_source = DisplayDataSource() self._settings = [] self._encoders = [] self._add_setting(NoteNudgeSetting(grid_resolution=grid_resolution)) self._add_setting(NoteLengthCoarseSetting(grid_resolution=grid_resolution)) self._add_setting(NoteLengthFineSetting(grid_resolution=grid_resolution)) self._add_setting(NoteVelocitySetting(grid_resolution=grid_resolution))
def __init__(self, mixer): raise isinstance(mixer, NotifyingMixerComponent) or AssertionError ModeSelectorComponent.__init__(self) self._mixer = mixer self._controls = None self._page_names = ('Vol', 'Pan', 'SendA', 'SendB', 'SendC') self._page_name_sources = None self._current_page_data_source = DisplayDataSource() self._parameter_sources = [DisplayDataSource() for index in range(8)] self._show_volume_page = False self._mixer.set_update_callback(self._mixer_assignments_changed)
def __init__(self, *a, **k): super(PageableDeviceComponent, self).__init__(*a, **k) self._parameter_value_data_source = DisplayDataSource() self._parameter_name_data_sources = [] self._page_name_data_sources = [] self._page_index = [0, 0, 0, 0] for new_index in range(8): self._parameter_name_data_sources.append(DisplayDataSource()) self._page_name_data_sources.append(DisplayDataSource()) self._parameter_name_data_sources[-1].set_display_string(' - ') self._page_name_data_sources[-1].set_display_string(' - ')
def __init__(self, *a, **k): super(LoopSettingsComponent, self).__init__(*a, **k) self._clip = None self._name_sources = [DisplayDataSource() for _ in xrange(4)] self._value_sources = [DisplayDataSource() for _ in xrange(4)] self._clip_is_looping = False self._clip_loop_start = None self._clip_loop_end = None self._clip_loop_length = None self._lowest_note_time = 0.0 self._encoder_factor = 4.0 self._shift_button = None
def __init__(self): ShiftableDeviceComponent.__init__(self) self._main_lcds = None self._parameter_data_sources = [] for index in range(8): self._parameter_data_sources.append(DisplayDataSource()) self._parameter_data_sources[-1].set_display_string('---') self._device_name_lcd = None # Explicitly NAME the device_name_data_source # This is provided and controlled by DeviceComponent # I only need to assign it to a display self._device_name_data_source = DisplayDataSource() self._param_name_value_toggle = False
def __init__(self, *a, **k): super(DisplayingDeviceComponent, self).__init__(*a, **k) self._parameter_name_data_sources = [ DisplayDataSource(' ') for _ in xrange(8) ] self._parameter_value_data_sources = [ DisplayDataSource(' ') for _ in xrange(8) ] self._parameter_graphic_data_sources = [ DisplayDataSource(' ') for _ in xrange(8) ] self._blank_data_sources = [DisplayDataSource(' ') for _ in xrange(8)] self._mapped_parameters = [] self._alternating_display = None self._encoder_touch_buttons = []
def _setup_name_display(self): self._name_display = PhysicalDisplayElement(16, 1) self._name_display.name = b'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 __init__(self, *a, **k): super(SpecialChanStripComponent, self).__init__(*a, **k) self.empty_color = 'Option.Unused' self._invert_mute_feedback = True self._delete_button = None self._duplicate_button = None self._selector_button = None self._track_parameter_name_sources = [ DisplayDataSource(' ') for _ in xrange(14) ] self._track_parameter_data_sources = [ DisplayDataSource(' ') for _ in xrange(14) ] self._track_parameter_graphic_sources = [ DisplayDataSource(' ') for _ in xrange(14) ] self._on_return_tracks_changed.subject = self.song() self._on_selected_track_changed.subject = self.song().view self._fold_task = self._tasks.add(Task.sequence(Task.wait(TRACK_FOLD_DELAY), Task.run(self._do_fold_track))).kill() self._cue_volume_slot = self.register_disconnectable(ParameterSlot()) self._track_state = self.register_disconnectable(TrackArmState()) self._on_arm_state_changed.subject = self._track_state
def __init__(self, *a, **k): super(ClipNameComponent, self).__init__(*a, **k) self._clip = None self._name_data_sources = [ DisplayDataSource() for _ in xrange(self.num_label_segments) ] self._name_data_sources[0].set_display_string('Clip Selection:')
def __init__(self, *a, **k): super(ScrollableListComponent, self).__init__(*a, **k) self._data_sources = [ DisplayDataSource() for _ in range(self.num_segments) ] self._selected_option = None self._offset_index = 0 self._option_names = [] self._select_buttons = [] self._select_button_slots = self.register_slot_manager() self.register_slot(self, self._set_selected_option, 'press_option')
def __init__(self, clip_creator=None, playhead=None, *a, **k): super(NoteEditorComponent, self).__init__(*a, **k) self.loop_steps = False self._selected_page_point = 0 self._page_index = 0 self._clip_creator = clip_creator self._matrix = None self._sequencer_clip = None self._step_colors = ['NoteEditor.StepEmpty'] * STEP_SEQ_SIZE self._note_settings_layer = None self._top_data_sources = map(DisplayDataSource, STEP_PARAM_NAMES) self._bottom_data_sources = [DisplayDataSource() for _ in xrange(8)] self._show_settings_task = self._tasks.add( Task.sequence(Task.wait(Defaults.MOMENTARY_DELAY), Task.run(self._show_settings))) self._show_settings_task.kill() self._mute_button = None self._velocity_offset = 0 self._length_offset = 0 self._nudge_offset = 0 self._attribute_deltas = [None for _ in xrange(3)] self._full_velocity = False self._pressed_steps = [] self._modified_steps = [] self._pressed_step_callback = None self._quantization_buttons = [] self._quantization_button_slots = self.register_slot_manager() self._modify_task = self._tasks.add(Task.run(self._do_modification)) self._modify_task.kill() self._modify_all_notes_enabled = False self._step_tap_tasks = dict([ ((x, y), self._tasks.add( Task.sequence( Task.wait(Defaults.MOMENTARY_DELAY), Task.run( partial(self._trigger_modification, (x, y), done=True))))) for x, y in product(xrange(STEP_SEQ_WIDTH), xrange( STEP_SEQ_HEIGHT)) ]) for task in self._step_tap_tasks.itervalues(): task.kill() self._clip_notes = [] self._note_index = 36 self._triplet_factor = 1.0 self._set_quantization_index(3) self._playhead = playhead self._playhead_notes = range(92, 100) + range(84, 92) + range( 76, 84) + range(68, 76) self._playhead_triplet_notes = range(92, 98) + range(84, 90) + range( 76, 82) + range(68, 74) with self._playhead_update_guard(): self._update_full_playhead()
def __init__(self, *a, **k): super(AudioClipSettingsComponent, self).__init__(*a, **k) self._clip = None self._warp_mode_names = {Live.Clip.WarpMode.beats: 'Beats', Live.Clip.WarpMode.tones: 'Tones', Live.Clip.WarpMode.texture: 'Texture', Live.Clip.WarpMode.repitch: 'Repitch', Live.Clip.WarpMode.complex: 'Complex', Live.Clip.WarpMode.complex_pro: 'ComplexPro', Live.Clip.WarpMode.rex: 'Rex'} self._available_warp_modes = [] self._pitch_fine = None self._pitch_coarse = None self._gain = None self._warping = None self._warp_mode = None self._warp_mode_encoder_value = 0.0 self._encoder_factor = 1.0 self._name_sources = [ DisplayDataSource() for _ in xrange(4) ] self._value_sources = [ DisplayDataSource() for _ in xrange(4) ] self._shift_button = None
def _create_display(self): self._display_line1, self._display_line2 = DisplayElement( 16, 1), DisplayElement(16, 1) for index, display_line in enumerate( (self._display_line1, self._display_line2)): display_line.set_message_parts(SETUP_MSG_PREFIX + (4, 0, 96), SETUP_MSG_SUFFIX) display_line.segment(0).set_position_identifier((index + 1, )) def adjust_null_terminated_string(string, width): return string.ljust(width, b' ') + b'\x00' self._display_line1_data_source, self._display_line2_data_source = DisplayDataSource( adjust_string_fn=adjust_null_terminated_string), DisplayDataSource( adjust_string_fn=adjust_null_terminated_string) self._display_line1.segment(0).set_data_source( self._display_line1_data_source) self._display_line2.segment(0).set_data_source( self._display_line2_data_source) self._display_line1_data_source.set_display_string(b'KeyLab') self._display_line2_data_source.set_display_string(b'Ableton Live')
def page_name_data_source(self, index): assert index in range(4) if self._page_name_sources == None: self._page_name_sources = [] offset = 0 if not self._show_volume_page: offset = 1 for idx in range(4): self._page_name_sources.append(DisplayDataSource()) self._page_name_sources[idx].set_display_string(self._page_names[idx + offset]) return self._page_name_sources[index]
def page_name_data_source(self, index): if not index in range(4): raise AssertionError if self._page_name_sources == None: self._page_name_sources = [] offset = 0 offset = self._show_volume_page or 1 for idx in range(4): self._page_name_sources.append(DisplayDataSource()) self._page_name_sources[idx].set_display_string(self._page_names[(idx + offset)]) return self._page_name_sources[index]
def __init__(self, *a, **k): super(BestBankDeviceComponent, self).__init__(*a, **k) new_banks = {} new_bank_names = {} self._device_banks = DEVICE_DICT self._device_bank_names = BANK_NAME_DICT self._device_best_banks = DEVICE_BOB_DICT for device_name, current_banks in self._device_banks.iteritems(): if len(current_banks) > 1: assert device_name in self._device_best_banks.keys(), b"Could not find best-of-banks for '%s'" % device_name assert device_name in self._device_bank_names.keys(), b"Could not find bank names for '%s'" % device_name current_banks = self._device_best_banks[device_name] + current_banks new_bank_names[device_name] = (BOP_BANK_NAME,) + self._device_bank_names[device_name] new_banks[device_name] = current_banks self._device_banks = new_banks self._device_bank_names = new_bank_names self._bank_name_data_source = DisplayDataSource()
def __init__(self, grid_resolution = None, initial_encoder_layer = None, encoder_layer = None, settings_layer = None, *a, **k): super(NoteEditorSettingsComponent, self).__init__(*a, **k) raise encoder_layer or AssertionError self._bottom_data_sources = [ DisplayDataSource() for _ in xrange(8) ] self._request_hide = False self.settings = self.register_component(NoteSettingsComponent(grid_resolution=grid_resolution, layer=settings_layer)) self.settings.set_enabled(False) self._automation = self.register_component(AutomationComponent()) self._automation.set_enabled(False) self._mode_selector = self.register_component(OptionsComponent(num_options=2, num_labels=0, num_display_segments=8)) self._mode_selector.set_enabled(False) self._on_selected_option.subject = self._mode_selector self._update_available_modes() self._mode_selector.selected_option = 0 self._visible_detail_view = 'Detail/DeviceChain' self._show_settings_task = self._tasks.add(Task.sequence(Task.wait(Defaults.MOMENTARY_DELAY), Task.run(self._show_settings))) self._show_settings_task.kill() self._update_infos_task = self._tasks.add(Task.run(self._update_note_infos)) self._update_infos_task.kill() self._settings_modes = self.register_component(ModesComponent()) self._settings_modes.set_enabled(False) self._settings_modes.add_mode('automation', [self._automation, self._mode_selector, partial(self._set_envelope_view_visible, True), self._show_clip_view]) self._settings_modes.add_mode('note_settings', [self.settings, self._update_note_infos, self._mode_selector, partial(self._set_envelope_view_visible, False), self._show_clip_view]) self._settings_modes.add_mode('pad_settings', [self.settings, partial(self._set_envelope_view_visible, False), self._show_clip_view]) self._encoders = None self._initial_encoders = None self.add_mode('disabled', []) self.add_mode('about_to_show', [AddLayerMode(self, initial_encoder_layer), (self._show_settings_task.restart, self._show_settings_task.kill)]) self.add_mode('enabled', [DetailViewRestorerMode(self.application()), AddLayerMode(self, encoder_layer), self._update_available_modes, self._settings_modes]) self.selected_mode = 'disabled' self._editors = [] self._on_detail_clip_changed.subject = self.song().view self._on_selected_track_changed.subject = self.song().view
def __init__(self): DeviceComponent.__init__(self) new_banks = {} new_bank_names = {} self._device_banks = DEVICE_DICT self._device_bank_names = BANK_NAME_DICT self._device_best_banks = DEVICE_BOB_DICT for device_name, current_banks in self._device_banks.iteritems(): raise len(current_banks) > 1 and ( device_name in self._device_best_banks.keys() or AssertionError ), "Could not find best-of-banks for '%s'" % device_name if not device_name in self._device_bank_names.keys(): raise AssertionError, "Could not find bank names for '%s'" % device_name current_banks = self._device_best_banks[ device_name] + current_banks new_bank_names[device_name] = ( BOP_BANK_NAME, ) + self._device_bank_names[device_name] new_banks[device_name] = current_banks self._device_banks = new_banks self._device_bank_names = new_bank_names self._bank_name_data_source = DisplayDataSource()
def __init__(self, *a, **k): super(SelectionDisplayComponent, self).__init__(*a, **k) self._data_sources = [ DisplayDataSource() for _ in range(self.num_segments) ]