本文整理汇总了Python中SpecialSessionComponent.SpecialSessionComponent.set_offsets方法的典型用法代码示例。如果您正苦于以下问题:Python SpecialSessionComponent.set_offsets方法的具体用法?Python SpecialSessionComponent.set_offsets怎么用?Python SpecialSessionComponent.set_offsets使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SpecialSessionComponent.SpecialSessionComponent
的用法示例。
在下文中一共展示了SpecialSessionComponent.set_offsets方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MainSelectorComponent
# 需要导入模块: from SpecialSessionComponent import SpecialSessionComponent [as 别名]
# 或者: from SpecialSessionComponent.SpecialSessionComponent import set_offsets [as 别名]
#.........这里部分代码省略.........
scene.name = 'Scene_' + str(scene_index)
for track_index in range(8):
"TODO: this still doesn't light the launch clip buttons when supposed to..."
clip_slot = scene.clip_slot(track_index)
clip_slot.set_triggered_to_play_value(127)
clip_slot.set_triggered_to_record_value(127)
clip_slot.set_stopped_value(0)
clip_slot.set_started_value(127)
clip_slot.set_recording_value(127)
clip_slot.name = str(track_index) + '_Clip_Slot_' + str(scene_index)
def _mode_value(self, value, sender):
"method called each time the value of the mode selection changed"
"it's been momentary overriden to avoid dysfunctionnement in the framework method"
new_mode = self._modes_buttons.index(sender)
if sender.is_momentary():
#self._parent.log_message(sender.message_identifier())
if value > 0:
#self._parent.log_message("value = "+str(value))
mode_observer = MomentaryModeObserver()
mode_observer.set_mode_details(new_mode, self._controls_for_mode(new_mode), self._get_public_mode_index)
self._modes_heap.append((new_mode, sender, mode_observer))
self._update_mode()
elif self._modes_heap[-1][1] == sender and not self._modes_heap[-1][2].is_mode_momentary():
#self._parent.log_message("sender trouve")
self.set_mode(new_mode)
else:
#TODO: comprendre comment le framework est sense fonctionner et remplacer supprimer cet modif du framework
self.set_mode(new_mode)
self._update_mode()
else:
#self._parent.log_message("boutton pas trouve")
self.set_mode(new_mode)
def _setup_step_sequencer(self, as_active):
if(self._stepseq!=None):
if as_active:
self._stepseq._force_update = True
self._stepseq._is_active = True
self._stepseq.set_enabled(True)
self._stepseq._on_notes_changed()
self._stepseq._update_seq_buttons()
else:
self._stepseq._is_active = False
self._stepseq.set_enabled(False)
def _set_browser_control(self, as_active):
self._browser_control.remove_value_listener(self._browser_control_value)
if as_active:
self._browser_control.add_value_listener(self._browser_control_value)
def _browser_control_value(self, value):
if value != 64:
all_scenes = self.song().scenes
selected_scene = self.song().view.selected_scene
selected_scene_index = list(all_scenes).index(selected_scene)
new_selected_scene_index = max(0, min(selected_scene_index + (value-64), len(list(all_scenes))-1) )
self.song().view.selected_scene = all_scenes[new_selected_scene_index]
session_offset = self._session.scene_offset()
if new_selected_scene_index > session_offset + 15:
self._session.set_offsets(self._session.track_offset(), new_selected_scene_index - 15)
if new_selected_scene_index < session_offset:
self._session.set_offsets(self._session.track_offset(), new_selected_scene_index)
def _set_browser_button(self, as_active):
self._browser_button.remove_value_listener(self._browser_button_value)
if as_active:
self._browser_button.add_value_listener(self._browser_button_value)
def _browser_button_value(self, value):
if value != 0:
if self._mode_index == 2:
self.song().view.highlighted_clip_slot.fire()
else:
self.song().view.selected_scene.fire_as_selected()
def _set_scale_control(self, as_active):
self._divide_control.remove_value_listener(self._translation_selector._scale_index_value)
self._move_control.remove_value_listener(self._translation_selector._scale_offset_value)
if as_active:
self._divide_control.add_value_listener(self._translation_selector._scale_index_value)
self._move_control.add_value_listener(self._translation_selector._scale_offset_value)
def _update_session_translation(self):
if self._mode_index == 0 or self._mode_index == 1:
if self._translation_selector.mode():
self._session.set_offsets(8,self._session.scene_offset())
else:
self._session.set_offsets(0,self._session.scene_offset())
def on_selected_track_changed(self):
all_tracks = ((self.song().tracks + self.song().return_tracks))
selected_track = self.song().view.selected_track
self._previous_track_index = self._selected_track_index
self._selected_track_index = list(all_tracks).index(selected_track)
self.update()
示例2: Launchkey
# 需要导入模块: from SpecialSessionComponent import SpecialSessionComponent [as 别名]
# 或者: from SpecialSessionComponent.SpecialSessionComponent import set_offsets [as 别名]
#.........这里部分代码省略.........
self._master_slider = None
self._current_midi_map = None
self._transport_view_modes = None
self._send_midi(LED_FLASHING_OFF)
self._send_midi(LIVE_MODE_OFF)
def build_midi_map(self, midi_map_handle):
self._current_midi_map = midi_map_handle
ControlSurface.build_midi_map(self, midi_map_handle)
def _setup_mixer(self):
self._next_nav_button = make_button(103, "Next_Track_Button")
self._prev_nav_button = make_button(102, "Prev_Track_Button")
mute_solo_flip_button = make_button(59, "Master_Button")
self._mixer = SpecialMixerComponent(8)
self._mixer.name = "Mixer"
self._mixer.set_select_buttons(self._next_nav_button, self._prev_nav_button)
self._mixer.selected_strip().name = "Selected_Channel_Strip"
self._mixer.master_strip().name = "Master_Channel_Strip"
self._mixer.master_strip().set_volume_control(self._master_slider)
self._sliders = []
self._strip_buttons = []
for index in range(8):
strip = self._mixer.channel_strip(index)
strip.name = "Channel_Strip_" + str(index)
strip.set_invert_mute_feedback(True)
self._sliders.append(make_slider(41 + index, "Volume_Control_%d" % index))
strip.set_volume_control(self._sliders[-1])
self._strip_buttons.append(make_button(51 + index, "Mute_Button_%d" % index))
self._mixer.set_strip_mute_solo_buttons(tuple(self._strip_buttons), mute_solo_flip_button)
def _setup_session(self):
scene_launch_button = make_configurable_button(104, "Scene_Launch_Button")
scene_stop_button = make_configurable_button(120, "Scene_Stop_Button")
self._session = SpecialSessionComponent(8, 0)
self._session.name = "Session_Control"
self._session.selected_scene().name = "Selected_Scene"
self._session.selected_scene().set_launch_button(scene_launch_button)
self._session.selected_scene().set_triggered_value(GREEN_BLINK)
self._session.set_stop_all_clips_button(scene_stop_button)
scene_stop_button.set_on_off_values(AMBER_FULL, LED_OFF)
self._session.set_mixer(self._mixer)
self._session.set_track_banking_increment(8)
self._session.set_stop_track_clip_value(GREEN_BLINK)
clip_launch_buttons = []
clip_stop_buttons = []
for index in range(8):
clip_launch_buttons.append(make_configurable_button(96 + index, "Clip_Launch_%d" % index))
clip_stop_buttons.append(make_configurable_button(112 + index, "Clip_Stop_%d" % index))
clip_slot = self._session.selected_scene().clip_slot(index)
clip_slot.set_triggered_to_play_value(GREEN_BLINK)
clip_slot.set_triggered_to_record_value(RED_BLINK)
clip_slot.set_stopped_value(AMBER_FULL)
clip_slot.set_started_value(GREEN_FULL)
clip_slot.set_recording_value(RED_FULL)
clip_slot.set_launch_button(clip_launch_buttons[-1])
clip_slot.name = "Selected_Clip_Slot_" + str(index)
self._session.set_stop_track_clip_buttons(tuple(clip_stop_buttons))
def _setup_transport(self):
rwd_button = make_button(112, "Rwd_Button")
ffwd_button = make_button(113, "FFwd_Button")
stop_button = make_button(114, "Stop_Button")
play_button = make_button(115, "Play_Button")
loop_button = make_button(116, "Loop_Button")
rec_button = make_button(117, "Record_Button")
transport = TransportComponent()
transport.name = "Transport"
transport.set_stop_button(stop_button)
transport.set_play_button(play_button)
transport.set_record_button(rec_button)
transport.set_loop_button(loop_button)
self._transport_view_modes = TransportViewModeSelector(transport, self._session, ffwd_button, rwd_button)
self._transport_view_modes.name = "Transport_View_Modes"
def _setup_device(self):
encoders = [make_encoder(21 + index, "Device_Control_%d" % index) for index in xrange(8)]
self._encoders = tuple(encoders)
device = DeviceComponent()
device.name = "Device_Component"
self.set_device_component(device)
device.set_parameter_controls(self._encoders)
def _dummy_listener(self, value):
pass
def _on_selected_track_changed(self):
ControlSurface._on_selected_track_changed(self)
self._update_mixer_offset()
def _update_mixer_offset(self):
all_tracks = self._session.tracks_to_use()
selected_track = self.song().view.selected_track
num_strips = self._session.width()
if selected_track in all_tracks:
track_index = list(all_tracks).index(selected_track)
new_offset = track_index - track_index % num_strips
self._session.set_offsets(new_offset, self._session.scene_offset())
示例3: QuNeo
# 需要导入模块: from SpecialSessionComponent import SpecialSessionComponent [as 别名]
# 或者: from SpecialSessionComponent.SpecialSessionComponent import set_offsets [as 别名]
#.........这里部分代码省略.........
return None
def assign_encoder(self, channel, value):
if value != -1:
return EncoderElement(MIDI_CC_TYPE, channel, value, Live.MidiMap.MapMode.relative_two_compliment)
else:
return None
def _reassign_mixer_control(self, shift_value):
if shift_value == 1:
for index in range(2):
self.sends.append(self.slider(SLIDER_CHANNEL, SELECTED_SENDS[index]))
self.volume_control = self.slider(SLIDER_CHANNEL, SELECTED_VOL)
self.pan_control = self.slider(SLIDER_CHANNEL, SELECTED_PAN)
if self.sends != None:
self.mixer.selected_strip().set_send_controls(tuple(self.sends))
else:
self.mixer.selected_strip().set_send_controls(tuple(None))
if self.volume_control != None:
self.mixer.selected_strip().set_volume_control(self.volume_control)
else:
self.mixer.selected_strip().set_volume_control(None)
if self.pan_control != None:
self.mixer.selected_strip().set_pan_control(self.pan_control)
else:
self.mixer.selected_strip().set_pan_control(None)
def _update_session(self):
if self.shift_buttons != None:
self.set_shift_buttons(self.shift_buttons)
else:
self.set_shift_buttons(None)
for index in range(7):
if self.arm_buttons != None:
self.mixer.channel_strip(index).set_arm_button(self.arm_buttons[index])
else:
self.mixer.channel_strip(index).set_arm_button(None)
if self.solo_buttons != None:
self.mixer.channel_strip(index).set_solo_button(self.solo_buttons[index])
else:
self.mixer.channel_strip(index).set_solo_button(None)
if self.mute_buttons != None:
self.mixer.channel_strip(index).set_invert_mute_feedback(True)
self.mixer.channel_strip(index).set_mute_button(self.mute_buttons[index])
else:
self.mixer.channel_strip(index).set_mute_button(None)
def _setup_transport_control(self):
self.transport = SpecialTransportComponent()
self.transport.set_metronome_button(self.led_button(PAD_CHANNEL, METRONOME, 127))
self.transport.set_play_button(self.led_button(PAD_CHANNEL, PLAY, 127))
self.transport.set_stop_button(self.led_button(PAD_CHANNEL, STOP, 127))
self.transport.set_record_button(self.led_button(PAD_CHANNEL, REC, 127))
self.transport.set_overdub_button(self.led_button(PAD_CHANNEL, OVERDUB, 127))
self.transport.set_tempo_buttons(self.led_button(PAD_CHANNEL, TEMPO_UP, 127), self.led_button(PAD_CHANNEL, TEMPO_DOWN, 127))
def _setup_mixer_control(self):
self.mixer = SpecialMixerComponent(self.num_tracks, self)
self.mixer.name = 'Mixer'
self.mixer.set_track_offset(0)
self.mixer.set_select_buttons(self.button(PAD_CHANNEL, TRACK_RIGHT), self.button(PAD_CHANNEL, TRACK_LEFT))
self.mixer.set_crossfader_control(self.slider(SLIDER_CHANNEL, CROSSFADER))
for index in range(4):
self.mixer.channel_strip(index).set_volume_control(self.slider(SLIDER_CHANNEL, TRACK_VOL[index]))
self.num_o_tracks = self.song().visible_tracks
if self.num_o_tracks != None:
index_count = -1
index_table = []
for index in self.song().visible_tracks:
index_count += 1
if index.has_midi_output != True:
index_table.append(index_count)
else:
None
if index_table != None:
for index in range(len(index_table)):
x = index_table[index]
if x > 3:
None
else:
None
def _setup_session_control(self):
self.session = SpecialSessionComponent(self.num_tracks, self.num_scenes, self)
self.session.set_offsets(0, 0)
self.session.set_select_buttons(self.button(PAD_CHANNEL, SCENE_DOWN), self.button(PAD_CHANNEL, SCENE_UP))
self.session.set_clip_loop_start(self.slider(SLIDER_CHANNEL, 6))
self.session.set_clip_loop_length(self.slider(SLIDER_CHANNEL, 7))
def _on_selected_scene_changed(self):
ControlSurface._on_selected_scene_changed(self)
def _on_selected_track_changed(self):
ControlSurface._on_selected_track_changed(self)
def _activate_combination_mode(self, track_offset, support_devices):
self._session.link_with_track_offset(track_offset)