def disconnect(self): SessionComponent.disconnect(self) if self._synced_session != None: self._synced_session.remove_offset_listener( self._on_control_surface_offset_changed) self._mixer.set_tracks_to_use_callback(None) self._serato_interface = None
def disconnect(self): self._sequencer = None LC2SceneComponent.release_attributes() LC2ChannelStripComponent.release_attributes() LC2ClipSlotComponent.release_attributes() SessionComponent.disconnect(self) return
def _setup_session(self): scene_launch_button = self._control_factory.create_scene_launch_button( ) scene_stop_button = self._control_factory.create_scene_stop_button() self._session = SessionComponent(8, 0) self._session.name = 'Session_Control' self._session.selected_scene().name = 'Selected_Scene' self._session.selected_scene().set_launch_button(scene_launch_button) self._session.selected_scene().set_triggered_value(GREEN_BLINK) self._session.set_stop_all_clips_button(scene_stop_button) scene_stop_button.set_on_off_values(AMBER_FULL, LED_OFF) self._session.set_mixer(self._mixer) self._session.set_stop_clip_value(AMBER_HALF) self._session.set_stop_clip_triggered_value(GREEN_BLINK) clip_launch_buttons = [] clip_stop_buttons = [] for index in range(8): clip_launch_buttons.append( self._control_factory.create_clip_launch_button(index)) clip_stop_buttons.append( self._control_factory.create_clip_stop_button(index)) clip_slot = self._session.selected_scene().clip_slot(index) clip_slot.set_triggered_to_play_value(GREEN_BLINK) clip_slot.set_triggered_to_record_value(RED_BLINK) clip_slot.set_stopped_value(AMBER_FULL) clip_slot.set_started_value(GREEN_FULL) clip_slot.set_recording_value(RED_FULL) clip_slot.set_launch_button(clip_launch_buttons[-1]) clip_slot.name = 'Selected_Clip_Slot_' + str(index) self._session.set_stop_track_clip_buttons(tuple(clip_stop_buttons))
class SessionControl(): def __init__(self, control_surface): self.control_surface = control_surface self.width = 8 self.height = 1 self.component = SessionComponent(self.width, self.height) self.component.set_offsets( 0, 0 ) #(track_offset, scene_offset) Sets the initial offset of the "red box" from top left # navigation control_surface.get_encoder(3, 7).add_value_listener(self._track_nav) def _track_nav(self, value): value -= 64 session = self.component track_offset = min( max(0, session.track_offset() + value), max(0, len(self.control_surface.song().tracks) - self.width)) #self.control_surface.log_message("track_offset %d" % track_offset) session.set_offsets(track_offset, session.scene_offset())
def disconnect(self): SessionComponent.disconnect(self) if self._shift_button != None: self._shift_button.remove_value_listener(self._shift_value) self._shift_button = None self._clip_slot_buttons = None return
def _setup_mixer_controls(self): is_momentary = True self._num_tracks = (8) self._session = SessionComponent(self._num_tracks, 0) self._session.name = 'Session' self._mixer = MixerComponent(self._num_tracks, 0, False, False) self._mixer.name = 'Mixer' self._mixer._next_track_value = self._mixer_next_track_value( self._mixer) self._mixer._prev_track_value = self._mixer_prev_track_value( self._mixer) self._mixer.set_track_offset( 0) #Sets start point for mixer strip (offset from left) #for index in range(8): #use the bottom row of encoders for volume, so add 24 to offset the index # self._mixer.channel_strip(index).set_volume_control(self._dial[index+24]) for index in range(8): self._mixer.channel_strip( index).name = 'Mixer_ChannelStrip_' + str(index) self._mixer.channel_strip(index)._invert_mute_feedback = True self._mixer.channel_strip( index)._mute_value = self._channelstrip_mute_value( self._mixer.channel_strip(index)) self._mixer.channel_strip( index)._solo_value = self._channelstrip_solo_value( self._mixer.channel_strip(index)) #mixer.channel_strip(index).set_select_button(ButtonElement(is_momentary, MIDI_NOTE_TYPE, CH, track_select_notes[index])) self.song().view.selected_track = self._mixer.channel_strip( 0 )._track #set the selected strip to the first track, so that we don't, for example, try to assign a button to arm the master track, which would cause an assertion error self._session.set_mixer(self._mixer)
def __init__(self, num_tracks, num_scenes): self._visible_width = num_tracks self._visible_height = num_scenes self._synced_session = None self._serato_interface = None SessionComponent.__init__(self, num_tracks, num_scenes) return
def _bank_right(self): if LC2Sysex.l9(): if len(self.tracks_to_use()) > self.track_offset() + self.width(): SessionComponent._bank_right(self) self.send_offsets() if len(self.tracks_to_use()) == self.track_offset() + self.width(): self._bank_right_button.turn_off()
def __init__(self, c_instance): ControlSurface.__init__(self, c_instance) with self.component_guard(): self._suggested_input_port = u'HyperControl' self._suggested_output_port = u'HyperControl' self.set_pad_translations(PAD_TRANSLATIONS) stop_button = make_button(116) play_button = make_button(117) record_button = make_button(118) select_button = make_button(98) nav_left_button = make_button(99) nav_right_button = make_button(100) nav_up_button = make_button(101) nav_down_button = make_button(102) mixer_modes_toggle = make_button(58) mixer_or_device_toggle = make_button(59) hypercontrol_mode_toggle = make_button(60) encoders = tuple([ make_encoder(33 + index) for index in range(8) ]) transport = TransportComponent() transport.set_stop_button(stop_button) transport.set_play_button(play_button) transport.set_record_button(record_button) session = SessionComponent(8, 0) device = BestBankDeviceComponent(device_selection_follows_track_selection=True) self.set_device_component(device) device_nav = DeviceNavComponent() mixer = SpecialMixerComponent(NUM_TRACKS) session.set_mixer(mixer) mixer_encoder_modes = EncoderMixerModeSelector(mixer) mixer_encoder_modes.set_mode_toggle(mixer_modes_toggle) mixer_or_device = MixerOrDeviceModeSelector(encoders, select_button, nav_up_button, nav_down_button, nav_left_button, nav_right_button, mixer, session, device, mixer_encoder_modes, device_nav) mixer_or_device.set_mode_buttons((mixer_modes_toggle, mixer_or_device_toggle, hypercontrol_mode_toggle))
def _setup_session(self): num_pads = len(PAD_TRANSLATIONS) self._track_left_button = ButtonElement(not IS_MOMENTARY, MIDI_CC_TYPE, 0, 36) self._track_right_button = ButtonElement(not IS_MOMENTARY, MIDI_CC_TYPE, 0, 35) self._session = SessionComponent(8, 0) self._session.name = b'Session_Control' self._session.selected_scene().name = b'Selected_Scene' self._session.set_mixer(self._mixer) self._session.set_page_left_button(self._track_left_button) self._session.set_page_right_button(self._track_right_button) pads = [] for index in range(num_pads): pads.append( ButtonElement(IS_MOMENTARY, MIDI_CC_TYPE, 0, 60 + index)) pads[(-1)].name = b'Pad_' + str(index) clip_slot = self._session.selected_scene().clip_slot(index) clip_slot.set_triggered_to_play_value(GREEN_BLINK) clip_slot.set_triggered_to_record_value(RED_BLINK) clip_slot.set_stopped_value(AMBER_FULL) clip_slot.set_started_value(GREEN_FULL) clip_slot.set_recording_value(RED_FULL) clip_slot.set_launch_button(pads[(-1)]) clip_slot.name = str(index) + b'_Selected_Clip_Slot'
def __init__(self, num_tracks, num_scenes): SessionComponent.__init__(self, num_tracks, num_scenes) self._track_nav = False self._selected_scene = SpecialSceneComponent(self._num_tracks, self.tracks_to_use) self.on_selected_scene_changed() self.register_components(self._selected_scene)
def setup_session(self): num_tracks = 7 num_scenes = 1 track_offset = 0 scene_offset = 0 # elements self.clip_launch_buttons = ButtonMatrixElement(rows=[[ ButtonElement(True, MIDI_NOTE_TYPE, 0, 76 + i) for i in range(num_tracks) ]]) self.clip_stop_buttons = [ ButtonElement(True, MIDI_NOTE_TYPE, 0, 68 + i) for i in range(num_tracks) ] self.scene_launch_buttons = ButtonMatrixElement(rows=[[ ButtonElement(True, MIDI_NOTE_TYPE, 0, 83 + i) for i in range(num_scenes) ]]) self.scene_stop_button = ButtonElement(True, MIDI_NOTE_TYPE, 0, 75) self.session_scene_nav_encoder = EncoderElement( MIDI_CC_TYPE, 0, 15, Live.MidiMap.MapMode.relative_binary_offset) # session self.session = SessionComponent(num_tracks, num_scenes) self.session.set_offsets(track_offset, scene_offset) self.session.add_offset_listener(self.on_session_offset_changed) self.set_highlighting_session_component(self.session) # clips self.session.set_clip_launch_buttons(self.clip_launch_buttons) self.session.set_stop_track_clip_buttons(self.clip_stop_buttons) self.session.set_scene_launch_buttons(self.scene_launch_buttons) self.session.set_stop_all_clips_button(self.scene_stop_button) # nav self.session_scene_nav_encoder.add_value_listener( self.on_session_scene_nav)
def __init__(self, c_instance): ControlSurface.__init__(self, c_instance) with self.component_guard(): self._suggested_input_port = 'HyperControl' self._suggested_output_port = 'HyperControl' self._device_selection_follows_track_selection = True self.set_pad_translations(PAD_TRANSLATIONS) stop_button = make_button(116) play_button = make_button(117) record_button = make_button(118) select_button = make_button(98) nav_left_button = make_button(99) nav_right_button = make_button(100) nav_up_button = make_button(101) nav_down_button = make_button(102) mixer_modes_toggle = make_button(58) mixer_or_device_toggle = make_button(59) hypercontrol_mode_toggle = make_button(60) encoders = tuple([ make_encoder(33 + index) for index in range(8) ]) transport = TransportComponent() transport.set_stop_button(stop_button) transport.set_play_button(play_button) transport.set_record_button(record_button) session = SessionComponent(8, 0) device = BestBankDeviceComponent() self.set_device_component(device) device_nav = DeviceNavComponent() mixer = SpecialMixerComponent(NUM_TRACKS) session.set_mixer(mixer) mixer_encoder_modes = EncoderMixerModeSelector(mixer) mixer_encoder_modes.set_mode_toggle(mixer_modes_toggle) mixer_or_device = MixerOrDeviceModeSelector(encoders, select_button, nav_up_button, nav_down_button, nav_left_button, nav_right_button, mixer, session, device, mixer_encoder_modes, device_nav) mixer_or_device.set_mode_buttons((mixer_modes_toggle, mixer_or_device_toggle, hypercontrol_mode_toggle))
def _display_session_ring(self): # type: () -> None if self.session: self._hide_session_ring() try: if not self.song.selected_track.IS_ACTIVE: return except IndexError: return def get_all_sub_tracks_inclusive(parent_track): # type: (SimpleTrack) -> List[SimpleTrack] sub_tracks = [parent_track] for sub_track in parent_track.sub_tracks: sub_tracks.extend(get_all_sub_tracks_inclusive(sub_track)) return sub_tracks total_tracks = get_all_sub_tracks_inclusive(self.song.current_track.base_track) num_tracks = len([track for track in total_tracks if track.is_visible]) track_offset = self.session_track_offset with self.parent.component_guard(): self.session = SessionComponent(num_tracks=num_tracks, num_scenes=len(self.song.scenes)) self.session.set_offsets(track_offset=track_offset, scene_offset=0) if track_offset != len(list(self.song.visible_tracks)) - 1: self.parent.set_highlighting_session_component(self.session)
def __init__(self, matrix = [], navigation = None, scroll_navigation = None, scene_launches = [], stops = [], stop_all = None, mixer = False, triggered_to_play_value = YELLOW, record_value = PURPLE, stopped_value = CYAN, started_value = GREEN, **kwargs): # We can infer the width and height from the button matrix SessionComponent.__init__(self, len(matrix[0]), len(matrix)) Elementary.__init__(self, **kwargs) self.triggered_to_play_value = triggered_to_play_value self.record_value = record_value self.stopped_value = stopped_value self.started_value = started_value self.setup_matrix(matrix) self.setup_stops(stops, stop_all) if len(scene_launches) > 0: self.setup_scene_launch(scene_launches) self.setup_navigation(navigation, scroll_navigation) # Scene launch buttons next if mixer: self.set_mixer(mixer)
def __init__(self, num_tracks, num_scenes, stop_clip_buttons, control_surface, main_selector): self._stop_clip_buttons=stop_clip_buttons self._control_surface = control_surface self._main_selector = main_selector self._skin = self._control_surface._skin self._osd = None SessionComponent.__init__(self, num_tracks, num_scenes)
def _bank_left(self): if LC2Sysex.l9(): if self.track_offset() > 0: SessionComponent._bank_left(self) self.send_offsets() else: self._bank_left_button.turn_off()
class SessionManager(AbstractControlSurfaceComponent): def __init__(self, *a, **k): super(SessionManager, self).__init__(*a, **k) self.session = None # type: SessionComponent self.register_slot(self.parent.songManager, self._setup_session_control, "selected_track") self.register_slot(self.parent.songManager, self._setup_session_control, "scene_list") @catch_and_log def _setup_session_control(self): if not self.is_enabled() or self.song.current_track is None: return session_track_offset = self.session_track_offset if self.session: self.session.disconnect() num_tracks = len([ track for track in self.song.current_track.all_tracks if track.is_visible ]) self.session = SessionComponent(num_tracks=num_tracks, num_scenes=len(self.song.scenes)) self.session.set_offsets(track_offset=session_track_offset, scene_offset=0) self.parent.set_highlighting_session_component(self.session) @property def session_track_offset(self): # type: () -> int try: return [t for t in self.song.simple_tracks if t.is_visible].index(self.song.current_track.base_track) except ValueError: return self.session.track_offset() if self.session else 0
def disconnect(self): SessionComponent.disconnect(self) if self._synced_session != None: self._synced_session.remove_offset_listener(self._on_control_surface_offset_changed) self._mixer.set_tracks_to_use_callback(None) self._serato_interface = None return
def _on_control_surface_offset_changed(self): """ Updates offsets in serato to be the same as in control surface Called whenever control surface offsets are changed. """ SessionComponent.set_offsets(self, self._synced_session.track_offset(), self._synced_session.scene_offset())
def __init__(self, matrix = [], navigation = None, scene_launches = [], stops = [], stop_all = None, mixer = False, **kwargs): # We can infer the width and height from the button matrix SessionComponent.__init__(self, len(matrix[0]), len(matrix)) Elementary.__init__(self, **kwargs) self.setup_matrix(matrix) self.setup_stops(stops, stop_all) if len(scene_launches) > 0: self.setup_scene_launch(scene_launches) self.setup_navigation(navigation) # Scene launch buttons next if mixer: self.set_mixer(mixer)
def disconnect(self): for index in range(len(self._tracks_and_listeners)): track = self._tracks_and_listeners[index][0] listener = self._tracks_and_listeners[index][2] if ((track != None) and track.playing_slot_index_has_listener(listener)): track.remove_playing_slot_index_listener(listener) SessionComponent.disconnect(self)
def __init__(self, num_tracks, num_scenes, stop_clip_buttons, control_surface, main_selector): self._stop_clip_buttons = stop_clip_buttons self._control_surface = control_surface self._main_selector = main_selector self._skin = self._control_surface._skin self._osd = None SessionComponent.__init__(self, num_tracks, num_scenes)
def disconnect(self): SessionComponent.disconnect(self) if (self._slot_launch_button != None): self._slot_launch_button.remove_value_listener( self._slot_launch_value) self._slot_launch_button = None for h in self._play_rec_handlers: h.disconnect()
def _create_session(self): session = SessionComponent(self.SESSION_WIDTH, self.SESSION_HEIGHT, auto_name=True, enable_skinning=True, is_enabled=False, layer=Layer(scene_launch_buttons=self.wrap_matrix(self._scene_launch_buttons), clip_launch_buttons=self._session_matrix, stop_all_clips_button=self._stop_all_button, track_bank_left_button=self._left_button, track_bank_right_button=self._right_button, scene_bank_up_button=self._up_button, scene_bank_down_button=self._down_button)) for scene_index in xrange(self.SESSION_HEIGHT): for track_index in xrange(self.SESSION_WIDTH): slot = session.scene(scene_index).clip_slot(track_index) slot.layer = Layer(select_button=self._shift_button) return session
def disconnect(self): self._unregister_timer_callback(self._on_custom_timer) for index in range(len(self._tracks_and_listeners)): track = self._tracks_and_listeners[index][0] listener = self._tracks_and_listeners[index][2] SessionComponent.disconnect(self) self._scene_up_button = None self._scene_down_button = None
def _bank_down(self): if LC2Sysex.l9(): if len(self.song().scenes) > self.scene_offset() + self.height(): SessionComponent._bank_down(self) self.send_offsets() LC2Sysex.log_message(str(len(self.song().scenes)) + ' ' + str(self.scene_offset() + self.height())) if len(self.song().scenes) == self.scene_offset() + self.height(): self._bank_down_button.turn_off()
def _setup_session_control(self): self.show_message( "#################### SESSION: ON ##############################") self.session = SessionComponent(num_tracks, num_scenes) self.session.set_offsets(0, 0) self.session.set_track_bank_buttons( ButtonElement(False, MIDI_CC_TYPE, data_channel, session_right), ButtonElement(False, MIDI_CC_TYPE, data_channel, session_left))
def __init__(self, num_tracks, num_scenes): self._tracks_and_listeners = [] SessionComponent.__init__(self, num_tracks, num_scenes) self._scene_up_button = None self._scene_down_button = None self._scroll_up_ticks_delay = -1 self._scroll_down_ticks_delay = -1 self._register_timer_callback(self._on_custom_timer)
def disconnect(self): SessionComponent.disconnect(self) self.song().remove_current_song_time_listener(self.force_clips) if (self._clip_loop_start != None): self._clip_loop_start.remove_value_listener(self._slot_launch_loop_value) self._clip_loop_start = None if (self._clip_loop_length != None): self._clip_loop_length.remove_value_listener(self._clip_loop_length_value) self._clip_loop_length = None
def disconnect(self): SessionComponent.disconnect(self) if (self._slot_launch_button != None): self._slot_launch_button.remove_value_listener( self._slot_launch_value) self._slot_launch_button = None if (self._slot_gen_button != None): self._slot_gen_button.remove_value_listener(self._slot_gen_value) self._slot_gen_button = None
def __init__(self, control_surface, matrix, *a, **k): SessionComponent.__init__(self, self.session_width(matrix), matrix.height()) self.control_surface = control_surface self._matrix = matrix self._clip_loop_start = None self._clip_loop_length = None self._slot_launch_button = None self.setup() self.song().add_current_song_time_listener(self.force_clips)
def on_selected_track_changed(self): SessionComponent.on_selected_track_changed(self) selected_track = self.song().view.selected_track tracks = self.tracks_to_use() if selected_track in tracks: track_index = list(tracks).index(selected_track) new_offset = track_index - track_index % self._num_tracks assert new_offset / self._num_tracks == int(new_offset / self._num_tracks) self.set_offsets(new_offset, self.scene_offset())
def _create_session(self): session = SessionComponent(num_tracks=NUM_TRACKS, is_enabled=True, auto_name=True, enable_skinning=True) session.layer = Layer(track_bank_left_button=self._left_button, track_bank_right_button=self._right_button) self._on_session_offset_changed.subject = session return session
def on_selected_track_changed(self): SessionComponent.on_selected_track_changed(self) selected_track = self.song().view.selected_track tracks = self.tracks_to_use() track_index = selected_track in tracks and list(tracks).index(selected_track) new_offset = track_index - track_index % self._num_tracks if not new_offset / self._num_tracks == int(new_offset / self._num_tracks): raise AssertionError self.set_offsets(new_offset, self.scene_offset())
def _setup_session_control(self): is_momentary = True num_tracks = 2 num_scenes = 3 self._session = SessionComponent(num_tracks, num_scenes) self._session.name = "Session" self._session.set_offsets(0, 0) self._session.set_mixer(self._mixer) self.set_highlighting_session_component(self._session)
def disconnect(self): SessionComponent.disconnect(self) self._alt_mixer = None if self._next_track_button != None: self._next_track_button.remove_value_listener(self._next_track_value) self._next_track_button = None if self._prev_track_button != None: self._prev_track_button.remove_value_listener(self._prev_track_value) self._prev_track_button = None
def setup_session_control(self): #do i actually need session control ??? ...erm.. ...no, i don't think i do #num_tracks = 1 #8 columns (tracks) - see consts #num_scenes = 8 #8 rows (scenes) - see consts #(num_tracks, num_scenes) a session highlight ("red box") #self.session = SessionComponent(num_tracks,num_scenes) self._session = SessionComponent(settings.NUM_TRACKS, settings.NUM_SCENES) self._session.set_offsets(0, 0)
def _bank_right_value(self, value): if self._track_offset < self._width and self._width + self._track_offset < len( self.tracks_to_use()) or self._width < len(self.tracks_to_use( )) and self._width + self._track_offset < len( self.tracks_to_use()): SessionComponent._bank_right_value(self, value) self.send_offsets() else: self._bank_right_button.turn_off()
def __init__(self, c_instance): self._c_instance = c_instance self.is_momentary = True self.num_tracks = 4 self.num_scenes = 4 self._matrix = None self._linked_session_instances = None SessionComponent.__init__(self, self.num_tracks, self.num_scenes) self._setup_session_control() self.setup_clip_control_matrix()
def _setup_session(self): self._session = SessionComponent(NUM_CHANNEL_STRIPS, name='Session_Control') self._session.set_enabled(False) stop_buttons = ButtonMatrixElement(name='Track_Stop_Buttons', rows=[self._shifted_solo_buttons]) self._session.layer = Layer(stop_all_clips_button=self._shifted_stop_button, stop_track_clip_buttons=stop_buttons, select_prev_button=self._shifted_octave_down_button, select_next_button=self._shifted_octave_up_button) self._session.selected_scene().name = 'Selected_Scene_Control' self._session.selected_scene().layer = Layer(launch_button=self._shifted_play_button) for index in xrange(NUM_CHANNEL_STRIPS): slot = self._session.selected_scene().clip_slot(index) slot.layer = Layer(launch_button=self._shifted_mute_buttons[index])
def __init__(self, num_tracks, num_scenes): self._scene_count = LC2Sysex.l9() and -1 or 0 self._num_tracks = num_tracks self._height = num_scenes self._width = num_tracks self._snapshot_bank = LC2SessionBank() SessionComponent.__init__(self, num_tracks, num_scenes) LC2SceneComponent.set_get_offsets(self._get_offset) LC2ChannelStripComponent.set_get_offsets(self._get_offset) LC2ClipSlotComponent.set_get_offsets(self._get_offset) LC2ChannelStripComponent.set_playing_slot_changed(self._playing_slot_changed)
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()
def disconnect(self): for index in range(len(self._tracks_and_listeners)): track = self._tracks_and_listeners[index][0] fire_listener = self._tracks_and_listeners[index][1] playing_listener = self._tracks_and_listeners[index][2] if track != None: if track.fired_slot_index_has_listener(fire_listener): track.remove_fired_slot_index_listener(fire_listener) if track.playing_slot_index_has_listener(playing_listener): track.remove_playing_slot_index_listener(playing_listener) SessionComponent.disconnect(self)
def __init__(self, num_tracks, num_scenes, stop_clip_buttons, control_surface, main_selector): self._stop_clip_buttons = stop_clip_buttons self._control_surface = control_surface self._main_selector = main_selector self._osd = None if self._control_surface._mk2_rgb: #use custom clip colour coding : blink and pulse for trig and play SceneComponent.clip_slot_component_type = ClipSlotMK2 SessionComponent.__init__(self, num_tracks = num_tracks, num_scenes = num_scenes, enable_skinning = True, name='Session', is_root=True) if self._control_surface._mk2_rgb: from .ColorsMK2 import CLIP_COLOR_TABLE, RGB_COLOR_TABLE self.set_rgb_mode(CLIP_COLOR_TABLE, RGB_COLOR_TABLE)
def set_offsets(self, track_offset, scene_offset): assert (track_offset >= 0) assert (scene_offset >= 0) track_increment = 0 scene_increment = 0 if self._is_linked(): SessionComponent._perform_offset_change((track_offset - self._track_offset), (scene_offset - self._scene_offset)) else: if (len(self.tracks_to_use()) > track_offset + self.width() - 1): track_increment = track_offset - self._track_offset #modified if (len(self.song().scenes) > scene_offset + self.height() - 1): scene_increment = scene_offset - self._scene_offset #modified self._change_offsets(track_increment, scene_increment)
def _setup_session_control(self): is_momentary = True down_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 12, 89) up_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 12, 90) session = SessionComponent(NUM_TRACKS, 0) session.set_select_buttons(down_button, up_button) session.selected_scene().set_launch_button(ButtonElement(is_momentary, MIDI_NOTE_TYPE, 12, 87)) track_stop_buttons = [ ButtonElement(is_momentary, MIDI_NOTE_TYPE, index, 68) for index in range(NUM_TRACKS) ] session.set_stop_track_clip_buttons(tuple(track_stop_buttons)) for index in range(NUM_TRACKS): session.selected_scene().clip_slot(index).set_launch_button(ButtonElement(is_momentary, MIDI_NOTE_TYPE, index, 69))
def __init__(self, control_surface, num_tracks = 0, num_scenes = 0, *a, **k): SessionComponentBase.__init__(self, num_tracks, num_scenes, *a, **k) self.control_surface = control_surface self._logging = True self._lsync_relation = -1 self._lsync_track_offset = 0 self._lsync_scene_offset = 0 self._lsync_w = 8; self._lsync_h = 8; self._control_surface_x = -1; self._control_surface_y = -1; self._control_surface_w = -1; self._control_surface_h = -1;
def _setup_session(self): num_pads = len(PAD_TRANSLATIONS) self._session = SessionComponent(8, 0) self._session.name = 'Session_Control' self._session.selected_scene().name = 'Selected_Scene' self._session.set_mixer(self._mixer) # for ableton 9.1.1 and lower #self._session.set_track_banking_increment(num_pads) #self._session.set_track_bank_buttons(ButtonElement(not IS_MOMENTARY, MIDI_CC_TYPE, 0, 35), ButtonElement(not IS_MOMENTARY, MIDI_CC_TYPE, 0, 36)) # for ableton 9.1.1 and higher self._track_left_button = ButtonElement(not IS_MOMENTARY, MIDI_CC_TYPE, 0, 36) self._track_right_button = ButtonElement(not IS_MOMENTARY, MIDI_CC_TYPE, 0, 35) self._session.set_page_left_button(self._track_left_button) self._session.set_page_right_button(self._track_right_button) pads = [] for index in range(num_pads): pads.append(ButtonElement(IS_MOMENTARY, MIDI_CC_TYPE, 0, 60 + index)) pads[-1].name = 'Pad_' + str(index) clip_slot = self._session.selected_scene().clip_slot(index) clip_slot.set_triggered_to_play_value(GREEN_BLINK) clip_slot.set_triggered_to_record_value(RED_BLINK) clip_slot.set_stopped_value(AMBER_FULL) clip_slot.set_started_value(GREEN_FULL) clip_slot.set_recording_value(RED_FULL) clip_slot.set_launch_button(pads[-1]) clip_slot.name = str(index) + '_Selected_Clip_Slot'
def _setup_session_control(self): is_momentary = True num_tracks = NUM_TRACKS num_scenes = NUM_SCENES self._session = SessionComponent(num_tracks, num_scenes) self._session.name = "Session" self._session.set_offsets(0, 0) self._session.set_stop_track_clip_value(STOP_CLIP) self._scene = [None for index in range(3)] for row in range(num_scenes): self._scene[row] = self._session.scene(row) self._scene[row].name = 'Scene_' + str(row) for column in range(num_tracks): clip_slot = self._scene[row].clip_slot(column) clip_slot.name = str(column) + '_Clip_Slot_' + str(row) clip_slot.set_triggered_to_play_value(CLIP_TRG_PLAY) clip_slot.set_triggered_to_record_value(CLIP_TRG_REC) clip_slot.set_stopped_value(CLIP_STOP) clip_slot.set_started_value(CLIP_STARTED) clip_slot.set_recording_value(CLIP_RECORDING) self._session._stop_track_value = self._session_stop_track_value(self._session) self._session._on_fired_slot_index_changed = self._session_on_fired_slot_index_changed(self._session) self._session._change_offsets = self._session_change_offsets(self._session) self._session.update = self._session_update(self._session) #self._session.add_offset_listener(self._update_navigation_view) self._session.set_mixer(self._mixer) self.set_highlighting_session_component(self._session) self._session_zoom = SessionZoomingComponent(self._session) self._session_zoom.name = 'Session_Overview' self._session_zoom.set_stopped_value(ZOOM_STOPPED) self._session_zoom.set_playing_value(ZOOM_PLAYING) self._session_zoom.set_selected_value(ZOOM_SELECTED)
def _setup_session(self): scene_launch_button = self._control_factory.create_scene_launch_button() scene_stop_button = self._control_factory.create_scene_stop_button() self._session = SessionComponent(8, 0) self._session.name = 'Session_Control' self._session.selected_scene().name = 'Selected_Scene' self._session.selected_scene().set_launch_button(scene_launch_button) self._session.selected_scene().set_triggered_value(GREEN_BLINK) self._session.set_stop_all_clips_button(scene_stop_button) scene_stop_button.set_on_off_values(AMBER_FULL, LED_OFF) self._session.set_mixer(self._mixer) self._session.set_stop_clip_value(AMBER_HALF) self._session.set_stop_clip_triggered_value(GREEN_BLINK) clip_launch_buttons = [] clip_stop_buttons = [] for index in range(8): clip_launch_buttons.append(self._control_factory.create_clip_launch_button(index)) clip_stop_buttons.append(self._control_factory.create_clip_stop_button(index)) clip_slot = self._session.selected_scene().clip_slot(index) clip_slot.set_triggered_to_play_value(GREEN_BLINK) clip_slot.set_triggered_to_record_value(RED_BLINK) clip_slot.set_stopped_value(AMBER_FULL) clip_slot.set_started_value(GREEN_FULL) clip_slot.set_recording_value(RED_FULL) clip_slot.set_launch_button(clip_launch_buttons[-1]) clip_slot.name = 'Selected_Clip_Slot_' + str(index) self._session.set_stop_track_clip_buttons(tuple(clip_stop_buttons))
def _setup_mixer_controls(self): is_momentary = True self._num_tracks = 8 self._session = SessionComponent(self._num_tracks, 0) self._session.name = "Session" self._mixer = MixerComponent(self._num_tracks, 0, False, False) self._mixer.name = "Mixer" self._mixer._next_track_value = self._mixer_next_track_value(self._mixer) self._mixer._prev_track_value = self._mixer_prev_track_value(self._mixer) self._mixer.set_track_offset(0) # Sets start point for mixer strip (offset from left) # for index in range(8): # use the bottom row of encoders for volume, so add 24 to offset the index # self._mixer.channel_strip(index).set_volume_control(self._dial[index+24]) for index in range(8): self._mixer.channel_strip(index).name = "Mixer_ChannelStrip_" + str(index) self._mixer.channel_strip(index)._invert_mute_feedback = True self._mixer.channel_strip(index)._mute_value = self._channelstrip_mute_value( self._mixer.channel_strip(index) ) self._mixer.channel_strip(index)._solo_value = self._channelstrip_solo_value( self._mixer.channel_strip(index) ) # mixer.channel_strip(index).set_select_button(ButtonElement(is_momentary, MIDI_NOTE_TYPE, CH, track_select_notes[index])) self.song().view.selected_track = self._mixer.channel_strip( 0 )._track # set the selected strip to the first track, so that we don't, for example, try to assign a button to arm the master track, which would cause an assertion error self._session.set_mixer(self._mixer)