本文整理汇总了Python中_Framework.SliderElement.SliderElement.connect_to方法的典型用法代码示例。如果您正苦于以下问题:Python SliderElement.connect_to方法的具体用法?Python SliderElement.connect_to怎么用?Python SliderElement.connect_to使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类_Framework.SliderElement.SliderElement
的用法示例。
在下文中一共展示了SliderElement.connect_to方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: doStuff
# 需要导入模块: from _Framework.SliderElement import SliderElement [as 别名]
# 或者: from _Framework.SliderElement.SliderElement import connect_to [as 别名]
def doStuff(self,x):
try:
data, addr = self.sock.recvfrom(64) # buffer size is 1024 byte
addressPattern = data[:data.find("\0")]
#data = data.split(',i')
#v = struct.unpack('>i',data[1][2:(2+4)])[0]
data = data.split(',ii')
v = struct.unpack('>ii',data[1][1:])
track_number = v[0]
midi_cc = v[1]
b = SliderElement(1, 0, midi_cc)
song = self.song()
if (addressPattern == "/pan"):
b.connect_to(song.tracks[track_number].mixer_device.panning)
elif (addressPattern == "/volume"):
b.connect_to(song.tracks[track_number].mixer_device.volume)
self.show_message(addressPattern)
except socket.error:
pass
示例2: connect_to
# 需要导入模块: from _Framework.SliderElement import SliderElement [as 别名]
# 或者: from _Framework.SliderElement.SliderElement import connect_to [as 别名]
def connect_to(self, param):
if self._parameter_to_map_to is not None:
try:
self._parameter_to_map_to.remove_value_listener(self._on_value_changed)
except:
pass
SliderElement.connect_to(self, param)
if param is not None:
if not self._parameter_to_map_to.value_has_listener(self._on_value_changed):
self._parameter_to_map_to.add_value_listener(self._on_value_changed)
self._send_param_val(True)
示例3: MaschineMk2
# 需要导入模块: from _Framework.SliderElement import SliderElement [as 别名]
# 或者: from _Framework.SliderElement.SliderElement import connect_to [as 别名]
#.........这里部分代码省略.........
device.name = 'Device_Component'
self.set_device_component(device)
return device
def _setup_transport(self):
is_momentary = True
transport = TransportComponent()
playButton = StateButton(is_momentary, MIDI_CC_TYPE, 0, 108)
stopButton = StateButton(not is_momentary, MIDI_CC_TYPE, 0, 110)
recordButton = StateButton(is_momentary, MIDI_CC_TYPE, 0, 109)
overdubButton = StateButton(is_momentary, MIDI_CC_TYPE, 0, 107)
metrononmeButton = StateButton(is_momentary, MIDI_CC_TYPE, 0, 104)
playButton.name = 'Play'
stopButton.name = 'Stop'
recordButton.name = 'Record'
overdubButton.name = 'Overdub'
metrononmeButton.name = 'Metronome'
transport.set_play_button(playButton)
transport.set_stop_button(stopButton)
transport.set_record_button(recordButton)
transport.set_overdub_button(overdubButton)
transport.set_metronome_button(metrononmeButton)
transport.set_nudge_buttons(StateButton(is_momentary, MIDI_CC_TYPE, 1, 51), StateButton(is_momentary, MIDI_CC_TYPE, 1, 50))
punchinbutton = ToggleButton(MIDI_CC_TYPE, 1, 52)
punchoutbutton = ToggleButton(MIDI_CC_TYPE, 1, 53)
punchinbutton.name = 'Punch In'
punchoutbutton.name = 'Punch Out'
transport.set_punch_buttons(punchinbutton, punchoutbutton)
transport.set_loop_button(StateButton(is_momentary, MIDI_CC_TYPE, 1, 54))
self.transp_ff_button = ButtonElement(True, MIDI_CC_TYPE, 1, 59)
self.transp_rw_button = ButtonElement(True, MIDI_CC_TYPE, 1, 58)
transport.set_seek_buttons(self.transp_ff_button, self.transp_rw_button)
self.xfadeKnob = SliderElement(MIDI_CC_TYPE, 1, 100)
self.xfadeKnob.connect_to(self.song().master_track.mixer_device.crossfader)
self.tap_button = StateButton(is_momentary, MIDI_CC_TYPE, 0, 88)
self.tap_button.add_value_listener(self._do_tap_tempo)
self.cue_add_delete_button = StateButton(is_momentary, MIDI_CC_TYPE, 1, 55)
self.cue_prev_button = StateButton(is_momentary, MIDI_CC_TYPE, 1, 56)
self.cue_next_button = StateButton(is_momentary, MIDI_CC_TYPE, 1, 57)
self.cue_add_delete_button.add_value_listener(self._do_toggle_cue)
self.cue_prev_button.add_value_listener(self._do_toggle_prev_cue)
self.cue_next_button.add_value_listener(self._do_toggle_next_cue)
def _set_up_machine_knobs(self):
master_track = self.song().master_track
self.master_volume = SliderElement(MIDI_CC_TYPE, 0, 40)
self.prehear = SliderElement(MIDI_CC_TYPE, 0, 41)
self.master_volume.connect_to(master_track.mixer_device.volume)
self.prehear.connect_to(master_track.mixer_device.cue_volume)
def _set_up_session(self):
is_momentary = True
self._session = MaschineSessionComponent()
self._session.add_offset_listener(self.notify_track_scroll)
nhue = COLOR_HUE_NAV
self.nav_buttons = (GatedColorButton(True, MIDI_CC_TYPE, 92, nhue),
GatedColorButton(True, MIDI_CC_TYPE, 81, nhue),
GatedColorButton(True, MIDI_CC_TYPE, 93, nhue),
GatedColorButton(True, MIDI_CC_TYPE, 91, nhue))
self._session.set_scene_bank_buttons(self.nav_buttons[0], self.nav_buttons[1])
self._session.set_track_bank_buttons(self.nav_buttons[2], self.nav_buttons[3])
self._session.set_stop_all_clips_button(StateButton(is_momentary, MIDI_CC_TYPE, 0, 111))
track_stop_buttons = [ StateButton(is_momentary, MIDI_CC_TYPE, BASIC_CHANNEL, index + STOP_CC_OFF) for index in range(4) ]
self._session.set_stop_track_clip_buttons(tuple(track_stop_buttons))
self._init_matrix()
self._set_up_buttons()
示例4: Maschine
# 需要导入模块: from _Framework.SliderElement import SliderElement [as 别名]
# 或者: from _Framework.SliderElement.SliderElement import connect_to [as 别名]
#.........这里部分代码省略.........
transport = TransportComponent()
studiotransport = MaschineTransport()
playButton = StateButton(is_momentary, MIDI_CC_TYPE, 0, 108)
stopButton = StateButton(not is_momentary, MIDI_CC_TYPE, 0, 110)
recordButton = StateButton(is_momentary, MIDI_CC_TYPE, 0, 109)
overdubButton = StateButton(is_momentary, MIDI_CC_TYPE, 0, 107)
metrononmeButton = StateButton(is_momentary, MIDI_CC_TYPE, 0, 104)
eventRecButton = StateButton(is_momentary, MIDI_CC_TYPE, 0, 98)
playButton.name = 'Play'
stopButton.name = 'Stop'
recordButton.name = 'Record'
overdubButton.name = 'Overdub'
metrononmeButton.name = 'Metronome'
transport.set_play_button(playButton)
transport.set_stop_button(stopButton)
transport.set_record_button(recordButton)
transport.set_overdub_button(overdubButton)
transport.set_metronome_button(metrononmeButton)
studiotransport.set_session_auto_button(eventRecButton)
studiotransport.set_arrangement_overdub_button(StateButton(is_momentary, MIDI_CC_TYPE, 0, 106))
studiotransport.set_back_arrange_button(StateButton(is_momentary, MIDI_CC_TYPE, 0, 105))
transport.set_nudge_buttons(StateButton(is_momentary, MIDI_CC_TYPE, 1, 51), StateButton(is_momentary, MIDI_CC_TYPE, 1, 50))
punchinbutton = ToggleButton(MIDI_CC_TYPE, 1, 52)
punchoutbutton = ToggleButton(MIDI_CC_TYPE, 1, 53)
punchinbutton.name = 'Punch In'
punchoutbutton.name = 'Punch Out'
transport.set_punch_buttons(punchinbutton, punchoutbutton)
transport.set_loop_button(StateButton(is_momentary, MIDI_CC_TYPE, 1, 54))
self.song_follow_button = ButtonElement(True, MIDI_CC_TYPE, 2, 98)
self._do_song_follow.subject = self.song_follow_button
self._song_follow_changed.subject = self.song().view
self._song_follow_changed()
self.prehear_knob = SliderElement(MIDI_CC_TYPE, 0, 41)
self.prehear_knob.connect_to(self.song().master_track.mixer_device.cue_volume)
self.transp_ff_button = ButtonElement(True, MIDI_CC_TYPE, 1, 59)
self.transp_rw_button = ButtonElement(True, MIDI_CC_TYPE, 1, 58)
transport.set_seek_buttons(self.transp_ff_button, self.transp_rw_button)
self.xfadeKnob = SliderElement(MIDI_CC_TYPE, 1, 105)
self.xfadeKnob.connect_to(self.song().master_track.mixer_device.crossfader)
self.master_knob = SliderElement(MIDI_CC_TYPE, 0, 99)
self.master_knob.connect_to(self.song().master_track.mixer_device.volume)
self.tap_button = StateButton(is_momentary, MIDI_CC_TYPE, 0, 88)
self._do_tap_tempo.subject = self.tap_button
self.cue_add_delete_button = StateButton(is_momentary, MIDI_CC_TYPE, 1, 55)
self.cue_prev_button = StateButton(is_momentary, MIDI_CC_TYPE, 1, 56)
self.cue_next_button = StateButton(is_momentary, MIDI_CC_TYPE, 1, 57)
self._do_toggle_cue.subject = self.cue_add_delete_button
self._do_toggle_prev_cue.subject = self.cue_prev_button
self._do_toggle_next_cue.subject = self.cue_next_button
def set_up_function_buttons(self):
is_momentary = True
self.keycolor_mod_button = StateButton(is_momentary, MIDI_CC_TYPE, 1, 73)
self._do_key_color.subject = self.keycolor_mod_button
self._update_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 0, 86)
self._do_update_display.subject = self._update_button
@subject_slot('appointed_device')
def _on_appointed_device_changed(self):
self._modeselect._device_changed()
def _update_hardware(self):
self._session.update()
self._modeselect.refresh()
self.update_undo_redo(True)