本文整理汇总了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)