Beispiel #1
0
    def update(self):
        super(TrackEQComponent, self).update()
        if self.is_enabled() and self._device != None:
            device_dict = EQ_DEVICES[self._device.class_name]
            if self._gain_controls != None:
                gain_names = device_dict['Gains']
                for index in range(len(self._gain_controls)):
                    self._gain_controls[index].release_parameter()
                    if len(gain_names) > index:
                        parameter = get_parameter_by_name(self._device, gain_names[index])
                        if parameter != None:
                            self._gain_controls[index].connect_to(parameter)

            if self._cut_buttons != None and 'Cuts' in device_dict.keys():
                cut_names = device_dict['Cuts']
                for index in range(len(self._cut_buttons)):
                    self._cut_buttons[index].turn_off()
                    if len(cut_names) > index:
                        parameter = get_parameter_by_name(self._device, cut_names[index])
                        if parameter != None:
                            if parameter.value == 0.0:
                                self._cut_buttons[index].turn_on()
                            if not parameter.value_has_listener(self._on_cut_changed):
                                parameter.add_value_listener(self._on_cut_changed)

        else:
            if self._cut_buttons != None:
                for button in self._cut_buttons:
                    if button != None:
                        button.turn_off()

            if self._gain_controls != None:
                for control in self._gain_controls:
                    control.release_parameter()
    def update(self):
        super(TrackEQComponent, self).update()
        if self.is_enabled() and self._device != None:
            device_dict = EQ_DEVICES[self._device.class_name]
            if self._gain_controls != None:
                gain_names = device_dict['Gains']
                for index in range(len(self._gain_controls)):
                    self._gain_controls[index].release_parameter()
                    if len(gain_names) > index:
                        parameter = get_parameter_by_name(self._device, gain_names[index])
                        if parameter != None:
                            self._gain_controls[index].connect_to(parameter)

            if self._cut_buttons != None and 'Cuts' in device_dict.keys():
                cut_names = device_dict['Cuts']
                for index in range(len(self._cut_buttons)):
                    self._cut_buttons[index].turn_off()
                    if len(cut_names) > index:
                        parameter = get_parameter_by_name(self._device, cut_names[index])
                        if parameter != None:
                            if parameter.value == 0.0:
                                self._cut_buttons[index].turn_on()
                            if not parameter.value_has_listener(self._on_cut_changed):
                                parameter.add_value_listener(self._on_cut_changed)

        else:
            if self._cut_buttons != None:
                for button in self._cut_buttons:
                    if button != None:
                        button.turn_off()

            if self._gain_controls != None:
                for control in self._gain_controls:
                    control.release_parameter()
 def update(self):
     if self.is_enabled() and self._device != None:
         device_dict = FILTER_DEVICES[self._device.class_name]
         if self._freq_control != None:
             self._freq_control.release_parameter()
             parameter = get_parameter_by_name(self._device, device_dict['Frequency'])
             if parameter != None:
                 self._freq_control.connect_to(parameter)
         if self._reso_control != None:
             self._reso_control.release_parameter()
             parameter = get_parameter_by_name(self._device, device_dict['Resonance'])
             if parameter != None:
                 self._reso_control.connect_to(parameter)
 def update(self):
     if self.is_enabled() and self._device != None:
         device_dict = FILTER_DEVICES[self._device.class_name]
         if self._freq_control != None:
             self._freq_control.release_parameter()
             parameter = get_parameter_by_name(self._device, device_dict['Frequency'])
             if parameter != None:
                 self._freq_control.connect_to(parameter)
         if self._reso_control != None:
             self._reso_control.release_parameter()
             parameter = get_parameter_by_name(self._device, device_dict['Resonance'])
             if parameter != None:
                 self._reso_control.connect_to(parameter)
 def update(self):
     super(TrackFilterComponent, self).update()
     if self.is_enabled() and self._device != None:
         device_dict = FILTER_DEVICES[self._device.class_name]
         if self._freq_control != None:
             self._freq_control.release_parameter()
             parameter = get_parameter_by_name(self._device, device_dict["Frequency"])
             if parameter != None:
                 self._freq_control.connect_to(parameter)
         if self._reso_control != None:
             self._reso_control.release_parameter()
             parameter = get_parameter_by_name(self._device, device_dict["Resonance"])
             if parameter != None:
                 self._reso_control.connect_to(parameter)
    def disconnect(self):
        if self._gain_controls != None:
            for control in self._gain_controls:
                control.release_parameter()

            self._gain_controls = None
        if self._cut_buttons != None:
            for button in self._cut_buttons:
                button.remove_value_listener(self._cut_value)

        self._cut_buttons = None
        if self._track != None:
            self._track.remove_devices_listener(self._on_devices_changed)
            self._track = None
        self._device = None
        if self._device != None:
            device_dict = EQ_DEVICES[self._device.class_name]
            if 'Cuts' in device_dict.keys():
                cut_names = device_dict['Cuts']
                for cut_name in cut_names:
                    parameter = get_parameter_by_name(self._device, cut_name)
                    if parameter != None and parameter.value_has_listener(
                            self._on_cut_changed):
                        parameter.remove_value_listener(self._on_cut_changed)

        return
    def disconnect(self):
        if self._gain_controls != None:
            for control in self._gain_controls:
                control.release_parameter()

            self._gain_controls = None
        if self._cut_buttons != None:
            for button in self._cut_buttons:
                button.remove_value_listener(self._cut_value)

        self._cut_buttons = None
        if self._track != None:
            self._track.remove_devices_listener(self._on_devices_changed)
            self._track = None
        self._device = None
        if self._device != None:
            device_dict = EQ_DEVICES[self._device.class_name]
            if 'Cuts' in device_dict.keys():
                cut_names = device_dict['Cuts']
                for cut_name in cut_names:
                    parameter = get_parameter_by_name(self._device, cut_name)
                    if parameter != None and parameter.value_has_listener(self._on_cut_changed):
                        parameter.remove_value_listener(self._on_cut_changed)

        return
 def _on_cut_changed(self):
     if not self._device != None:
         raise AssertionError
         raise 'Cuts' in EQ_DEVICES[self._device.class_name].keys() or AssertionError
         cut_names = self.is_enabled() and self._cut_buttons != None and EQ_DEVICES[self._device.class_name]['Cuts']
         for index in range(len(self._cut_buttons)):
             self._cut_buttons[index].turn_off()
             if len(cut_names) > index:
                 parameter = get_parameter_by_name(self._device, cut_names[index])
                 if parameter != None and parameter.value == 0.0:
                     self._cut_buttons[index].turn_on()
