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


Python SliderElement.add_value_listener方法代码示例

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


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

示例1: Axiom_DirectLink

# 需要导入模块: from _Framework.SliderElement import SliderElement [as 别名]
# 或者: from _Framework.SliderElement.SliderElement import add_value_listener [as 别名]
class Axiom_DirectLink(ControlSurface):
    """ Script for the M-Audio Axiom DirectLink """

    def __init__(self, c_instance):
        ControlSurface.__init__(self, c_instance)
        with self.component_guard():
            self.set_pad_translations(PAD_TRANSLATIONS)
            self._device_selection_follows_track_selection = True
            self._suggested_input_port = "DirectLink"
            self._suggested_output_port = "DirectLink"
            self._waiting_for_first_response = True
            self._has_sliders = True
            self._current_midi_map = None
            self._display_reset_delay = -1
            self._shift_pressed = False
            self._shift_button = ButtonElement(IS_MOMENTARY, MIDI_CC_TYPE, 15, 13)
            self._master_slider = SliderElement(MIDI_CC_TYPE, 15, 41)
            self._next_nav_button = ButtonElement(IS_MOMENTARY, MIDI_CC_TYPE, 15, 111)
            self._prev_nav_button = ButtonElement(IS_MOMENTARY, MIDI_CC_TYPE, 15, 110)
            self._device_bank_buttons = None
            self._device_navigation = None
            self._shift_button.name = "Shift_Button"
            self._master_slider.name = "Master_Volume_Control"
            self._next_nav_button.name = "Next_Track_Button"
            self._prev_nav_button.name = "Prev_Track_Button"
            self._master_slider.add_value_listener(self._slider_value, identify_sender=True)
            self._shift_button.add_value_listener(self._shift_value)
            self._setup_mixer()
            self._setup_transport_and_session()
            self._setup_device()
            self._setup_display()
            for component in self.components:
                component.set_enabled(False)

        return

    def refresh_state(self):
        ControlSurface.refresh_state(self)
        self._waiting_for_first_response = True
        self.schedule_message(3, self._send_midi, SYSEX_START + (32, 46, 247))

    def handle_sysex(self, midi_bytes):
        if midi_bytes[0:-2] == SYSEX_START + (32,) and midi_bytes[-2] != 0:
            self._has_sliders = midi_bytes[-2] & 8 != 0
            if self._waiting_for_first_response:
                self._waiting_for_first_response = False
                self.schedule_message(1, self._show_startup_message)
                for component in self.components:
                    component.set_enabled(True)

            if self._has_sliders:
                self._mixer.master_strip().set_volume_control(self._master_slider)
                self._mixer.update()
            else:
                self._mixer.master_strip().set_volume_control(None)
                self._mixer.selected_strip().set_volume_control(self._master_slider)
            self.request_rebuild_midi_map()
        return

    def disconnect(self):
        self._display_data_source.set_display_string("  ")
        self._shift_button.remove_value_listener(self._shift_value)
        self._inst_button.remove_value_listener(self._inst_value)
        for encoder in self._encoders:
            encoder.remove_value_listener(self._encoder_value)

        for slider in tuple(self._sliders) + (self._master_slider,):
            slider.remove_value_listener(self._slider_value)

        for button in tuple(self._strip_buttons) + (self._selected_mute_solo_button,):
            button.remove_value_listener(self._mixer_button_value)

        for button in self._device_bank_buttons:
            button.remove_value_listener(self._device_bank_value)

        self._encoders = None
        self._sliders = None
        self._strip_buttons = None
        self._master_slider = None
        self._current_midi_map = None
        self._selected_mute_solo_button = None
        self._inst_button = None
        self._shift_button = None
        self._device_navigation = None
        self._display = None
        ControlSurface.disconnect(self)
        self._send_midi(SYSEX_START + (32, 0, 247))
        return

    def build_midi_map(self, midi_map_handle):
        self._current_midi_map = midi_map_handle
        ControlSurface.build_midi_map(self, midi_map_handle)

    def update_display(self):
        ControlSurface.update_display(self)
        if self._display_reset_delay >= 0:
            self._display_reset_delay -= 1
            if self._display_reset_delay == -1:
                self._show_current_track_name()

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

