本文整理汇总了Python中SpecialSessionComponent.SpecialSessionComponent.tracks_to_use方法的典型用法代码示例。如果您正苦于以下问题:Python SpecialSessionComponent.tracks_to_use方法的具体用法?Python SpecialSessionComponent.tracks_to_use怎么用?Python SpecialSessionComponent.tracks_to_use使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SpecialSessionComponent.SpecialSessionComponent
的用法示例。
在下文中一共展示了SpecialSessionComponent.tracks_to_use方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Launchkey
# 需要导入模块: from SpecialSessionComponent import SpecialSessionComponent [as 别名]
# 或者: from SpecialSessionComponent.SpecialSessionComponent import tracks_to_use [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())
示例2: LaunchControl
# 需要导入模块: from SpecialSessionComponent import SpecialSessionComponent [as 别名]
# 或者: from SpecialSessionComponent.SpecialSessionComponent import tracks_to_use [as 别名]
#.........这里部分代码省略.........
self._session.set_enabled(False)
self._session.set_mixer(self._session_mixer)
self._session_layer = Layer(track_bank_left_button=make_button(116, 'Track_Bank_Left_Button'), track_bank_right_button=make_button(117, 'Track_Bank_Right_Button'), select_prev_button=make_button(114, 'Scene_Bank_Up_Button'), select_next_button=make_button(115, 'Scene_Bank_Down_Button'), clip_launch_buttons=ButtonMatrixElement(rows=[clip_launch_buttons]))
scene = self._session.selected_scene()
for index in range(8):
clip_slot = scene.clip_slot(index)
clip_slot.set_triggered_to_play_value(Colors.GREEN_BLINK)
clip_slot.set_triggered_to_record_value(Colors.RED_BLINK)
clip_slot.set_stopped_value(Colors.AMBER_FULL)
clip_slot.set_started_value(Colors.GREEN_FULL)
clip_slot.set_recording_value(Colors.RED_FULL)
clip_slot.name = 'Selected_Clip_Slot_' + str(index)
self._on_track_offset.subject = self._session
def _init_device(self):
make_button = partial(make_launch_control_button, channel=10)
make_encoder = partial(make_launch_control_encoder, channel=10)
bottom_encoders, top_encoders = make_all_encoders('Device', make_encoder)
parameter_controls = top_encoders[:4] + bottom_encoders[:4]
bank_buttons = [ make_button(identifier, 'Device_Bank_Button_' + str(i), is_pad=True) for i, identifier in enumerate(pad_identifiers) ]
for button in bank_buttons:
button.set_on_off_values(Colors.LED_ON, Colors.LED_OFF)
self._device_bank_registry = DeviceBankRegistry()
self._device = DeviceComponent(device_bank_registry=self._device_bank_registry, name='Device')
self._device.set_enabled(False)
self._device.layer = Layer(parameter_controls=ButtonMatrixElement(rows=[parameter_controls]), bank_buttons=ButtonMatrixElement(rows=[bank_buttons]))
self.set_device_component(self._device)
self._device_navigation = DeviceNavigationComponent()
self._device_navigation.set_enabled(False)
self._device_navigation.name = 'Device_Navigation'
self._device_navigation.layer = Layer(next_device_button=make_button(115, 'Next_Device_Button'), previous_device_button=make_button(114, 'Prev_Device_Button'))
self._view_control = ViewControlComponent()
self._view_control.set_enabled(False)
self._view_control.name = 'View_Control'
self._view_control.layer = Layer(next_track_button=make_button(117, 'Device_Next_Track_Button'), prev_track_button=make_button(116, 'Device_Prev_Track_Button'))
def _init_modes(self):
self._modes = ModesComponent(is_root=True)
self._modes.add_mode('mixer', [partial(self._session.set_mixer, self._mixer),
LayerMode(self._session, self._mixer_track_nav_layer),
self._mixer,
self._session,
self._show_controlled_tracks_message])
self._modes.add_mode('session', [partial(self._session.set_mixer, self._session_mixer),
LayerMode(self._session, self._session_layer),
self._session_mixer,
self._session,
self._show_controlled_tracks_message])
self._modes.add_mode('device', [self._device, self._device_navigation, self._view_control])
self._modes.add_mode('user', None)
self._modes.selected_mode = 'mixer'
self._modes.layer = Layer(mixer_button=ButtonSysexControl(Sysex.MIXER_MODE), session_button=ButtonSysexControl(Sysex.SESSION_MODE), device_button=ButtonSysexControl(Sysex.DEVICE_MODE))
return
@subject_slot('offset')
def _on_track_offset(self):
self._show_controlled_tracks_message()
@subject_slot('selected_send_index')
def _on_selected_send_index(self, index):
self._show_controlled_sends_message()
@subject_slot('selected_mixer_mode')
def _on_selected_mixer_mode(self, mode):
if mode == 'sends':
self._show_controlled_sends_message()
else:
self.show_message('Controlling Pan and Volume')
def _show_controlled_tracks_message(self):
start = self._session.track_offset() + 1
end = min(start + 8, len(self._session.tracks_to_use()))
if start < end:
self.show_message('Controlling Track %d to %d' % (start, end))
else:
self.show_message('Controlling Track %d' % start)
def _show_controlled_sends_message(self):
send_index = self._mixer.selected_send_index
send_name1 = chr(ord('A') + send_index)
if send_index + 1 < self._mixer.num_sends:
send_name2 = chr(ord('A') + send_index + 1)
self.show_message('Controlling Send %s and %s' % (send_name1, send_name2))
else:
self.show_message('Controlling Send %s' % send_name1)
def handle_sysex(self, midi_bytes):
super(LaunchControl, self).handle_sysex(midi_bytes)
if self._is_user_mode_message(midi_bytes):
self._modes.selected_mode = 'user'
self.request_rebuild_midi_map()
def _is_user_mode_message(self, midi_bytes):
"""
True if midi_byes refer to a mode change, but none of the three
predefined Live modes
"""
return midi_bytes[:7] == Sysex.MODE_CHANGE_PREFIX and midi_bytes not in SYSEX_MODE_MAP