Beispiel #9
0
 def _on_cut_changed(self):
     if not self._device != None:
         raise AssertionError
         raise 'Cuts' in EQ_DEVICES[self._device.class_name].keys() or AssertionError
         cut_names = self.is_enabled() and self._cut_buttons != None and EQ_DEVICES[self._device.class_name]['Cuts']
         for index in range(len(self._cut_buttons)):
             self._cut_buttons[index].turn_off()
             if len(cut_names) > index:
                 parameter = get_parameter_by_name(self._device, cut_names[index])
                 if parameter != None and parameter.value == 0.0:
                     self._cut_buttons[index].turn_on()
Beispiel #10
0
 def _on_cut_changed(self):
     assert self._device != None
     assert u'Cuts' in list(EQ_DEVICES[self._device.class_name].keys())
     if self.is_enabled() and self._cut_buttons != None:
         cut_names = EQ_DEVICES[self._device.class_name][u'Cuts']
         for index in range(len(self._cut_buttons)):
             self._cut_buttons[index].turn_off()
             if len(cut_names) > index:
                 parameter = get_parameter_by_name(self._device,
                                                   cut_names[index])
                 if parameter != None and parameter.value == 0.0:
                     self._cut_buttons[index].turn_on()
 def _cut_value(self, value, sender):
     if not sender in self._cut_buttons:
         raise AssertionError
         if not value in range(128):
             raise AssertionError
             if self.is_enabled() and self._device != None:
                 if not sender.is_momentary() or value is not 0:
                     device_dict = EQ_DEVICES[self._device.class_name]
                     if 'Cuts' in device_dict.keys():
                         cut_names = device_dict['Cuts']
                         index = list(self._cut_buttons).index(sender)
                         parameter = index in range(len(cut_names)) and get_parameter_by_name(self._device, cut_names[index])
                         parameter.value = parameter != None and parameter.is_enabled and float(int(parameter.value + 1) % 2)
