def _arm_value(self, value):
     ChannelStripComponent._arm_value(self, value)
     if self._track != None and self._track != self.song().master_track and self._name_display != None and self._value_display != None:
         if self._track not in self.song().return_tracks:
             value != 0 and self._name_display.display_message('Arm :')
             self._value_display.send_midi(DISPLAY_WORD_ON) if self._track.arm else self._value_display.send_midi(DISPLAY_WORD_OFF)
     return
 def _select_value(self, value):
     ChannelStripComponent._select_value(self, value)
     if (self.is_enabled() and (self._track != None)):
         if (self._track.is_foldable and (self._select_button.is_momentary() and (value != 0))):
             self._toggle_fold_ticks_delay = TRACK_FOLD_DELAY
         else:
             self._toggle_fold_ticks_delay = -1
 def _select_value(self, value):
     ChannelStripComponent._select_value(self, value)
     if (self.is_enabled() and (self._track != None)):
         if (self._track.is_foldable and (self._select_button.is_momentary() and (value != 0))):
             self._toggle_fold_ticks_delay = TRACK_FOLD_DELAY
         else:
             self._toggle_fold_ticks_delay = -1
 def _on_solo_changed(self):
     if self._solo_button != None:
         if self._track != None and self._track != self.song().master_track:
             self._solo_button.set_on_off_values(AMB_FULL, AMB_LOW)
         else:
             self._solo_button.set_on_off_values(AMB_LOW, LED_OFF)
     ChannelStripComponent._on_solo_changed(self)
 def disconnect(self):
     """ releasing references and removing listeners"""
     if self._track != None:
         volume = self._track.mixer_device.volume
         panning = self._track.mixer_device.panning
         sends = self._track.mixer_device.sends
         if volume.value_has_listener(self._on_volume_changed):
             volume.remove_value_listener(self._on_volume_changed)
         if panning.value_has_listener(self._on_panning_changed):
             panning.remove_value_listener(self._on_panning_changed)
         if len(sends) > 0 and sends[0].value_has_listener(self._on_send1_changed):
             sends[0].remove_value_listener(self._on_send1_changed)
         if len(sends) > 1 and sends[1].value_has_listener(self._on_send2_changed):
             sends[1].remove_value_listener(self._on_send2_changed)
     if self._default_volume_button != None:
         self._default_volume_button.remove_value_listener(self._default_volume_value)
         self._default_volume_button = None
     if self._default_panning_button != None:
         self._default_panning_button.remove_value_listener(self._default_panning_value)
         self._default_panning_button = None
     if self._default_send1_button != None:
         self._default_send1_button.remove_value_listener(self._default_send1_value)
         self._default_send1_button = None
     if self._default_send2_button != None:
         self._default_send2_button.remove_value_listener(self._default_send2_value)
         self._default_send2_button = None
     ChannelStripComponent.disconnect(self)
     return
 def _on_arm_changed(self):
     if self._arm_button != None:
         if self._track != None and self._track in self.song().tracks:
             self._arm_button.set_on_off_values(RED_FULL, RED_LOW)
         else:
             self._arm_button.set_on_off_values(RED_LOW, LED_OFF)
     ChannelStripComponent._on_arm_changed(self)
 def disconnect(self):
     if self._track != None:
         volume = self._track.mixer_device.volume
         panning = self._track.mixer_device.panning
         sends = self._track.mixer_device.sends
         if volume.value_has_listener(self._on_volume_changed):
             volume.remove_value_listener(self._on_volume_changed)
         if panning.value_has_listener(self._on_panning_changed):
             panning.remove_value_listener(self._on_panning_changed)
         if (len(sends) > 0) and sends[0].value_has_listener(self._on_send1_changed):
             sends[0].remove_value_listener(self._on_send1_changed)
         if (len(sends) > 1) and sends[1].value_has_listener(self._on_send2_changed):
             sends[1].remove_value_listener(self._on_send2_changed)
     if self._default_volume_button != None:
         self._default_volume_button.remove_value_listener(self._default_volume_value)
         self._default_volume_button = None
     if self._default_panning_button != None:
         self._default_panning_button.remove_value_listener(self._default_panning_value)
         self._default_panning_button = None
     if self._default_send1_button != None:
         self._default_send1_button.remove_value_listener(self._default_send1_value)
         self._default_send1_button = None
     if self._default_send2_button != None:
         self._default_send2_button.remove_value_listener(self._default_send2_value)
         self._default_send2_button = None
     ChannelStripComponent.disconnect(self)
 def __init__(self):
     ChannelStripComponent.__init__(self)
     self._default_volume_button = None
     self._default_panning_button = None
     self._default_send1_button = None
     self._default_send2_button = None
     self._invert_mute_feedback = True
 def _on_arm_changed(self):
     if self._arm_button != None:
         if self._track != None and self._track in self.song().tracks:
             self._arm_button.set_on_off_values(RED_FULL, RED_LOW)
         else:
             self._arm_button.set_on_off_values(RED_LOW, LED_OFF)
     ChannelStripComponent._on_arm_changed(self)
 def _on_solo_changed(self):
     if self._solo_button != None:
         if self._track != None and self._track != self.song().master_track:
             self._solo_button.set_on_off_values(AMB_FULL, AMB_LOW)
         else:
             self._solo_button.set_on_off_values(AMB_LOW, LED_OFF)
     ChannelStripComponent._on_solo_changed(self)
 def __init__(self):
     ChannelStripComponent.__init__(self)
     self._default_volume_button = None
     self._default_panning_button = None
     self._default_send1_button = None
     self._default_send2_button = None
     self._invert_mute_feedback = True
 def disconnect(self):
     """ releasing references and removing listeners"""
     if (self._track != None):
         volume = self._track.mixer_device.volume
         panning = self._track.mixer_device.panning
         sends = self._track.mixer_device.sends
         if volume.value_has_listener(self._on_volume_changed):
             volume.remove_value_listener(self._on_volume_changed)
         if panning.value_has_listener(self._on_panning_changed):
             panning.remove_value_listener(self._on_panning_changed)
         if ((len(sends) > 0)
                 and sends[0].value_has_listener(self._on_send1_changed)):
             sends[0].remove_value_listener(self._on_send1_changed)
         if ((len(sends) > 1)
                 and sends[1].value_has_listener(self._on_send2_changed)):
             sends[1].remove_value_listener(self._on_send2_changed)
     if (self._default_volume_button != None):
         self._default_volume_button.remove_value_listener(
             self._default_volume_value)
         self._default_volume_button = None
     if (self._default_panning_button != None):
         self._default_panning_button.remove_value_listener(
             self._default_panning_value)
         self._default_panning_button = None
     if (self._default_send1_button != None):
         self._default_send1_button.remove_value_listener(
             self._default_send1_value)
         self._default_send1_button = None
     if (self._default_send2_button != None):
         self._default_send2_button.remove_value_listener(
             self._default_send2_value)
         self._default_send2_button = None
     ChannelStripComponent.disconnect(self)
 def _solo_value(self, value):
     ChannelStripComponent._solo_value(self, value)
     if self._track != None and self._track != self.song().master_track:
         if self._name_display != None and self._value_display != None:
             value != 0 and self._name_display.display_message('Solo :')
             self._value_display.send_midi(DISPLAY_WORD_ON) if self._track.solo else self._value_display.send_midi(DISPLAY_WORD_OFF)
     return
