def update(self):
		#self._cs.log_message('update, enabled: ' + str(self.is_enabled()))
		DeviceComponent.update(self)
		if (self._parameter_controls != None):
			self._assign_params()
		if self.is_enabled():
			self._cs.request_rebuild_midi_map()
	def update(self):
		if self.is_enabled():
			if(not self._locked_to_device):
				if ((not self.application().view.is_view_visible('Detail')) or (not self.application().view.is_view_visible('Detail/DeviceChain'))):
 					self.application().view.show_view('Detail')
 					self.application().view.show_view('Detail/DeviceChain')
			#update bank buttons colors
			if self._device != None :
				if(self._prev_bank_button != None):
					self._prev_bank_button.set_on_off_values(AMBER_FULL,AMBER_THIRD)
				if(self._next_bank_button != None):
					self._next_bank_button.set_on_off_values(AMBER_FULL,AMBER_THIRD)
			else :
					self._prev_bank_button.set_on_off_values(LED_OFF,LED_OFF)
					self._next_bank_button.set_on_off_values(LED_OFF,LED_OFF)
			#update parent
			DeviceComponent.update(self)
			#reset sliders if no device
			if(self._device==None):
				for slider in self._sliders:
					slider.reset()
			#additional updates :
			self.update_track_buttons()
			self.update_device_buttons()
			self.update_lock_button()	
			self.update_on_off_button()
			self.update_precision_button()
			self.update_remaining_buttons()
	def update(self):
		DeviceComponent.update(self)
		if self.is_enabled():
			if self._on_off_parameter() != None and self._on_off_button != None:
				self._on_off_button.send_value(self._on_off_parameter().value > 0)
			if self._lock_button != None:
				self._lock_button.send_value(self.is_locked())
			self._script.request_rebuild_midi_map()
 def update(self):
     DeviceComponent.update(self)
     if self.is_enabled():
         if self._lock_button != None:
             if self._locked_to_device:
                 self._lock_button.turn_on()
             else:
                 self._lock_button.turn_off()
     self._on_on_off_changed()
 def update(self):
     DeviceComponent.update(self)
     if self.is_enabled():
         if self._lock_button != None:
             if self._locked_to_device:
                 self._lock_button.turn_on()
             else:
                 self._lock_button.turn_off()
     if LC2Sysex.l9():
         self._update_on_off_button()
     else:
         self._on_on_off_changed()
Beispiel #6
0
	def update(self):
		if self.is_enabled():
			if self._number_of_parameter_banks() <= self._bank_index:
				self._bank_index = 0
				
			if(not self._is_locked_to_device):
				if(self._device != None):
					if ((not self.application().view.is_view_visible('Detail')) or (not self.application().view.is_view_visible('Detail/DeviceChain'))):
						self.application().view.show_view('Detail')
						self.application().view.show_view('Detail/DeviceChain')
			# update bank buttons colors
			if self._device != None:
				if self._prev_bank_button != None:
					self._prev_bank_button.set_on_off_values("Device.Bank.On", "Device.Bank.Off")
				if self._next_bank_button != None:
					self._next_bank_button.set_on_off_values("Device.Bank.On", "Device.Bank.Off")
			else:
				if self._prev_bank_button != None:
					self._prev_bank_button.set_on_off_values("DefaultButton.Disabled","DefaultButton.Disabled")
				if self._next_bank_button != None:
					self._next_bank_button.set_on_off_values("DefaultButton.Disabled","DefaultButton.Disabled")
			if self._matrix != None:
				for x in range(self._matrix.width()):
					for y in range(self._matrix.height()):
						self._matrix.get_button(x, y).set_enabled(True)
						
			if self._device == None and self._matrix != None:
				for x in range(self._matrix.width()):
					for y in range(self._matrix.height()):
						if self._force:
							self._matrix.get_button(x, y).set_on_off_values("DefaulyButton.Disabled","DefaultButton.Disabled")
							self._matrix.get_button(x, y).turn_off()
						
			# update parent
			LiveDeviceComponent.update(self)
			if self._sliders != None:
				for slider in self._sliders:
					slider.reset_if_no_parameter()
			# additional updates :
			self.update_track_buttons()
			self.update_device_buttons()
			self.update_lock_buttons()
			self.update_on_off_button()
			self.update_precision_button()
			self._update_OSD()
			self._force = False
