当前位置: 首页>>代码示例>>Python>>正文


Python ModesComponent._set_selected_mode方法代码示例

本文整理汇总了Python中_Framework.ModesComponent.ModesComponent._set_selected_mode方法的典型用法代码示例。如果您正苦于以下问题:Python ModesComponent._set_selected_mode方法的具体用法?Python ModesComponent._set_selected_mode怎么用?Python ModesComponent._set_selected_mode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在_Framework.ModesComponent.ModesComponent的用法示例。


在下文中一共展示了ModesComponent._set_selected_mode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: ChannelStripComponent

# 需要导入模块: from _Framework.ModesComponent import ModesComponent [as 别名]
# 或者: from _Framework.ModesComponent.ModesComponent import _set_selected_mode [as 别名]
class ChannelStripComponent(BaseChannelStripComponent):
    """ A custom channel strip with support for fx knobs and LED level meters """

    def __init__(self):
        for send_num in range(1,4):
            send_key = '_send%s_control' % send_num
            setattr(self, send_key, None)
            setattr(self, 'set%s' % send_key, set_send_control(self, send_num))

        for fx_num in range(1,4):
            fx_device_key = '_fx%s_device' % fx_num
            setattr(self, fx_device_key, None)
            for macro_num in range(1,5):
                fx_macro_key = '_fx%s_macro%s_control' % (fx_num, macro_num)
                setattr(self, fx_macro_key, None)
                setattr(self, 'set%s' % fx_macro_key, set_fx_control(self, fx_num, macro_num))

        self._vu_meter_control = None

        super(ChannelStripComponent, self).__init__()

    def disconnect(self):
        """ releasing references and removing listeners"""
        super(ChannelStripComponent, self).disconnect()
        for send_num in range(1,4):
            send_key = '_send%s_control' % send_num
            setattr(self, send_key, None)
        for fx_num in range(1,4):
            fx_device_key = '_fx%s_device' % fx_num
            setattr(self, fx_device_key, None)
            for macro_num in range(1,5):
                fx_macro_key = '_fx%s_macro%s_control' % (fx_num, macro_num)
                setattr(self, fx_macro_key, None)

    def set_modes(self, sends_layer, fx1_layer, fx2_layer, fx3_layer):
        if hasattr(self, '_modes'):
            self._modes.disconnect()
        self._modes = ModesComponent()
        self._modes.add_mode('sends', [LayerMode(self, sends_layer)])
        self._modes.add_mode('fx1', [LayerMode(self, fx1_layer)])
        self._modes.add_mode('fx2', [LayerMode(self, fx2_layer)])
        self._modes.add_mode('fx3', [LayerMode(self, fx3_layer)])
        self._modes._set_selected_mode('sends')

    def set_send_control(self, send_num, control):
        current = getattr(self, '_send%s_control' % send_num)
        if control != current:
            changed = True
            if current:
                current.release_parameter()
            setattr(self, '_send%s_control' % send_num, control)
            self.update()

    def set_fx_control(self, fx_num, macro_num, control):
        current = getattr(self, '_fx%s_macro%s_control' % (fx_num, macro_num))
        if control != current:
            changed = True
            if current:
                current.release_parameter()
            setattr(self, '_fx%s_macro%s_control' % (fx_num, macro_num), control)
            self.update()

    def set_vu_meter_control(self, control):
        try:
            current = self._vu_meter_control.slider
        except AttributeError:
            current = None

        if current != control:
            if control is None:
                self._vu_meter_control = None
            else:
                self._vu_meter_control = VUMeterComponent(self)
                if self._track:
                    self._vu_meter_control.set_vu_meter(self._track)
                    self._vu_meter_control.set_led_slider(control)
            self.update()

    def _connect_parameters(self):
        current_mode = self._get_current_mode_index()
        if self._pan_control != None:
            self._pan_control.connect_to(self._track.mixer_device.panning)
        if self._volume_control != None:
            self._volume_control.connect_to(self._track.mixer_device.volume)
        if self._send1_control != None:
            self._send1_control.connect_to(self._track.mixer_device.sends[0])
        if self._send2_control != None:
            self._send2_control.connect_to(self._track.mixer_device.sends[1])
        if self._send3_control != None:
            self._send3_control.connect_to(self._track.mixer_device.sends[2])
        self._set_fx_devices()
        for fx_num in range(1,4):
            for macro_num in range(1,5):
                control_key = '_fx%s_macro%s_control' % (fx_num, macro_num)
                fx_control = getattr(self, control_key)
                if fx_control:
                    fx_device = getattr(self, '_fx%s_device' % fx_num)
                    if fx_device:
                        fx_control.connect_to(fx_device['macro%s' % macro_num])

#.........这里部分代码省略.........
开发者ID:jlantz,项目名称:AbletonS4Controller,代码行数:103,代码来源:ChannelStripComponent.py


注:本文中的_Framework.ModesComponent.ModesComponent._set_selected_mode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。