示例#14
0
		def _set_track(track):
			assert ((track == None) or isinstance(track, Live.Track.Track))
			if channelstrip._track != None and isinstance(channelstrip._track, Live.Track.Track):
				if channelstrip._track.devices_has_listener(cb):
					channelstrip._track.remove_devices_listener(cb)
			if (track != None):
				track.add_devices_listener(cb)
			ChannelStripComponent.set_track(channelstrip, track)
 def __init__(self):
     ChannelStripComponent.__init__(self)
     self.deleted = {}
     self.clear_mode = False
     self.touch_mode = False
     self.send_control = None
     self.clear_vol_button = None
     self.clear_pan_button = None
     self.clear_send_button = None
示例#16
0
 def set_track(self, track):
     custom_log("ChanStripComponent.set_track")
     # Remove monitoring listener for old track
     # if self._track_has_monitoring_state(self._track):
     # custom_log("(old) track.name = " + self._track.name)
     # self._track.remove_current_monitoring_state_listener(self._on_current_monitoring_state_changed)
     if self._current_monitoring_state_button != None:
         self._current_monitoring_state_button.turn_off()
     ChannelStripComponentBase.set_track(self, track)
	def __init__(self):
		ChannelStripComponent.__init__(self)
		self._first_device = DeviceComponent()
		self._assign_a = None
		self._assign_b = None
		self._device_button1 = None
		self._device_button2 = None
		self._device_button3 = None
		self._device_button4 = None
示例#18
0
 def _solo_value(self, value):
     ChannelStripComponent._solo_value(self, value)
     if self._track != None and self._track != self.song().master_track:
         if self._name_display != None and self._value_display != None:
             value != 0 and self._name_display.display_message('Solo :')
             self._value_display.send_midi(
                 DISPLAY_WORD_ON
             ) if self._track.solo else self._value_display.send_midi(
                 DISPLAY_WORD_OFF)