示例2: Novation_Impulse

# 需要导入模块: from _Framework.SliderElement import SliderElement [as 别名]
# 或者: from _Framework.SliderElement.SliderElement import add_value_listener [as 别名]
class Novation_Impulse(ControlSurface):
    """ Script for Novation's Impulse keyboards """

    def __init__(self, c_instance):
        ControlSurface.__init__(self, c_instance)
        with self.component_guard():
            self.set_pad_translations(PAD_TRANSLATIONS)
            self._device_selection_follows_track_selection = True
            self._suggested_input_port = 'Impulse'
            self._suggested_output_port = 'Impulse'
            self._has_sliders = True
            self._current_midi_map = None
            self._display_reset_delay = -1
            self._shift_button = ButtonElement(IS_MOMENTARY, MIDI_CC_TYPE, 0, 39)
            self._preview_button = ButtonElement(IS_MOMENTARY, MIDI_CC_TYPE, 0, 41)
            self._master_slider = SliderElement(MIDI_CC_TYPE, 0, 8)
            self._shift_button.name = 'Shift_Button'
            self._master_slider.name = 'Master_Volume_Control'
            self._master_slider.add_value_listener(self._slider_value, identify_sender=True)
            self._preview_button.add_value_listener(self._preview_value)
            self._setup_mixer()
            self._setup_session()
            self._setup_transport()
            self._setup_device()
            self._setup_name_display()
            device_button = ButtonElement(not IS_MOMENTARY, MIDI_CC_TYPE, 1, 10)
            mixer_button = ButtonElement(not IS_MOMENTARY, MIDI_CC_TYPE, 1, 9)
            device_button.name = 'Encoder_Device_Mode'
            mixer_button.name = 'Encoder_Mixer_Mode'
            self._encoder_modes = EncoderModeSelector(self._device_component, self._mixer, self._next_bank_button, self._prev_bank_button, self._encoders)
            self._encoder_modes.set_device_mixer_buttons(device_button, mixer_button)
            self._string_to_display = None
            for component in self.components:
                component.set_enabled(False)

    def refresh_state(self):
        ControlSurface.refresh_state(self)
        self.schedule_message(3, self._send_midi, SYSEX_START + (6, 1, 1, 1, 247))

    def handle_sysex(self, midi_bytes):
        if midi_bytes[0:-2] == SYSEX_START + (7,) and midi_bytes[-2] != 0:
            self._has_sliders = midi_bytes[-2] != 25
            self.schedule_message(1, self._show_startup_message)
            for control in self.controls:
                if isinstance(control, InputControlElement):
                    control.clear_send_cache()

            for component in self.components:
                component.set_enabled(True)

            if self._has_sliders:
                self._mixer.master_strip().set_volume_control(self._master_slider)
                self._mixer.update()
            else:
                self._mixer.master_strip().set_volume_control(None)
                self._mixer.selected_strip().set_volume_control(self._master_slider)
                for index in range(len(self._sliders)):
                    self._mixer.channel_strip(index).set_volume_control(None)
                    slider = self._sliders[index]
                    slider.release_parameter()
                    if slider.value_has_listener(self._slider_value):
                        slider.remove_value_listener(self._slider_value)

            self._encoder_modes.set_provide_volume_mode(not self._has_sliders)
            self.request_rebuild_midi_map()

    def disconnect(self):
        self._name_display_data_source.set_display_string('  ')
        for encoder in self._encoders:
            encoder.remove_value_listener(self._encoder_value)

        self._master_slider.remove_value_listener(self._slider_value)
        if self._has_sliders:
            for slider in tuple(self._sliders):
                slider.remove_value_listener(self._slider_value)

        for button in self._strip_buttons:
            button.remove_value_listener(self._mixer_button_value)

        self._preview_button.remove_value_listener(self._preview_value)
        ControlSurface.disconnect(self)
        self._encoders = None
        self._sliders = None
        self._strip_buttons = None
        self._master_slider = None
        self._current_midi_map = None
        self._shift_button = None
        self._name_display = None
        self._prev_bank_button = None
        self._next_bank_button = None
        self._encoder_modes = None
        self._transport_view_modes = None
        self._send_midi(SYSEX_START + (6, 0, 0, 0, 247))

    def build_midi_map(self, midi_map_handle):
        self._current_midi_map = midi_map_handle
        ControlSurface.build_midi_map(self, midi_map_handle)

    def update_display(self):
        ControlSurface.update_display(self)