Beispiel #7
0
	def update(self):
		if self.is_enabled():
			if self._number_of_parameter_banks() <= self._bank_index:
				self._bank_index = 0
				
			if(not self._locked_to_device2):
				if(self._device != None):
					if ((not self.application().view.is_view_visible('Detail')) or (not self.application().view.is_view_visible('Detail/DeviceChain'))):
						self.application().view.show_view('Detail')
						self.application().view.show_view('Detail/DeviceChain')
			# update bank buttons colors
			if self._device != None:
				if self._prev_bank_button != None:
					self._prev_bank_button.set_on_off_values("Device.Bank.On", "Device.Bank.Off")
				if self._next_bank_button != None:
					self._next_bank_button.set_on_off_values("Device.Bank.On", "Device.Bank.Off")
			else:
				if self._prev_bank_button != None:
					self._prev_bank_button.set_on_off_values("DefaultButton.Disabled","DefaultButton.Disabled")
				if self._next_bank_button != None:
					self._next_bank_button.set_on_off_values("DefaultButton.Disabled","DefaultButton.Disabled")
			if self._matrix != None:
				for x in range(self._matrix.width()):
					for y in range(self._matrix.height()):
						self._matrix.get_button(x, y).set_enabled(True)
						
			if self._device == None and self._matrix != None:
				for x in range(self._matrix.width()):
					for y in range(self._matrix.height()):
						if self._force:
							self._matrix.get_button(x, y).set_on_off_values("DefaulyButton.Disabled","DefaultButton.Disabled")
							self._matrix.get_button(x, y).turn_off()
						
			# update parent
			LiveDeviceComponent.update(self)
			if self._sliders != None:
				for slider in self._sliders:
					slider.reset_if_no_parameter()
			# additional updates :
			self.update_track_buttons()
			self.update_device_buttons()
			self.update_lock_buttons()
			self.update_on_off_button()
			self.update_precision_button()
			self._update_OSD()
			self._force = False
    def update(self):
        if self.is_enabled():
            if self._number_of_parameter_banks() <= self._bank_index:
                self._bank_index = 0

            if (not self._locked_to_device2):
                if (self._device != None):
                    if ((not self.application().view.is_view_visible('Detail'))
                            or (not self.application().view.is_view_visible(
                                'Detail/DeviceChain'))):
                        self.application().view.show_view('Detail')
                        self.application().view.show_view('Detail/DeviceChain')
            # update bank buttons colors
            if self._device != None:
                if (self._prev_bank_button != None):
                    self._prev_bank_button.set_on_off_values(
                        AMBER_FULL, AMBER_THIRD)
                if (self._next_bank_button != None):
                    self._next_bank_button.set_on_off_values(
                        AMBER_FULL, AMBER_THIRD)
            else:
                self._prev_bank_button.set_on_off_values(LED_OFF, LED_OFF)
                self._next_bank_button.set_on_off_values(LED_OFF, LED_OFF)

            for x in range(self._matrix.width()):
                for y in range(self._matrix.height()):
                    #if self._force:
                    if (self._device == None):
                        self._matrix.get_button(x, y).set_on_off_values(
                            LED_OFF, LED_OFF)
                        self._matrix.get_button(x, y).turn_off()

            # update parent
            DeviceComponent.update(self)
            for slider in self._sliders:
                slider.reset_if_no_parameter()
            # additional updates :
            self.update_track_buttons()
            self.update_device_buttons()
            self.update_lock_buttons()
            self.update_on_off_button()
            self.update_precision_button()
            self._update_OSD()
            self._force = False
    def update(self):
        if self.is_enabled():
            if self._number_of_parameter_banks() <= self._bank_index:
                self._bank_index = 0

            if not self._locked_to_device2:
                if self._device != None:
                    if (not self.application().view.is_view_visible("Detail")) or (
                        not self.application().view.is_view_visible("Detail/DeviceChain")
                    ):
                        self.application().view.show_view("Detail")
                        self.application().view.show_view("Detail/DeviceChain")
                        # update bank buttons colors
            if self._device != None:
                if self._prev_bank_button != None:
                    self._prev_bank_button.set_on_off_values(self._skin.AMBER_FULL, self._skin.AMBER_THIRD)
                if self._next_bank_button != None:
                    self._next_bank_button.set_on_off_values(self._skin.AMBER_FULL, self._skin.AMBER_THIRD)
            else:
                self._prev_bank_button.set_on_off_values(self._skin.off, self._skin.off)
                self._next_bank_button.set_on_off_values(self._skin.off, self._skin.off)

            for x in range(self._matrix.width()):
                for y in range(self._matrix.height()):
                    # if self._force:
                    if self._device == None:
                        self._matrix.get_button(x, y).set_on_off_values(self._skin.off, self._skin.off)
                        self._matrix.get_button(x, y).turn_off()

                        # update parent
            DeviceComponent.update(self)
            for slider in self._sliders:
                slider.reset_if_no_parameter()
                # additional updates :
            self.update_track_buttons()
            self.update_device_buttons()
            self.update_lock_buttons()
            self.update_on_off_button()
            self.update_precision_button()
            self._update_OSD()
            self._force = False
	def update(self):
		DeviceComponent.update(self)
		if (self._parameter_controls != None):
			self._assign_params()
		if self.is_enabled():
			self._cs.request_rebuild_midi_map()