示例#19
0
 def set_track(self, track):
     custom_log("ChanStripComponent.set_track")
     # Remove monitoring listener for old track
     # if self._track_has_monitoring_state(self._track):
         # custom_log("(old) track.name = " + self._track.name)
         # self._track.remove_current_monitoring_state_listener(self._on_current_monitoring_state_changed)
     if self._current_monitoring_state_button != None:
         self._current_monitoring_state_button.turn_off()    
     ChannelStripComponentBase.set_track(self, track)
示例#20
0
 def _mute_value(self, value):
     ChannelStripComponent._mute_value(self, value)
     if self._track != None and self._track != self.song(
     ).master_track and self._name_display != None and self._value_display != None and value != 0:
         self._name_display.display_message('Mute :')
         if self._track.mute:
             self._value_display.send_midi(
                 DISPLAY_WORD_ON) if 1 else self._value_display.send_midi(
                     DISPLAY_WORD_OFF)
     return
示例#21
0
 def _arm_value(self, value):
     ChannelStripComponent._arm_value(self, value)
     if self._track != None and self._track != self.song(
     ).master_track and self._name_display != None and self._value_display != None:
         if self._track not in self.song().return_tracks:
             value != 0 and self._name_display.display_message('Arm :')
             self._value_display.send_midi(
                 DISPLAY_WORD_ON
             ) if self._track.arm else self._value_display.send_midi(
                 DISPLAY_WORD_OFF)
 def update(self):
     ChannelStripComponent.update(self)
     if self._allow_updates:
         if self.is_enabled():
             if self._track in self.song().tracks:
                 self._on_monitor_changed()
             self._on_selected_device_changed()
             self._on_monitor_changed()
             self._send_state()
     else:
         self._update_requests += 1
 def update(self):
     ChannelStripComponent.update(self)
     if self._allow_updates:
         if self.is_enabled():
             if self._track in self.song().tracks:
                 self._on_monitor_changed()
             self._on_selected_device_changed()
             self._on_monitor_changed()
             self._send_state()
     else:
         self._update_requests += 1
示例#24
0
 def _arm_value(self, value):
     if not self._arm_button != None:
         raise AssertionError
         if not value in range(128):
             raise AssertionError
             if self.is_enabled():
                 track_was_armed = False
                 if self._track != None and self._track.can_be_armed:
                     track_was_armed = self._track.arm
                 ChannelStripComponent._arm_value(self, value)
                 if self._track != None and self._track.can_be_armed:
                     self.song().view.selected_track = self._track.arm and not track_was_armed and self._track.view.select_instrument() and self._track
 def update(self):
     ChannelStripComponent.update(self)
     if self._allow_updates:
         if self.is_enabled():
             if (self._track != None):
                 volume = self._track.mixer_device.volume
                 panning = self._track.mixer_device.panning
                 sends = self._track.mixer_device.sends
                 if (not volume.value_has_listener(
                         self._on_volume_changed)):
                     volume.add_value_listener(self._on_volume_changed)
                 if (not panning.value_has_listener(
                         self._on_panning_changed)):
                     panning.add_value_listener(self._on_panning_changed)
                 if (len(sends) > 0):
                     if (not sends[0].value_has_listener(
                             self._on_send1_changed)):
                         sends[0].add_value_listener(self._on_send1_changed)
                     self._on_send1_changed()
                 elif (self._default_send1_button != None):
                     self._default_send1_button.turn_off()
                 if (len(sends) > 1):
                     if (not sends[1].value_has_listener(
                             self._on_send2_changed)):
                         sends[1].add_value_listener(self._on_send2_changed)
                     self._on_send2_changed()
                 elif (self._default_send2_button != None):
                     self._default_send2_button.turn_off()
                 self._on_volume_changed()
                 self._on_panning_changed()
             else:
                 if (self._default_volume_button != None):
                     self._default_volume_button.reset()
                 if (self._default_panning_button != None):
                     self._default_panning_button.reset()
                 if (self._default_send1_button != None):
                     self._default_send1_button.reset()
                 if (self._default_send2_button != None):
                     self._default_send2_button.reset()
                 if (self._mute_button != None):
                     self._mute_button.reset()
                 if (self._arm_button != None):
                     self._arm_button.reset()
                 if (self._solo_button != None):
                     self._solo_button.reset()
                 if (self._volume_control != None):
                     self._volume_control.reset()
                 if (self._pan_control != None):
                     self._pan_control.reset()
                 if (self._send_controls != None):
                     for send_control in self._send_controls:
                         if (send_control != None):
                             send_control.reset()
 def _arm_value(self, value):
     assert self._arm_button != None
     assert value in range(128)
     if self.is_enabled():
         track_was_armed = False
         if self._track != None and self._track.can_be_armed:
             track_was_armed = self._track.arm
         ChannelStripComponent._arm_value(self, value)
         if self._track != None and self._track.can_be_armed:
             if self._track.arm and not track_was_armed:
                 if self._track.view.select_instrument():
                     self.song().view.selected_track = self._track
     return