#.........这里部分代码省略.........
开发者ID:OwenPratt,项目名称:AbletonLive9_RemoteScripts,代码行数:103,代码来源:Novation_Impulse.py

示例3: _setup_custom_controls

# 需要导入模块: from _Framework.SliderElement import SliderElement [as 别名]
# 或者: from _Framework.SliderElement.SliderElement import add_value_listener [as 别名]
    def _setup_custom_controls(self):
        is_momentary = True
        select_buttons = []
        
        encoders = []
        for track in range(8):
            select_buttons.append(ButtonElement(is_momentary, MIDI_CC_TYPE, MIDI_CHANNEL, select_buttons_ccs[track]))
        show_pot_values_button = ButtonElement(is_momentary, MIDI_CC_TYPE, MIDI_CHANNEL, SHOW_POT_VALUES_BUTTON)

        for index in range(8):
            encoder_led_mode_button = ButtonElement(not is_momentary, MIDI_CC_TYPE, MIDI_CHANNEL, encoder_led_mode_ccs[index])
            encoder_feedback = EncoderElement(MIDI_CC_TYPE, MIDI_CHANNEL, encoder_feedback_ccs[index], Live.MidiMap.MapMode.absolute)            
            ringed_encoder = SLEncoder(MIDI_CC_TYPE, MIDI_CHANNEL, encoder_row_ccs[index], Live.MidiMap.MapMode.relative_smooth_signed_bit)
            ringed_encoder.add_value_listener(self._mixer.encoder_moved)
            ringed_encoder.set_ring_mode_button(encoder_led_mode_button)
            ringed_encoder.set_led_ring_feedback(encoder_feedback)
            ringed_encoder.name = 'Device_Control_' + str(index)
            encoder_led_mode_button.name = ringed_encoder.name + '_Ring_Mode_Button' 
            encoders.append(ringed_encoder)
        self._encoders = encoders

        self._device = SLDevice(self._mixer, self._display)
        self._device.name = 'Device_Component'
        self._device.set_parameter_controls(tuple(encoders))
        self.set_device_component(self._device)
        self._mixer._device = self._device

        p1_buttons = []
        p1_buttons.append(ButtonElement(is_momentary, MIDI_CC_TYPE, MIDI_CHANNEL, P1_UP))
        p1_buttons.append(ButtonElement(is_momentary, MIDI_CC_TYPE, MIDI_CHANNEL, P1_DOWN))  

        self._encoder_modes = SLEncoderModeSelector(self._mixer, self._device, tuple(encoders))
        self._encoder_modes.name = 'encoder_modes'  
        self._encoder_modes.set_controls_to_translate(tuple(encoders))


        #==== OLD MODES
        #mute_buttons = [ ButtonElement(is_momentary, MIDI_CC_TYPE, MIDI_CHANNEL, mute_buttons_ccs[index]) for index in range(8) ]
        #mute_mode_button = ButtonElement(is_momentary, MIDI_CC_TYPE, MIDI_CHANNEL, MUTE_MODE_BUTTON)
        #self._mute_mode = SLMuteModeSelector(mute_mode_button, tuple(mute_buttons), self._mixer)
        #solo_buttons = [ ButtonElement(is_momentary, MIDI_CC_TYPE, MIDI_CHANNEL, solo_buttons_ccs[index]) for index in range(8) ]
        #ts_buttons = [ ButtonElement(is_momentary, MIDI_CC_TYPE, MIDI_CHANNEL, ts_ccs[index]) for index in range(6) ]
        #solo_mode_button = ButtonElement(is_momentary, MIDI_CC_TYPE, MIDI_CHANNEL, SOLO_MODE_BUTTON)
        #ts_lock_button = ButtonElement(is_momentary, MIDI_CC_TYPE, MIDI_CHANNEL, TS_LOCK)
        #self._transport = SLTransport(self, self._display)
        #self._transport.name = 'Transport'        
        #self._transport_mode = SLTransportModeSelector(ts_lock_button, tuple(ts_buttons), solo_mode_button, solo_buttons, self._transport, self._mixer)
        #==== NEW MODES
        mx_first_buttons = [ ButtonElement(is_momentary, MIDI_CC_TYPE, MIDI_CHANNEL, mute_buttons_ccs[index]) for index in range(8) ]
        mx_first_row_select = ButtonElement(is_momentary, MIDI_CC_TYPE, MIDI_CHANNEL, MUTE_MODE_BUTTON)
        mx_second_buttons = [ ButtonElement(is_momentary, MIDI_CC_TYPE, MIDI_CHANNEL, solo_buttons_ccs[index]) for index in range(8) ]
        mx_second_row_select = ButtonElement(is_momentary, MIDI_CC_TYPE, MIDI_CHANNEL, SOLO_MODE_BUTTON)
        
        for index in range(6):
            self._ts_buttons.append(ButtonElement(is_momentary, MIDI_CC_TYPE, MIDI_CHANNEL, ts_ccs[index]))
        ts_lock_button = SLSpecialButton(is_momentary, MIDI_CC_TYPE, MIDI_CHANNEL, TS_LOCK)
        self._transport = SLTransport(self, self._display)
        self._transport.name = 'Transport'
        
        self._button_modes = SLButtonModeSelector(self._mixer, self._session, mx_first_buttons, mx_second_buttons, self._transport, ts_lock_button, self._ts_buttons)
        #self._button_modes.set_mode_buttons((mx_first_row_select, mx_second_row_select))
        #self._button_modes.set_mode_toggle(mx_first_row_select)

        #--- SLSessionModeSelector TEST ---------------------
        for index in range(8):
            self._clip_launch_buttons.append(ButtonElement(is_momentary, MIDI_CC_TYPE, MIDI_CHANNEL, clip_launch_buttons_ccs[index]))        
        #session_modes = SLSessionModeSelector(self._session, self._mixer, self._scene_launch_button, tuple(self._clip_launch_buttons))
        #session_modes.set_mode_toggle(self._clip_launch_buttons[7])
        #session_modes.set_enabled(0)
        pots = []
        for index in range(8):
            pot = SliderElement(MIDI_CC_TYPE, MIDI_CHANNEL, pot_row_ccs[index])
            pot.add_value_listener(self._mixer.pot_moved)
            pots.append(pot)
        self._pot_modes = SLPotModeSelector(self._mixer, tuple(pots))
        self._pot_modes.set_controls_to_translate(tuple(pots))
        self._pot_modes.name = 'pot_modes'
        self._mixer._pots = tuple(pots)
        #----------------------------------------------------
        self._device_control = SLDeviceControl(self._device, self._display)
        
        
        self._shift_mode = SLShiftableSelector(tuple(select_buttons), show_pot_values_button, tuple(p1_buttons), self._scene_up_button, self._scene_down_button, self._scene_launch_button, self._session, self._mixer, self._encoder_modes, self._device, self._device_control, tuple(self._clip_launch_buttons), self._pot_modes)
        self._shift_mode.name = 'Shift_Modes'
        self._shift_mode.set_mode_toggle(self._shift_button)
        
        sliders = []
        for track in range(8):
            slider = SliderElement(MIDI_CC_TYPE, MIDI_CHANNEL, slider_row_ccs[track])
            slider.add_value_listener(self._mixer.slider_moved)
            sliders.append(slider)
            sliders[-1].name = str(track) + '_Volume_Control'
            
        mx_slider_row_select = ButtonElement(is_momentary, MIDI_CC_TYPE, MIDI_CHANNEL, SLIDER_MODE_BUTTON)
        self.master_mode = SLMasterModeSelector(self._mixer, self._session, tuple(sliders), self._button_modes, self._shift_mode, self._encoder_modes, self._pot_modes)
        self.master_mode.set_controls_to_translate(tuple(sliders))
        self.master_mode.name = 'Master_Mode'
        
        self._right_shift = SLRightShiftSelector(self._mixer, self._session, self._transport, self.master_mode, mx_slider_row_select, self._button_modes, mx_first_row_select)
        self._right_shift.name = 'Right_Shift_Mode'