Beispiel #12
0
 def _cut_value(self, value, sender):
     if not sender in self._cut_buttons:
         raise AssertionError
         if not value in range(128):
             raise AssertionError
             if self.is_enabled() and self._device != None:
                 if not sender.is_momentary() or value is not 0:
                     device_dict = EQ_DEVICES[self._device.class_name]
                     if 'Cuts' in device_dict.keys():
                         cut_names = device_dict['Cuts']
                         index = list(self._cut_buttons).index(sender)
                         parameter = index in range(len(cut_names)) and get_parameter_by_name(self._device, cut_names[index])
                         parameter.value = parameter != None and parameter.is_enabled and float(int(parameter.value + 1) % 2)
Beispiel #13
0
 def _cut_value(self, value, sender):
     assert sender in self._cut_buttons
     assert value in range(128)
     if self.is_enabled() and self._device != None:
         if not sender.is_momentary() or value is not 0:
             device_dict = EQ_DEVICES[self._device.class_name]
             if u'Cuts' in list(device_dict.keys()):
                 cut_names = device_dict[u'Cuts']
                 index = list(self._cut_buttons).index(sender)
                 if index in range(len(cut_names)):
                     parameter = get_parameter_by_name(
                         self._device, cut_names[index])
                     if parameter != None and parameter.is_enabled:
                         parameter.value = float(
                             int(parameter.value + 1) % 2)
    def _on_devices_changed(self):
        if self._device != None:
            device_dict = EQ_DEVICES[self._device.class_name]
            if 'Cuts' in device_dict.keys():
                cut_names = device_dict['Cuts']
                for cut_name in cut_names:
                    parameter = get_parameter_by_name(self._device, cut_name)
                    if parameter != None and parameter.value_has_listener(self._on_cut_changed):
                        parameter.remove_value_listener(self._on_cut_changed)

        self._device = None
        if self._track != None:
            for index in range(len(self._track.devices)):
                device = self._track.devices[-1 * (index + 1)]
                if device.class_name in EQ_DEVICES.keys():
                    self._device = device
                    break

        self.update()
Beispiel #15
0
    def _on_devices_changed(self):
        if self._device != None:
            device_dict = EQ_DEVICES[self._device.class_name]
            if 'Cuts' in device_dict.keys():
                cut_names = device_dict['Cuts']
                for cut_name in cut_names:
                    parameter = get_parameter_by_name(self._device, cut_name)
                    if parameter != None and parameter.value_has_listener(self._on_cut_changed):
                        parameter.remove_value_listener(self._on_cut_changed)

        self._device = None
        if self._track != None:
            for index in range(len(self._track.devices)):
                device = self._track.devices[-1 * (index + 1)]
                if device.class_name in EQ_DEVICES.keys():
                    self._device = device
                    break

        self.update()
    def _set_fx_devices(self):
        self._fx1_device = None
        self._fx2_device = None
        self._fx3_device = None
        if self._track != None:
            matched_devices = []
            for device in self._track.devices:
                if device.class_name in FX_DEVICES.keys():
                     matched_devices.append(device)

            if not matched_devices:
                return

            device = None

            # FX1 Device (required)
            device = matched_devices[0]
            device_dict = FX_DEVICES[device.class_name]
            self._fx1_device = {
                'device': device,
                'macro1': get_parameter_by_name(device, device_dict['macro1']),
                'macro2': get_parameter_by_name(device, device_dict['macro2']),
                'macro3': get_parameter_by_name(device, device_dict['macro3']),
                'macro4': get_parameter_by_name(device, device_dict['macro4']),
            }
            
            # FX2 Device (optional)
            try:
                device = matched_devices[1]
                device_dict = FX_DEVICES[device.class_name]
                self._fx2_device = {
                    'device': device,
                    'macro1': get_parameter_by_name(device, device_dict['macro1']),
                    'macro2': get_parameter_by_name(device, device_dict['macro2']),
                    'macro3': get_parameter_by_name(device, device_dict['macro3']),
                    'macro4': get_parameter_by_name(device, device_dict['macro4']),
                }
            except IndexError:
                pass

            # FX3 Device (optional)
            try:
                device = matched_devices[2]
                device_dict = FX_DEVICES[device.class_name]
                self._fx3_device = {
                    'device': device,
                    'macro1': get_parameter_by_name(device, device_dict['macro1']),
                    'macro2': get_parameter_by_name(device, device_dict['macro2']),
                    'macro3': get_parameter_by_name(device, device_dict['macro3']),
                    'macro4': get_parameter_by_name(device, device_dict['macro4']),
                }
            except IndexError:
                pass