示例#27
0
    def __init__(self, control_surface):
        self.control_surface = control_surface
        self.song = control_surface.song()

        self.component = ChannelStripComponent()
        self.component.set_track(self.song.view.selected_track)

        self.component.set_volume_control(control_surface.get_encoder(3, 12))
        self.component.set_pan_control(control_surface.get_encoder(3, 4))
        self.component.set_send_controls((control_surface.get_encoder(3, 5),
                                          control_surface.get_encoder(3, 13),
                                          control_surface.get_encoder(3, 6),
                                          control_surface.get_encoder(3, 14)))
 def update(self):
     ChannelStripComponent.update(self)
     if self._allow_updates:
         if self.is_enabled():
             if self._track != None:
                 volume = self._track.mixer_device.volume
                 panning = self._track.mixer_device.panning
                 sends = self._track.mixer_device.sends
                 if not volume.value_has_listener(self._on_volume_changed):
                     volume.add_value_listener(self._on_volume_changed)
                 if not panning.value_has_listener(self._on_panning_changed):
                     panning.add_value_listener(self._on_panning_changed)
                 if len(sends) > 0:
                     if not sends[0].value_has_listener(self._on_send1_changed):
                         sends[0].add_value_listener(self._on_send1_changed)
                     self._on_send1_changed()
                 elif self._default_send1_button != None:
                     self._default_send1_button.turn_off()
                 if len(sends) > 1:
                     if not sends[1].value_has_listener(self._on_send2_changed):
                         sends[1].add_value_listener(self._on_send2_changed)
                     self._on_send2_changed()
                 elif self._default_send2_button != None:
                     self._default_send2_button.turn_off()
                 self._on_volume_changed()
                 self._on_panning_changed()
             else:
                 if self._default_volume_button != None:
                     self._default_volume_button.reset()
                 if self._default_panning_button != None:
                     self._default_panning_button.reset()
                 if self._default_send1_button != None:
                     self._default_send1_button.reset()
                 if self._default_send2_button != None:
                     self._default_send2_button.reset()
                 if self._mute_button != None:
                     self._mute_button.reset()
                 if self._arm_button != None:
                     self._arm_button.reset()
                 if self._solo_button != None:
                     self._solo_button.reset()
                 if self._volume_control != None:
                     self._volume_control.reset()
                 if self._pan_control != None:
                     self._pan_control.reset()
                 if self._send_controls != None:
                     for send_control in self._send_controls:
                         if send_control != None:
                             send_control.reset()
示例#29
0
 def set_track(self, track):
     self._remove_send_listeners()
     self._remove_level_listener()
     if self._track != None:
         self._track.remove_color_listener(self._on_track_color_changed)
         self._track.mixer_device.volume.remove_value_listener(self._on_volume_changed)
         self._track.remove_has_midi_output_listener(self._on_output_type_changed)
     ChannelStripComponent.set_track(self, track)
     if self._track != None:
         self._track.add_color_listener(self._on_track_color_changed)
         self._track.mixer_device.volume.add_value_listener(self._on_volume_changed)
         self._track.add_has_midi_output_listener(self._on_output_type_changed)
     self._add_send_listeners()
     self._on_volume_changed()
     self._on_output_type_changed()
     self._update_track_index()
 def set_track(self, track):
     self._remove_send_listeners()
     self._remove_level_listener()
     if self._track != None:
         self._track.remove_color_listener(self._on_track_color_changed)
         self._track.mixer_device.volume.remove_value_listener(self._on_volume_changed)
         self._track.remove_has_midi_output_listener(self._on_output_type_changed)
     ChannelStripComponent.set_track(self, track)
     if self._track != None:
         self._track.add_color_listener(self._on_track_color_changed)
         self._track.mixer_device.volume.add_value_listener(self._on_volume_changed)
         self._track.add_has_midi_output_listener(self._on_output_type_changed)
     self._add_send_listeners()
     self._on_volume_changed()
     self._on_output_type_changed()
     self._update_track_index()
