當前位置: 首頁>>代碼示例>>Python>>正文


Python LC2Sysex.set_midi_callback方法代碼示例

本文整理匯總了Python中LC2Sysex.LC2Sysex.set_midi_callback方法的典型用法代碼示例。如果您正苦於以下問題:Python LC2Sysex.set_midi_callback方法的具體用法?Python LC2Sysex.set_midi_callback怎麽用?Python LC2Sysex.set_midi_callback使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在LC2Sysex.LC2Sysex的用法示例。


在下文中一共展示了LC2Sysex.set_midi_callback方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: do_setup

# 需要導入模塊: from LC2Sysex import LC2Sysex [as 別名]
# 或者: from LC2Sysex.LC2Sysex import set_midi_callback [as 別名]
    def do_setup(self):
        if LC2Sysex.l9():
            self._set_suppress_rebuild_requests(True)
        else:
            self.set_suppress_rebuild_requests(True)
        self._suppress_session_highlight = True
        self._suppress_send_midi = True
        LC2Sysex.set_midi_callback(self._send_midi)
        LC2SessionBank.set_song(self.song)
        LC2SessionBank.set_timer_callback(self.schedule_message)
        self._session = LC2SessionComponent(8, 12)
        self._mixer = LC2MixerComponent(8)
        self._session.set_mixer(self._mixer)
        if LC2Sysex.l9():
            self.set_highlighting_session_component(self._session)
        bank_buttons = [ ButtonElement(False, MIDI_NOTE_TYPE, 0, 40 + i) for i in range(4) ]
        self._session.set_scene_bank_buttons(bank_buttons[0], bank_buttons[1])
        self._session.set_track_bank_buttons(bank_buttons[2], bank_buttons[3])
        mixer_controls = [ SliderElement(MIDI_CC_TYPE, 0, i) for i in range(24) ]
        mixer_d_controls = [ LC2ParameterElement(MIDI_CC_TYPE, 0, i + 64) for i in range(32) ]
        toggle_controls = [ ButtonElement(True, MIDI_NOTE_TYPE, 0, i + 1) for i in range(24) ]
        cf = [ ButtonElement(True, MIDI_NOTE_TYPE, 0, i + 30) for i in range(8) ]
        mt = [ ButtonElement(True, MIDI_NOTE_TYPE, 0, i + 50) for i in range(8) ]
        self._mixer.master_strip().set_volume_control(SliderElement(MIDI_CC_TYPE, 0, 33))
        self._mixer.master_strip().set_pan_control(SliderElement(MIDI_CC_TYPE, 0, 34))
        self._mixer.set_prehear_volume_control(SliderElement(MIDI_CC_TYPE, 0, 35))
        self._mixer.set_crossfader_control(SliderElement(MIDI_CC_TYPE, 0, 40))
        for i in range(8):
            idx = i * 3
            ch = self._mixer.channel_strip(i)
            ch.set_invert_mute_feedback(True)
            ch.set_mute_button(toggle_controls[idx])
            ch.set_solo_button(toggle_controls[idx + 1])
            ch.set_arm_button(toggle_controls[idx + 2])
            ch.set_volume_control(mixer_controls[idx])
            ch.set_pan_control(mixer_controls[idx + 1])
            ch.set_send_control(mixer_controls[idx + 2])
            ch.set_crossfade_toggle(cf[i])
            ch.set_monitor_toggle(mt[i])
            ch.set_device_controls(tuple(mixer_d_controls[i * 4:i * 4 + 4]))

        self._modulator = LC2Modulator()
        self.set_device_component(self._modulator)
        device_controls = [ LC2ParameterElement(MIDI_CC_TYPE, 1, i, True) for i in range(16) ]
        self._modulator.set_parameter_controls(tuple(device_controls))
        device_buttons = [ ButtonElement(False, MIDI_NOTE_TYPE, 1, i) for i in range(4) ]
        self._modulator.set_on_off_button(device_buttons[0])
        self._modulator.set_lock_button(device_buttons[1])
        self._modulator.set_bank_nav_buttons(device_buttons[2], device_buttons[3])
        self._sequencer = LC2Sequencer()
        self._session.set_sequencer(self._sequencer)
        self._transport = LC2TransportComponent()
        tbuttons = [ ButtonElement(True, MIDI_NOTE_TYPE, 0, 110 + i) for i in range(12) ]
        self._transport.set_stop_button(tbuttons[0])
        self._transport.set_play_button(tbuttons[1])
        self._transport.set_record_button(tbuttons[2])
        self._transport.set_overdub_button(tbuttons[3])
        self._transport.set_back_to_arranger_button(tbuttons[4])
        self._transport.set_follow_button(tbuttons[5])
        self._transport.set_metronome_button(tbuttons[6])
        self._transport.set_tap_tempo_button(tbuttons[7])
        self._transport.set_tempo_buttons(tbuttons[9], tbuttons[8])
        self._transport.set_launch_quant_button(SliderElement(MIDI_CC_TYPE, 0, 120))
        self._transport.set_record_quant_button(SliderElement(MIDI_CC_TYPE, 0, 121))
        self._last_time = ''
        if LC2Sysex.l9():

            def wrapper(delta):
                self._on_time_changed()
                return Task.RUNNING

            self._tasks.add(Task.FuncTask(wrapper, self._on_time_changed))
        else:
            self._register_timer_callback(self._on_time_changed)
        self.song().add_tempo_listener(self._on_tempo_changed)
        for component in self.components:
            component.set_enabled(False)

        if LC2Sysex.l9():
            self._set_suppress_rebuild_requests(False)
        else:
            self.set_suppress_rebuild_requests(False)
開發者ID:AkiSyndicat,項目名稱:AbletonLive9_RemoteScripts,代碼行數:84,代碼來源:LiveControl2.py


注:本文中的LC2Sysex.LC2Sysex.set_midi_callback方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。