Beispiel #11
0
 def update(self):
     DeviceComponent.update(self)
     if (self._parameter_controls != None):
         self._assign_params()
     if self.is_enabled():
         self._cs.request_rebuild_midi_map()
Beispiel #12
0
class Codex(Codec):
    def __init__(self, c_instance, *a, **k):
        self._shifted = False
        super(Codex, self).__init__(c_instance, *a, **k)
        with self.component_guard():
            self._setup_alt_mixer()
            self._setup_alt_device_selector()
            self._setup_alt_send_reset()
            self._setup_alt_device_control()
        self.log_message(
            '<<<<<<<<<<<<<<<<<<<<<<<<< Codex subclass log opened >>>>>>>>>>>>>>>>>>>>>>>>>'
        )
        self.schedule_message(1, self._mode_update)

    def _setup_alt_device_selector(self):
        self._alt_device_selector = NewDeviceSelectorComponent(self)
        self._alt_device_selector.name = 'Alt_Device_Selector'

    def _setup_alt_send_reset(self):
        self._alt_send_reset = ResetSendsComponent(self)
        self._alt_send_reset.name = 'Alt_Reset_Sends'

    """these two secondary DeviceComponents are only set up if the MONOHM_LINK flag in Map is turned on"""

    def _setup_alt_device_control(self):
        self._device1 = NewDeviceComponent()
        self._device1.name = 'Device_Component1'
        self._device2 = NewDeviceComponent()
        self._device2.name = 'Device_Component2'

    def _setup_alt_mixer(self):
        is_momentary = True
        self._num_tracks = (8)  #A mixer is one-dimensional
        self._mixer2 = MixerComponent(8, 4, False, False)
        self._mixer2.name = 'Mixer'
        #self._mixer2.set_track_offset(4) #Sets start point for mixer strip (offset from left)
        for index in range(8):
            self._mixer2.channel_strip(
                index).name = 'Mixer_ChannelStrip_' + str(index)
            self._mixer2.channel_strip(index)._invert_mute_feedback = True

    """Mode Functions"""

    def _enable_alt(self):
        if self._main_mode._mode_index == 0:
            for encoder, _ in self._encoder_matrix.submatrix[:,
                                                             0:2].iterbuttons(
                                                             ):
                encoder.set_enabled(False)
                encoder.reset()
            self._alt_enabled = True
            self._mode_update()
        super(Codex, self)._enable_alt()

    def _disable_alt(self):
        if self._main_mode._mode_index == 0:
            self._button_matrix.submatrix[:, 0:2].reset()
            for encoder, _ in self._encoder_matrix.submatrix[:,
                                                             0:2].iterbuttons(
                                                             ):
                encoder.set_enabled(True)
        super(Codex, self)._disable_alt()

    def _deassign_all(self):
        self._alt_send_reset.set_buttons(tuple([None for index in range(4)]))
        self._alt_send_reset.set_enabled(False)
        self._alt_device_selector.set_buttons(None)
        self._alt_device_selector.set_enabled(False)
        self._mixer2.selected_strip().set_send_controls(None)
        for index in range(8):
            self._mixer2.channel_strip(index).set_volume_control(None)
            self._mixer2.channel_strip(index).set_select_button(None)
            self._mixer2.channel_strip(index).set_mute_button(None)
            self._dial[index][2].release_parameter()
        for index in range(3):
            self._mixer2.return_strip(index).set_volume_control(None)
        self._device1.set_enabled(False)
        self._device1._parameter_controls = None
        self._device2.set_enabled(False)
        self._device2._parameter_controls = None
        self._mixer2.return_strip(0).set_send_controls(None)
        self._mixer2.return_strip(1).set_send_controls(None)
        self._mixer2.return_strip(2).set_send_controls(None)
        super(Codex, self)._deassign_all()

    def _assign_volume(self):
        if self._alt_enabled:
            inputs = self.find_inputs()
            if not inputs is None:
                for index in range(4):
                    self._dial[index][2].connect_to(inputs.parameters[index +
                                                                      1])
                self._dial[6][2].connect_to(inputs.parameters[5])
            xfade = self.find_perc_crossfader()
            if not xfade is None:
                self._dial[7][3].connect_to(xfade)
            self._alt_device_selector.set_matrix(
                self._button_matrix.submatrix[:, 0:2])
            self._alt_device_selector.set_enabled(True)
            self._mixer2.return_strip(0).set_send_controls(
                [None, self._dial[4][2]])
            self._mixer2.return_strip(1).set_send_controls(
                [self._dial[5][2], None])
        else:
            self._alt_send_reset.set_buttons(
                tuple([
                    self._button[4][2], self._button[5][2], self._button[6][2],
                    self._button[7][2]
                ]))
            self._alt_send_reset.set_enabled(True)
            self._mixer2.selected_strip().set_send_controls([
                self._dial[0][2], self._dial[1][2], self._dial[2][2],
                self._dial[3][2]
            ])
            for index in range(3):
                self._mixer2.return_strip(index).set_volume_control(
                    self._dial[index + 4][2])
            self._mixer2.set_crossfader_control(self._dial[7][2])
            self._device1.set_parameter_controls(
                tuple([
                    self._dial[index % 4][int(index / 4)] for index in range(8)
                ]))
            self._device2.set_parameter_controls(
                tuple([
                    self._dial[(index % 4) + 4][int(index / 4)]
                    for index in range(8)
                ]))
            self._device1.set_enabled(True)
            self._device2.set_enabled(True)
            self._find_devices()
            self._device1.update()
            self._device2.update()
            for index in range(8):
                self._mixer2.channel_strip(index).set_select_button(
                    self._column_button[index])
        for index in range(8):
            self._mixer2.channel_strip(index).set_volume_control(
                self._dial[index][3])
            self._mixer2.channel_strip(index).set_mute_button(
                self._button[index][3])
        self._mixer2.update()
        self.request_rebuild_midi_map()
        #self._mixer2.set_track_offset(TROLL_OFFSET)

    def find_inputs(self):
        found_device = None
        tracks = self.song().tracks
        for track in tracks:
            if track.name == 'Inputs':
                for device in track.devices:
                    if bool(device.can_have_chains
                            ) and device.name == 'Inputs':
                        found_device = device
        return found_device

    def find_perc_crossfader(self):
        found_parameter = None
        tracks = self.song().tracks
        for track in tracks:
            if track.name == 'Perc':
                for device in track.devices:
                    if bool(device.can_have_chains) and device.name == 'Perc':
                        for parameter in device.parameters:
                            if parameter.name == 'XFade':
                                found_parameter = parameter
        return found_parameter

    """this method is used to find the devices the alt controls will latch to"""

    def _find_devices(self):
        if self._device1:
            if len(self.song().return_tracks) > 0:
                if len(self.song().return_tracks[0].devices) > 0:
                    if self._device1._locked_to_device:
                        self._device1.set_lock_to_device(
                            False, self._device1._device)
                    self._device1.set_lock_to_device(
                        True,
                        self.song().return_tracks[0].devices[0])
        if self._device2:
            if len(self.song().return_tracks) > 1:
                if len(self.song().return_tracks[1].devices) > 0:
                    if self._device2._locked_to_device:
                        self._device2.set_lock_to_device(
                            False, self._device2._device)
                    self._device2.set_lock_to_device(
                        True,
                        self.song().return_tracks[1].devices[0])
 def update(self):
     """Called by framework when the component needs to update"""
     DeviceComponent.update(self)
     colors = [45, 65, 0, 0] * 4
     self.send_colors(colors)
 def update(self):
     DeviceComponent.update(self)
     if not self.is_enabled(): return
     self._connect_sliders()
     self._connect_sibling_devices()