示例#31
0
	def __init__(self, control_surface):
		self.control_surface = control_surface
		self.song = control_surface.song()
		
		self.component = ChannelStripComponent()
		self.component.set_track(self.song.view.selected_track)
		
		
		
		for cc, callback in ((100, self._arm), (108, self._mute_solo), (111, self._track_nav)):
			EncoderElement(	MIDI_CC_TYPE, \
							settings.CHANNEL, \
							cc, \
							Live.MidiMap.MapMode.relative_two_compliment)\
				.add_value_listener(callback)
				
		#for cc, callback in ((101, "set_pan_control"), (109, "set_volume_control")):
		self.component.set_pan_control(\
			EncoderElement(	MIDI_CC_TYPE, \
							settings.CHANNEL, \
							101, \
							Live.MidiMap.MapMode.relative_two_compliment))
		self.component.set_volume_control(\
			EncoderElement(	MIDI_CC_TYPE, \
							settings.CHANNEL, \
							109, \
							Live.MidiMap.MapMode.relative_two_compliment))
示例#32
0
    def _setup_device_control(self):
        self._device = DeviceComponent(None, True)
        self._channel_strip = ChannelStripComponent()
        self._device.name = 'Device_Component'
        lock_button = ButtonElement(True, MIDI_NOTE_TYPE, CHANNEL,
                                    DEVICE_LOCK_BUTTON)
        self._device.set_lock_button(lock_button)

        device_parameters = []
        for index in range(8):
            macro_knobs = SliderElement(MIDI_CC_TYPE, CHANNEL,
                                        KNOBS_BANK_ONE[index])
            device_parameters.append(macro_knobs)

        self._device.set_parameter_controls(device_parameters)
        self.set_device_component(
            self._device)  #Why not self._device.set_device_component()

        #device_nav_button = [ButtonElement(True, MIDI_NOTE_TYPE, CHANNEL, DEVICE_NAV_BUTTONS[index]) for index in range(2)]
        #self._device.set_device_nav_buttons(self, device_nav_button[0], device_nav_button[1])

        bank_button = [
            ButtonElement(True, MIDI_NOTE_TYPE, CHANNEL,
                          DEVICE_BANK_BUTTONS[index]) for index in range(2)
        ]
        self._device.set_bank_prev_button(bank_button[0])
        self._device.set_bank_next_button(bank_button[1])
示例#33
0
    def _setup_device_control(self):
        is_momentary = True
        self._device = DeviceComponent()
        self._channelstrip = ChannelStripComponent()
        self._device.name = 'Device_Component'

        device_param_controls = []
        for index in range(8):
            device_param_controls.append(
                SliderElement(MIDI_CC_TYPE, CHANNEL_FX, MACRO_CONTROLS[index]))
        self._device.set_parameter_controls(device_param_controls)
        self._device.set_on_off_button(
            ButtonElement(True, MIDI_CC_TYPE, CHANNEL_FX, DEVICE_ON))
        self._device.set_lock_button(
            ButtonElement(True, MIDI_CC_TYPE, CHANNEL_FX, DEVICE_LOCK))
        # self._device.set_bank_down_value(ButtonElement(True, MIDI_CC_TYPE, CHANNEL, DEVICE_LOCK))
        # self._device.set_bank_up_value(ButtonElement(True, MIDI_CC_TYPE, CHANNEL, DEVICE_ON))
        up_bank_button = ButtonElement(True, MIDI_CC_TYPE, CHANNEL_FX,
                                       DEVICE_BANK_UP)
        down_bank_button = ButtonElement(True, MIDI_CC_TYPE, CHANNEL_FX,
                                         DEVICE_BANK_DOWN)
        # self._device.set_bank_buttons(down_bank_button, up_bank_button)
        self.set_device_component(self._device)
        self._device_nav = DeviceNavComponent()
        self._device_nav.set_device_nav_buttons(
            ButtonElement(True, MIDI_CC_TYPE, CHANNEL_FX, PREVIOUS_DEVICE),
            ButtonElement(True, MIDI_CC_TYPE, CHANNEL_FX, NEXT_DEVICE))
        self._device.set_bank_prev_button(down_bank_button)
        self._device.set_bank_next_button(up_bank_button)