#.........这里部分代码省略.........
开发者ID:deadeyedpupil,项目名称:AbletonLiveMidiRemoteScripts,代码行数:103,代码来源:SLUltimateControl.py

示例4: __init__

# 需要导入模块: from _Framework.SliderElement import SliderElement [as 别名]
# 或者: from _Framework.SliderElement.SliderElement import add_value_listener [as 别名]
class MainKnobControl:
    __module__ = __name__
    __doc__ = 'Mk2 Module for Controlling Parameters with Master Knob'

    def __init__(self, parent):
        self._parent = parent
        self.master_track = parent.song().master_track
        self.the_slider = SliderElement(MIDI_CC_TYPE, 1, 86)
        self.the_slider.add_value_listener(self._do_main_slider, True)
        self.volume_button = None
        self._set_volume_button(StateButton(True, MIDI_CC_TYPE, 1, 80))
        self.xfade_button = None
        self._set_xfade_button(StateButton(True, MIDI_CC_TYPE, 1, 99))
        self.swing_button = None
        self._set_swing_button(StateButton(True, MIDI_CC_TYPE, 1, 81))
        self.mode = KN2_MODE_VOLUME
        self.previous_mode = -1
        self.tempo_button = None
        self._set_tempo_button(StateButton(True, MIDI_CC_TYPE, 1, 82))
        self.push_button = None
        self._set_push_button(StateButton(True, MIDI_CC_TYPE, 1, 87))
        self.clipn_v_button = None
        self.clipn_h_button = None
        self._set_clipn_h_button(StateButton(True, MIDI_CC_TYPE, 1, 90))
        self._set_clipn_v_button(StateButton(True, MIDI_CC_TYPE, 1, 91))
        self.toggle_buttons = [self.volume_button,
         self.xfade_button,
         self.swing_button,
         self.tempo_button,
         self.clipn_h_button,
         self.clipn_v_button]
        self.shift_button = None
        self._set_shift_button(StateButton(True, MIDI_CC_TYPE, 1, 85))
        self.shift_on = False
        self.scroll_mod_left_button = None
        self.scroll_mod_right_button = None
        self._set_scroll_mod_left_button(ButtonElement(True, MIDI_CC_TYPE, 0, 105))
        self._set_scroll_mod_right_button(ButtonElement(True, MIDI_CC_TYPE, 0, 106))
        self._prev_mode = KN2_MODE_VOLUME
        self.lrmode = LR_CONTROL_CLIP
        self.loop_div_index = 0
        self.loop_incdex = 4.0
        self.arrow_mode_button = ColorButton(True, MIDI_CC_TYPE, 30)
        self.arrow_mode_button.add_value_listener(self.toggle_arrow_mode)
        self.arrow_mode_button.send_value(1, True)
        self.navflags = 0
        self.octave_mod_button = ButtonElement(True, MIDI_CC_TYPE, 1, 70)
        self.octave_mod_button.add_value_listener(self._action_octave)
        self.scale_mod_button = ButtonElement(True, MIDI_CC_TYPE, 1, 71)
        self.scale_mod_button.add_value_listener(self._action_scale)
        self.basenote_mod_button = ButtonElement(True, MIDI_CC_TYPE, 1, 72)
        self.basenote_mod_button.add_value_listener(self._action_base_note)
        self.pad_to_mainknob_mode = 0
        self.octave_dwn_button = ButtonElement(True, MIDI_CC_TYPE, 3, 120)
        self.octave_upp_button = ButtonElement(True, MIDI_CC_TYPE, 3, 121)
        self.scale_dwn_button = ButtonElement(True, MIDI_CC_TYPE, 3, 118)
        self.scale_upp_button = ButtonElement(True, MIDI_CC_TYPE, 3, 119)
        self.basent_dwn_button = ButtonElement(True, MIDI_CC_TYPE, 3, 124)
        self.basent_upp_button = ButtonElement(True, MIDI_CC_TYPE, 3, 125)
        self.octave_dwn_button.add_value_listener(self._action_oct_down)
        self.octave_upp_button.add_value_listener(self._action_oct_up)
        self.scale_dwn_button.add_value_listener(self._action_scale_down)
        self.scale_upp_button.add_value_listener(self._action_scale_up)
        self.basent_dwn_button.add_value_listener(self._action_base_down)
        self.basent_upp_button.add_value_listener(self._action_base_up)
        self._measure_left_click = 0
        self._measure_right_click = 0
        self.mode_assign_map = {KN2_MODE_VOLUME: (self.chg_volume,
                           0,
                           'Master Knob controls MASTER Volume',
                           KN2_MODE_CUE),
         KN2_MODE_CUE: (self.chg_cue,
                        0,
                        'Master Knob controls Cue Level',
                        KN2_MODE_VOLUME),
         KN2_MODE_TEMPO_COARSE: (self.chg_tempo,
                                 3,
                                 'Master Knob controls TEMPO Coarse',
                                 KN2_MODE_TEMPO_FINE),
         KN2_MODE_TEMPO_FINE: (self.chg_tempo_fine,
                               3,
                               'Master Knob controls TEMPO Fine',
                               KN2_MODE_TEMPO_COARSE),
         KN2_MODE_XFADE: (self.chg_xfade,
                          1,
                          'Master Knob controls Crossfader',
                          -1),
         KN2_MODE_QUANT: (self.chg_quant,
                          2,
                          'Master Knob controls Recording Quantize',
                          KN2_MODE_CLIP_QUANT),
         KN2_MODE_CLIP_QUANT: (self.chg_clip_q,
                               2,
                               'Master Knob controls Clip Start Quantize',
                               KN2_MODE_QUANT),
         KN2_MODE_CLIPN_HOR: (self.nav_c_hor,
                              4,
                              'Master Knob Clip View horizontally',
                              -1),
         KN2_MODE_CLIPN_VER: (self.nav_c_ver,
#.........这里部分代码省略.........
开发者ID:AngeousaQ,项目名称:AbletonLive9_RemoteScripts,代码行数:103,代码来源:MainKnobControl.py

示例5: Novation_Impulse2

# 需要导入模块: from _Framework.SliderElement import SliderElement [as 别名]
# 或者: from _Framework.SliderElement.SliderElement import add_value_listener [as 别名]
class Novation_Impulse2(ControlSurface):
    """ Script for Novation's Impulse keyboards """

    def __init__(self, c_instance):
        ControlSurface.__init__(self, c_instance)
        self.c_instance = c_instance
        with self.component_guard():
            self.set_pad_translations(PAD_TRANSLATIONS)
            self._device_selection_follows_track_selection = True
            self._suggested_input_port = 'Impulse'
            self._suggested_output_port = 'Impulse'
            self._has_sliders = True
            self._current_midi_map = None
            self._display_reset_delay = -1
            self._string_to_display = None
            self.shift_pressed = False
            # special alternative buttons mode. for now only mixer buttons become record buttons. later we will add something more
            self.alternative_buttons_mode = False
            self._shift_button = ButtonElement(IS_MOMENTARY, MIDI_CC_TYPE, 0, 39)
            self._preview_button = ButtonElement(IS_MOMENTARY, MIDI_CC_TYPE, 0, 41)
            self._master_slider = SliderElement(MIDI_CC_TYPE, 0, 8)
            self._shift_button.name = 'Shift_Button'
            self._master_slider.name = 'Master_Volume_Control'
            self._master_slider.add_value_listener(self._slider_value, identify_sender=True)
            self._preview_button.add_value_listener(self._preview_value)
            self._setup_mixer()
            self._setup_session()
            self._setup_transport()
            self._setup_device()
            self._setup_name_display()
            device_button = ButtonElement(not IS_MOMENTARY, MIDI_CC_TYPE, 1, 10)
            mixer_button = ButtonElement(not IS_MOMENTARY, MIDI_CC_TYPE, 1, 9)
            device_button.name = 'Encoder_Device_Mode'
            mixer_button.name = 'Encoder_Mixer_Mode'
            self._encoder_modes = EncoderModeSelector(self._device_component, self._mixer, self._next_bank_button, self._prev_bank_button, self._encoders)
            self._encoder_modes.set_device_mixer_buttons(device_button, mixer_button)
            self._shift_button.add_value_listener(self._shift_button_handler)

            for component in self.components:
                component.set_enabled(False)

    # attributes
    def alternative_buttons_mode(self):
        return self.alternative_buttons_mode

    def alternative_buttons_mode(self,value):
        self.log ('alternative_buttons_mode_value ' + str(value))
        self.alternative_buttons_mode = value

    def shift_pressed(self):
        return self.shift_pressed

    def shift_pressed(self,value):
        self.log ('shift_pressed value ' + str(value))
        self.shift_pressed = value

    def refresh_state(self):
        ControlSurface.refresh_state(self)
        self.schedule_message(3, self._send_midi, SYSEX_START + (6, 1, 1, 1, 247))

    def handle_sysex(self, midi_bytes):
        if midi_bytes[0:-2] == SYSEX_START + (7,) and midi_bytes[-2] != 0:
            self._has_sliders = midi_bytes[-2] != 25
            self.schedule_message(1, self._show_startup_message)
            for control in self.controls:
                if isinstance(control, InputControlElement):
                    control.clear_send_cache()

            for component in self.components:
                component.set_enabled(True)

            if self._has_sliders:
                self._mixer.master_strip().set_volume_control(self._master_slider)
                self._mixer.update()
            else:
                self._mixer.master_strip().set_volume_control(None)
                self._mixer.selected_strip().set_volume_control(self._master_slider)
                for index in range(len(self._sliders)):
                    self._mixer.channel_strip(index).set_volume_control(None)
                    slider = self._sliders[index]
                    slider.release_parameter()
                    if slider.value_has_listener(self._slider_value):
                        slider.remove_value_listener(self._slider_value)

            self._encoder_modes.set_provide_volume_mode(not self._has_sliders)
            self.request_rebuild_midi_map()

    def disconnect(self):
        self.log('starting disconnect 1')
        self._name_display_data_source.set_display_string('  ')
        for encoder in self._encoders:
            encoder.remove_value_listener(self._encoder_value)

        self._master_slider.remove_value_listener(self._slider_value)
        if self._has_sliders:
            for slider in tuple(self._sliders):
                slider.remove_value_listener(self._slider_value)

        for button in self._strip_buttons:
            button.remove_value_listener(self._mixer_button_value)
#.........这里部分代码省略.........
开发者ID:maratbakirov,项目名称:AbletonLive9_RemoteScripts,代码行数:103,代码来源:Novation_Impulse2.py


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