Beispiel #15
0
class Codex(Codec):


	def __init__(self, c_instance, *a, **k):
		self._shifted = False
		super(Codex, self).__init__(c_instance, *a, **k)
		with self.component_guard():
			self._setup_alt_mixer()
			self._setup_alt_device_selector()
			self._setup_alt_send_reset()
			self._setup_alt_device_control()
		self.log_message('<<<<<<<<<<<<<<<<<<<<<<<<< Codex subclass log opened >>>>>>>>>>>>>>>>>>>>>>>>>')
		self.schedule_message(1, self._mode_update)
	

	def _setup_alt_device_selector(self):
		self._alt_device_selector = NewDeviceSelectorComponent(self)
		self._alt_device_selector.name = 'Alt_Device_Selector'
	

	def _setup_alt_send_reset(self):
		self._alt_send_reset = ResetSendsComponent(self)
		self._alt_send_reset.name = 'Alt_Reset_Sends'
	

	"""these two secondary DeviceComponents are only set up if the MONOHM_LINK flag in Map is turned on"""
	def _setup_alt_device_control(self):
		self._device1 = NewDeviceComponent()
		self._device1.name = 'Device_Component1'
		self._device2 = NewDeviceComponent()
		self._device2.name = 'Device_Component2'
	

	def _setup_alt_mixer(self):
		is_momentary = True
		self._num_tracks = (8) #A mixer is one-dimensional
		self._mixer2 = MixerComponent(8, 4, False, False)
		self._mixer2.name = 'Mixer'
		#self._mixer2.set_track_offset(4) #Sets start point for mixer strip (offset from left)
		for index in range(8):
			self._mixer2.channel_strip(index).name = 'Mixer_ChannelStrip_' + str(index)
			self._mixer2.channel_strip(index)._invert_mute_feedback = True
	

	"""Mode Functions"""


	def _enable_alt(self):
		if self._main_mode._mode_index == 0:
			for encoder, _ in self._encoder_matrix.submatrix[:, 0:2].iterbuttons():
				encoder.set_enabled(False)
				encoder.reset()
			self._alt_enabled = True
			self._mode_update()
		super(Codex, self)._enable_alt()
	

	def _disable_alt(self):
		if self._main_mode._mode_index == 0:
			self._button_matrix.submatrix[:, 0:2].reset()
			for encoder, _ in self._encoder_matrix.submatrix[:, 0:2].iterbuttons():
				encoder.set_enabled(True)
		super(Codex, self)._disable_alt()
	

	def _deassign_all(self):
		self._alt_send_reset.set_buttons(None)
		self._alt_send_reset.set_enabled(False)
		self._alt_device_selector.set_buttons(None)
		self._alt_device_selector.set_enabled(False)
		self._mixer2.selected_strip().set_send_controls(None)
		for index in range(8):
			self._mixer2.channel_strip(index).set_volume_control(None)
			self._mixer2.channel_strip(index).set_select_button(None)
			self._mixer2.channel_strip(index).set_mute_button(None)
			self._dial[index][2].release_parameter()
		for index in range(3):
			self._mixer2.return_strip(index).set_volume_control(None)
		self._device1.set_enabled(False)
		self._device1._parameter_controls = None
		self._device2.set_enabled(False)
		self._device2._parameter_controls = None
		self._mixer2.return_strip(0).set_send_controls(None)
		self._mixer2.return_strip(1).set_send_controls(None)
		self._mixer2.return_strip(2).set_send_controls(None)
		super(Codex, self)._deassign_all()
	

	def _assign_volume(self):
		if self._alt_enabled:
			inputs = self.find_inputs()
			if not inputs is None:
				for index in range(4):
					self._dial[index][2].connect_to(inputs.parameters[index+1])
				self._dial[6][2].connect_to(inputs.parameters[5])
			xfade = self.find_perc_crossfader()
			if not xfade is None:
				self._dial[7][3].connect_to(xfade)
			self._alt_device_selector.set_matrix(self._button_matrix.submatrix[:, 0:2])
			self._alt_device_selector.set_enabled(True)
			self._mixer2.return_strip(0).set_send_controls([None, self._dial[4][2]])
			self._mixer2.return_strip(1).set_send_controls([self._dial[5][2], None])
		else:
			self._alt_send_reset.set_buttons(self._button_matrix.submatrix[4:, 2])
			self._alt_send_reset.set_enabled(True)
			self._mixer2.selected_strip().set_send_controls([self._dial[0][2], self._dial[1][2], self._dial[2][2], self._dial[3][2]])
			for index in range(3):
				self._mixer2.return_strip(index).set_volume_control(self._dial[index+4][2])
			self._mixer2.set_crossfader_control(self._dial[7][2])
			self._device1.set_parameter_controls(tuple([self._dial[index%4][int(index/4)] for index in range(8)]))
			self._device2.set_parameter_controls(tuple([self._dial[(index%4)+4][int(index/4)] for index in range(8)]))
			self._device1.set_enabled(True)
			self._device2.set_enabled(True)
			self._find_devices()
			self._device1.update()
			self._device2.update()
			for index in range(8):
				self._mixer2.channel_strip(index).set_select_button(self._column_button[index])
		for index in range(8):
			self._mixer2.channel_strip(index).set_volume_control(self._dial[index][3])
			self._mixer2.channel_strip(index).set_mute_button(self._button[index][3])
		self._mixer2.update()
		self.request_rebuild_midi_map()
		#self._mixer2.set_track_offset(TROLL_OFFSET)
	

	def find_inputs(self):
		found_device = None
		tracks = self.song().tracks
		for track in tracks:
			if track.name == 'Inputs':
				for device in track.devices:
					if bool(device.can_have_chains) and device.name.endswith('Inputs'):
						found_device = device
		return found_device
	

	def find_perc_crossfader(self):
		found_parameter = None
		tracks = self.song().tracks
		for track in tracks:
			if track.name == 'Perc':
				for device in track.devices:
					if bool(device.can_have_chains) and device.name == 'Perc':
						for parameter in device.parameters:
							if parameter.name == 'XFade':
								found_parameter = parameter
		return found_parameter
	

	"""this method is used to find the devices the alt controls will latch to"""
	def _find_devices(self):
		if self._device1:
			if len(self.song().return_tracks) > 0:
				if len(self.song().return_tracks[0].devices) > 0:
					if self._device1._locked_to_device:
						self._device1.set_lock_to_device(False, self._device1._device)
					self._device1.set_lock_to_device(True, self.song().return_tracks[0].devices[0])
		if self._device2:
			if len(self.song().return_tracks) > 1:
				if len(self.song().return_tracks[1].devices) > 0:
					if self._device2._locked_to_device:
						self._device2.set_lock_to_device(False, self._device2._device)
					self._device2.set_lock_to_device(True, self.song().return_tracks[1].devices[0])
	


#
#