示例#34
0
class TrackControl():
    def __init__(self, control_surface):
        self.control_surface = control_surface
        self.song = control_surface.song()

        self.component = ChannelStripComponent()
        self.component.set_track(self.song.view.selected_track)

        self.component.set_volume_control(control_surface.get_encoder(3, 12))
        self.component.set_pan_control(control_surface.get_encoder(3, 4))
        self.component.set_send_controls((control_surface.get_encoder(3, 5),
                                          control_surface.get_encoder(3, 13),
                                          control_surface.get_encoder(3, 6),
                                          control_surface.get_encoder(3, 14)))

        # track navigation
        #control_surface.get_encoder(3,7).add_value_listener(self._track_nav)

    def _on_selected_track_changed(self):
        if self.song.view.selected_track:
            self.component.set_track(self.song.view.selected_track)

    def _get_all_tracks(self, only_visible=False):
        if not only_visible:
            return self.song.tracks + self.song.return_tracks + (
                self.song.master_track, )
        tracks = []
        for track in self.song.tracks:
            if track.is_visible:
                tracks.append(track)
        for track in self.song.return_tracks:
            tracks.append(track)
        tracks.append(self.song.master_track)
        return tracks

    # helper function to go from one track to the other
    def _get_track_by_delta(self, track, d_value):
        tracks = self._get_all_tracks(only_visible=True)
        max_tracks = len(tracks)
        for i in range(max_tracks):
            if track == tracks[i]:
                return tracks[max((0, min(i + d_value, max_tracks - 1)))]

    def _track_nav(self, value):
        value -= 64
        self.song.view.selected_track = self._get_track_by_delta(
            self.song.view.selected_track, value)
  def _select_value(self, value):
    was_selected = (self.song().view.selected_track == self._track)
    ChannelStripComponent._select_value(self, value)

    if was_selected and self.is_enabled() and (self._track != None):
      if (value >= 1):
        if self.application().view.is_view_visible('Detail/Clip'):
          self.application().view.show_view('Detail/DeviceChain')
          self.application().view.is_view_visible('Detail/DeviceChain')
        else:
          self.application().view.show_view('Detail/Clip')
          self.application().view.is_view_visible('Detail/Clip')

          # Select playing clip when detail view is shown
          if self._track.playing_slot_index >= 0:
            playing_clip = self._track.clip_slots[self._track.playing_slot_index].clip
            self.song().view.detail_clip = playing_clip
 def disconnect(self):
     self._remove_send_listeners()
     if self._track != None:
         self._track.remove_color_listener(self._on_track_color_changed)
         self._track.mixer_device.volume.remove_value_listener(self._on_volume_changed)
         self._track.remove_has_midi_output_listener(self._on_output_type_changed)
     ChannelStripComponent.disconnect(self)
     self._on_volume_changed()
     self._on_mute_changed()
     self._on_arm_changed()
     self._on_send_a_changed()
     self._on_send_b_changed()
     self._on_level_changed()
     self._on_track_name_changed()
     self._on_track_color_changed()
     self._update_track_index()
     self._serato_interface = None
示例#37
0
 def disconnect(self):
     self._remove_send_listeners()
     if self._track != None:
         self._track.remove_color_listener(self._on_track_color_changed)
         self._track.mixer_device.volume.remove_value_listener(self._on_volume_changed)
         self._track.remove_has_midi_output_listener(self._on_output_type_changed)
     ChannelStripComponent.disconnect(self)
     self._on_volume_changed()
     self._on_mute_changed()
     self._on_arm_changed()
     self._on_send_a_changed()
     self._on_send_b_changed()
     self._on_level_changed()
     self._on_track_name_changed()
     self._on_track_color_changed()
     self._update_track_index()
     self._serato_interface = None
    def _select_value(self, value):
        ChannelStripComponent._select_value(self, value)
        if self.is_enabled() and (self._track != None):

            ##Quirksmode
            if value == 1:
                if self.application().view.is_view_visible("Detail/Clip"):
                    self.application().view.show_view("Detail/DeviceChain")
                    self.application().view.is_view_visible("Detail/DeviceChain")
                else:
                    self.application().view.show_view("Detail/Clip")
                    self.application().view.is_view_visible("Detail/Clip")

            if self._track.is_foldable and (self._select_button.is_momentary() and (value != 0)):
                self._toggle_fold_ticks_delay = TRACK_FOLD_DELAY
            else:
                self._toggle_fold_ticks_delay = -1
