Exemplo n.º 1
0
class ReverbUnit(RackUnit):
    def __init__(self, parent):
         RackUnit.__init__(self, parent, 'reverb-unit')

         self.reverb_type = CbxParameter(parent=self,
                                         name='reverb-type',
                                         cc_nb=60,
                                         parameter_nb=33,
                                         max_value=12)
         self.reverb_diffusion = ScaleParameter(parent=self,
                                                name='reverb-diffusion',
                                                cc_nb=62,
                                                parameter_nb=35,
                                                max_value=99,
                                                display_percent=True)
         self.reverb_density = ScaleParameter(parent=self,
                                              name='reverb-density',
                                              cc_nb=63,
                                              parameter_nb=36,
                                              max_value=99,
                                              display_percent=True)
         self.reverb_decay = ScaleParameter(parent=self,
                                            name='reverb-decay',
                                            cc_nb=65,
                                            parameter_nb=37,
                                            max_value=9)
         self.reverb_level = ScaleParameter(parent=self,
                                            name='reverb-level',
                                            cc_nb=61,
                                            parameter_nb=34,
                                            max_value=99,
                                            display_percent=True)
         self.reverb_on_off_btn = BtnParameter(parent=self,
                                               name='reverb',
                                               cc_nb=59,
                                               parameter_nb=32)


    def update_conf_from_parameter(self, parameter):
        if parameter == self.reverb_type:
            str_value = parameter.str_value
            sensitivity = True
            if str_value == '2-Spring 7\"' or \
                    str_value == '2-Spring 14\"' or \
                    str_value == '3-Spring 14\"' or \
                    str_value == 'Rattle \'n\' Boing':
                sensitivity = False

            self.reverb_diffusion.set_sensitive(sensitivity)
            self.reverb_density.set_sensitive(sensitivity)
            self.reverb_decay.set_sensitive(sensitivity)
Exemplo n.º 2
0
class EffectUnit(RackUnit):
    class DepthDetuneParameter(ScaleParameter):
        def __init__(self, **kwargs):
            self.origin = 0
            ScaleParameter.__init__(self, **kwargs)

        def get_str_value(self):
            return '%d'%(self.value - self.origin)


    def __init__(self, parent):
        RackUnit.__init__(self, parent, 'effect-unit')

        self.effect_type = CbxParameter(parent=self,
                                        name='effect-type',
                                        cc_nb=45,
                                        parameter_nb=20,
                                        max_value=6)
        self.speed = ScaleParameter(parent=self,
                                    name='effect-speed',
                                    cc_nb=47,
                                    parameter_nb=22,
                                    max_value=90)
        self.depth = EffectUnit.DepthDetuneParameter(parent=self,
                                    name='effect-depth',
                                    cc_nb=48,
                                    parameter_nb=23,
                                    max_value=90)
        self.option = ScaleParameter(parent=self,
                                     name='effect-option',
                                     cc_nb=49, # regen
                                     parameter_nb=24,
                                     max_value=90)
        self.mix = ScaleParameter(parent=self,
                                  name='effect-mix',
                                  cc_nb=46, # level
                                  parameter_nb=21,
                                  max_value=90)
        self.on_off_btn = BtnParameter(parent=self,
                                       name='effect',
                                       cc_nb=44, # On/Bypass
                                       parameter_nb=19)

        self.rd_btn_grp = GrpParameter(parent=self, name='effect-rd-btn-grp')
        self.pre_rdbtn = RdBtnParameter(parent=self.rd_btn_grp,
                                        name='effect-pre',
                                        is_active=1,
                                        value=99,
                                        cc_nb=50, # position
                                        parameter_nb=25)
        self.post_rdbtn = RdBtnParameter(parent=self.rd_btn_grp,
                                         name='effect-post',
                                         is_active=0,
                                         value=0,
                                         cc_nb=50, # position
                                         parameter_nb=25)


    def update_conf_from_parameter(self, parameter):
        if parameter == self.effect_type:
            str_value = parameter.str_value

            speed_label = 'Speed:'
            speed_max = 99

            depth_label = 'Depth:'
            depth_origin = 0
            depth_max = 99

            option_label = 'PreDelay:'
            option_max = 99
            option_sensitivity = True

            if str_value == 'Chorus':
                option_max = 40
            elif str_value == 'Flanger':
                option_label = 'Regen:'
            elif str_value == 'Tremolo' or str_value == 'Rotary Speaker':
                option_sensitivity = False
            elif str_value == 'Auto Wah':
                speed_max = 2
            elif str_value == 'Pitch / Detune':
                option_sensitivity = False
                speed_label = 'Pitch:'
                speed_max = 48
                depth_label = 'Detune:'
                depth_origin = 30
                depth_max = 60

            self.speed.set_widget_label(speed_label)
            self.speed.set_max(speed_max)

            self.depth.set_widget_label(depth_label)
            self.depth.set_max(depth_max)
            self.depth.origin = depth_origin

            self.option.set_widget_label(option_label)
            self.option.set_sensitive(option_sensitivity)
            self.option.set_max(option_max)