示例#39
0
class TrackControl():
	def __init__(self, control_surface):
		self.control_surface = control_surface
		self.song = control_surface.song()
		
		self.component = ChannelStripComponent()
		self.component.set_track(self.song.view.selected_track)

		self.component.set_volume_control(control_surface.get_encoder(3,12))
		self.component.set_pan_control(control_surface.get_encoder(3,4))
		self.component.set_send_controls((control_surface.get_encoder(3,5), control_surface.get_encoder(3,13), control_surface.get_encoder(3,6), control_surface.get_encoder(3,14)))

		# track navigation
		#control_surface.get_encoder(3,7).add_value_listener(self._track_nav)
	
	
	def _on_selected_track_changed(self):
		if self.song.view.selected_track:
			self.component.set_track(self.song.view.selected_track)
	
	
	
	def _get_all_tracks(self, only_visible = False):
		if not only_visible:
			return self.song.tracks + self.song.return_tracks + (self.song.master_track, )
		tracks = []
		for track in self.song.tracks:
			if track.is_visible:
				tracks.append(track)
		for track in self.song.return_tracks:
			tracks.append(track)
		tracks.append(self.song.master_track)
		return tracks
	# helper function to go from one track to the other
	def _get_track_by_delta(self, track, d_value):
		tracks = self._get_all_tracks(only_visible = True)
		max_tracks = len(tracks)
		for i in range(max_tracks):
			if track == tracks[i]:
				return tracks[max((0, min(i+d_value, max_tracks-1)))]
	
		
	def _track_nav(self, value):
		value-= 64
		self.song.view.selected_track = self._get_track_by_delta(self.song.view.selected_track, value)
 def set_track(self, track):
     assert (track == None) or isinstance(track, Live.Track.Track)
     if track != self._track:
         if self._track != None:
             volume = self._track.mixer_device.volume
             panning = self._track.mixer_device.panning
             sends = self._track.mixer_device.sends
             if volume.value_has_listener(self._on_volume_changed):
                 volume.remove_value_listener(self._on_volume_changed)
             if panning.value_has_listener(self._on_panning_changed):
                 panning.remove_value_listener(self._on_panning_changed)
             if (len(sends) > 0) and sends[0].value_has_listener(self._on_send1_changed):
                 sends[0].remove_value_listener(self._on_send1_changed)
             if (len(sends) > 1) and sends[1].value_has_listener(self._on_send2_changed):
                 sends[1].remove_value_listener(self._on_send2_changed)
         ChannelStripComponent.set_track(self, track)
     else:
         self.update()
    def _select_value(self, value):
        was_selected = (self.song().view.selected_track == self._track)
        ChannelStripComponent._select_value(self, value)

        
        if was_selected and self.is_enabled() and (self._track != None):
          if (value >= 1):
              if self.application().view.is_view_visible('Detail/Clip'):
                  self.application().view.show_view('Detail/DeviceChain')
                  self.application().view.is_view_visible('Detail/DeviceChain')
              else:
                  self.application().view.show_view('Detail/Clip')
                  self.application().view.is_view_visible('Detail/Clip')
          
          if (self._track.is_foldable and (self._select_button.is_momentary() and (value != 0))):
              self._toggle_fold_ticks_delay = TRACK_FOLD_DELAY
          else:
              self._toggle_fold_ticks_delay = -1
	def set_track(self, track):
		assert ((track == None) or isinstance(track, Live.Track.Track))
		if (track != self._track):
			if (self._track != None):
				volume = self._track.mixer_device.volume
				panning = self._track.mixer_device.panning
				sends = self._track.mixer_device.sends
				if volume.value_has_listener(self._on_volume_changed):
					volume.remove_value_listener(self._on_volume_changed)
				if panning.value_has_listener(self._on_panning_changed):
					panning.remove_value_listener(self._on_panning_changed)
				if len(sends) > 0 and sends[0].value_has_listener(self._on_send1_changed):
					sends[0].remove_value_listener(self._on_send1_changed)
				if len(sends) > 1 and sends[1].value_has_listener(self._on_send2_changed):
					sends[1].remove_value_listener(self._on_send2_changed)
			ChannelStripComponent.set_track(self, track)
		else:
			self.update()
示例#43
0
	def __init__(self, control_surface):
		self.control_surface = control_surface
		self.song = control_surface.song()
		
		self.component = ChannelStripComponent()
		self.component.set_track(self.song.view.selected_track)

		self.component.set_volume_control(control_surface.get_encoder(3,12))
		self.component.set_pan_control(control_surface.get_encoder(3,4))
		self.component.set_send_controls((control_surface.get_encoder(3,5), control_surface.get_encoder(3,13), control_surface.get_encoder(3,6), control_surface.get_encoder(3,14)))
示例#44
0
class Pw(ControlSurface):
    def __init__(self, c_instance):
        super(Pw, self).__init__(c_instance)
        with self.component_guard():
            self.clips = []
            config = self._open_config()
            self._setup_session(config['width'], config['height'])
            self._setup_strip()
            self._track_clip_slots_info()

    def _open_config(self):
        with open('/users/berry/config.json') as f:
            data = json.load(f)
            self.log(json.dumps(data))
            return json.loads(json.dumps(data))

    def _track_clip_slots_info(self):
        track = self.session.tracks_to_use()[0]
        for cs in track.clip_slots:
            if cs.clip is not None:
                self.clips.append(cs.clip.name)
        self.log(json.dumps(self.clips))

    def _setup_session(self, width, height):
        self.session = SessionComponent(width, height)
        self.session.set_offsets(0, 0)
        self.set_highlighting_session_component(self.session)

    def _setup_strip(self):
        self.strip = ChannelStripComponent()
        self._update_strip()

    def _update_strip(self):
        self.strip.set_track(self.session.tracks_to_use()[0])

    def log(self, message):
        log_str = 'LOG: ' + message + '\n'
        with io.open("/users/berry/somefile.txt", mode='w',
                     encoding='utf-8') as f:
            f.write(log_str)
            f.close()
    def set_track(self, track):
        if self._track is not None:
            try:
                self._track.remove_color_listener(self._on_color_changed)
                self._track.remove_devices_listener(self._on_devices_changed)
                self._track.view.remove_selected_device_listener(self._on_selected_device_changed)
            except:
                pass

            if self._track in self.song().tracks and not self._track.is_foldable:
                self._track.remove_current_monitoring_state_listener(self._on_monitor_changed)
                self._track.remove_playing_slot_index_listener(self._on_playing_slot_changed)
        ChannelStripComponent.set_track(self, track)
        if track is not None:
            self._track.add_color_listener(self._on_color_changed)
            self._track.add_devices_listener(self._on_devices_changed)
            self._track.view.add_selected_device_listener(self._on_selected_device_changed)
            if track in self.song().tracks and not track.is_foldable:
                self._track.add_current_monitoring_state_listener(self._on_monitor_changed)
                self._track.add_playing_slot_index_listener(self._on_playing_slot_changed)
        self._on_selected_device_changed()
    def set_track(self, track):
        if self._track is not None:
            try:
                self._track.remove_color_listener(self._on_color_changed)
                self._track.remove_devices_listener(self._on_devices_changed)
                self._track.view.remove_selected_device_listener(self._on_selected_device_changed)
            except:
                pass

            if self._track in self.song().tracks and not self._track.is_foldable:
                self._track.remove_current_monitoring_state_listener(self._on_monitor_changed)
                self._track.remove_playing_slot_index_listener(self._on_playing_slot_changed)
        ChannelStripComponent.set_track(self, track)
        if track is not None:
            self._track.add_color_listener(self._on_color_changed)
            self._track.add_devices_listener(self._on_devices_changed)
            self._track.view.add_selected_device_listener(self._on_selected_device_changed)
            if track in self.song().tracks and not track.is_foldable:
                self._track.add_current_monitoring_state_listener(self._on_monitor_changed)
                self._track.add_playing_slot_index_listener(self._on_playing_slot_changed)
        self._on_selected_device_changed()
示例#47
0
    def _setup_device_control(self):
        is_momentary = True
        self._device = DeviceComponent()
        self._channelstrip = ChannelStripComponent()
        self._device.name = 'Device_Component'

        device_param_controls = []
        for index in range(8):
            device_param_controls.append(
                SliderElement(MIDI_CC_TYPE, CHANNEL, MACRO_CONTROLS[index]))
        self._device.set_parameter_controls(device_param_controls)
        self._device.set_on_off_button(
            ButtonElement(True, MIDI_NOTE_TYPE, CHANNEL, DEVICE_ON))
        self._device.set_lock_button(
            ButtonElement(True, MIDI_NOTE_TYPE, CHANNEL, DEVICE_LOCK))
        self.set_device_component(self._device)

        self._device_nav = DeviceNavComponent()
        self._device_nav.set_device_nav_buttons(
            ButtonElement(True, MIDI_NOTE_TYPE, CHANNEL, PREVIOUS_DEVICE),
            ButtonElement(True, MIDI_NOTE_TYPE, CHANNEL, NEXT_DEVICE))
 def disconnect(self):
     ChannelStripComponent.disconnect(self)
     self._name_display = None
     self._value_display = None
示例#49
0
		def _solo_value(value):
			if not self._shift_pressed:
				ChannelStripComponent._solo_value(channelstrip, value)
 def __init__(self):
     ChannelStripComponent.__init__(self)
     self._name_display = None
     self._value_display = None
 def __init__(self):
     ChannelStripComponent.__init__(self)
 def __init__(self):
     ChannelStripComponent.__init__(self)
     self._name_display = None
     self._value_display = None
 def __init__(self, id):
     self._monitor_toggle = None
     ChannelStripComponent.__init__(self)
     self._track_id = id
     self._device = LC2ChannelDeviceComponent()
示例#54
0
		def _mute_value(value):
			if not self._shift_pressed:
				self.log_message('shift not pressed')
				ChannelStripComponent._mute_value(channelstrip, value)
 def disconnect(self):
     ChannelStripComponent.disconnect(self)
     self._name_display = None
     self._value_display = None
 def __init__(self):
     ChannelStripComponent.__init__(self)
     self._track_empty_value = None
示例#57
0
 def __init__(self):
     ChannelStripComponent.__init__(self)
 def _on_track_name_changed(self):
     ChannelStripComponent._on_track_name_changed(self)
     self._send_state()