本文整理汇总了Python中SpecialSessionComponent.SpecialSessionComponent.scene方法的典型用法代码示例。如果您正苦于以下问题:Python SpecialSessionComponent.scene方法的具体用法?Python SpecialSessionComponent.scene怎么用?Python SpecialSessionComponent.scene使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SpecialSessionComponent.SpecialSessionComponent
的用法示例。
在下文中一共展示了SpecialSessionComponent.scene方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MainSelectorComponent
# 需要导入模块: from SpecialSessionComponent import SpecialSessionComponent [as 别名]
# 或者: from SpecialSessionComponent.SpecialSessionComponent import scene [as 别名]
#.........这里部分代码省略.........
elif mode == "device":
self._setup_session(not as_active, not as_enabled)
self._setup_step_sequencer(not as_active)
self._setup_step_sequencer2(not as_active)
self._setup_mixer(not as_active)
self._setup_instrument_controller(not as_active)
self._setup_device_controller(as_active)
self._update_control_channels()
self._mode_index = 5
elif mode == "user 2":
self._setup_session(not as_active, not as_enabled)
self._setup_instrument_controller(not as_active)
self._setup_device_controller(not as_active)
self._setup_mixer(not as_active)
self._setup_step_sequencer(not as_active)
self._setup_step_sequencer2(not as_active)
self._setup_user_mode(False, False, False, False)
self._update_control_channels()
self._mode_index = 2
self._osd.clear()
self._osd.mode = "User 2"
self._osd.update()
def _setup_session(self, as_active, as_enabled):
assert isinstance(as_active, type(False))
for button in self._nav_buttons:
if as_enabled:
button.set_on_off_values(self._skin.GREEN_FULL, self._skin.GREEN_THIRD)
else:
button.set_on_off_values(127, self._skin.off)
# matrix
self._activate_matrix(True)
for scene_index in range(self._session._num_scenes):
scene = self._session.scene(scene_index)
if as_active:
scene_button = self._side_buttons[scene_index]
scene_button.set_enabled(as_active)
scene_button.set_on_off_values(127, self._skin.off)
scene.set_launch_button(scene_button)
else:
scene.set_launch_button(None)
for track_index in range(self._session._num_tracks):
if as_active:
button = self._matrix.get_button(track_index, scene_index)
button.set_on_off_values(127, self._skin.off)
button.set_enabled(as_active)
scene.clip_slot(track_index).set_launch_button(button)
else:
scene.clip_slot(track_index).set_launch_button(None)
if as_active:
if self._session._stop_clip_buttons != None:
for button in self._session._stop_clip_buttons:
button.set_enabled(as_active)
button.set_on_off_values(self._skin.session.track_stop, self._skin.off)
self._session.set_stop_track_clip_buttons(self._session._stop_clip_buttons)
self._side_buttons[self._session._num_scenes].set_enabled(as_active)
self._side_buttons[self._session._num_scenes].set_on_off_values(self._skin.session._stop_clip_buttons, self._skin.off)
self._session.set_stop_all_clips_button(self._side_buttons[self._session._num_scenes])
else:
self._session.set_stop_track_clip_buttons(None)
self._session.set_stop_all_clips_button(None)
else:
self._session.set_stop_track_clip_buttons(None)
示例2: MF3D_Color_Clip
# 需要导入模块: from SpecialSessionComponent import SpecialSessionComponent [as 别名]
# 或者: from SpecialSessionComponent.SpecialSessionComponent import scene [as 别名]
class MF3D_Color_Clip(ControlSurface):
__doc__ = " Script for Mad Zach's Weekly soundpacks "
_active_instances = []
def __init__(self, c_instance):
ControlSurface.__init__(self, c_instance)
self.log_message(time.strftime("%d.%m.%Y %H:%M:%S", time.localtime()) + "--------------= MIDI Fighter Mad Zach Soundpack log opened =--------------") # Writes message into Live's main log file. This is a ControlSurface method.
self.set_suppress_rebuild_requests(True)
self._session = None
self._session_zoom = None
self._last_tr_off = 0
self._last_sc_off = 1
self._setup_session_control()
self.set_suppress_rebuild_requests(False)
def disconnect(self):
self._session = None
self._session_zoom = None
self.log_message(time.strftime("%d.%m.%Y %H:%M:%S", time.localtime()) + "--------------= MIDI Fighter Mad Zach Soundpack log closed =--------------") # Writes message into Live's main log file. This is a ControlSurface method.
ControlSurface.disconnect(self)
def _setup_session_control(self):
is_momentary = True
self._device = DeviceComponent()
self._device.name = 'Device_Component'
self._session = SpecialSessionComponent(4, 4)
self._session.name = 'Session_Control'
self._session.set_track_bank_buttons(self._set_button(BUTTONCHANNEL+1, SESSIONRIGHT),self._set_button(BUTTONCHANNEL+1, SESSIONLEFT))
self._session.set_scene_bank_buttons(self._set_button(BUTTONCHANNEL+1, SESSIONDOWN),self._set_button(BUTTONCHANNEL+1, SESSIONUP))
self._session_zoom = SpecialZoomingComponent(self._session)
self._session_zoom.name = 'Session_Overview'
self._session_zoom.set_nav_buttons(self._set_button(BUTTONCHANNEL+1, ZOOMUP), self._set_button(BUTTONCHANNEL+1, ZOOMDOWN), self._set_button(BUTTONCHANNEL+1, ZOOMLEFT), self._set_button(BUTTONCHANNEL+1, ZOOMRIGHT))
tracks = self.getslots() #get clip slots to access clip colors
for scene_index in range(4):
scene_off=self._session._scene_offset
scene = self._session.scene(scene_index+scene_off)
scene.name = 'Scene_' + str(scene_index+scene_off)
button_row = []
for track_index in range(4):
button = self._set_button(BUTTONCHANNEL, CLIPNOTEMAP[scene_index][track_index], GREEN, OFF)
button_row.append(button)
clip_slot = scene.clip_slot(track_index)
clip_slot.name = str(track_index) + '_Clip_Slot_' + str(scene_index+scene_off)
clip_slot.set_launch_button(button)
c = tracks[track_index][scene_index+scene_off] #get clip for color
clip_slot.set_stopped_value(LOWYELLOW)
if c.clip != None:
cval=self._get_MF3D_color(self.int_to_rgb(c.clip.color))
self.log_message("Clip: tr: " + str(track_index) + " clip: " + str(scene_index+scene_off) + " has color: " + str(self.int_to_rgb(c.clip.color)) + " va " + str(cval))
clip_slot.set_stopped_value(cval)
## clip_slot.set_triggered_to_launch_value(1)
clip_slot.set_triggered_to_play_value(PLAYTRIG_COL)
clip_slot.set_started_value(TRIGD_COL)
clip_slot.set_triggered_to_record_value(RECTRIG_COL)
clip_slot.set_recording_value(RECD_COL)
def int_to_rgb(self,rgbint):
return (rgbint/256/256%256, rgbint/256%256,rgbint%256)
def getslots(self):
tracks = self.song().visible_tracks
clipSlots = []
for track in tracks:
clipSlots.append(track.clip_slots)
return clipSlots
def _set_button(self,_channel,_note,_on_color=118,_off_color=0):
_button=None;
if not _note is -1:
_button = ConfigurableButtonElement(True, MESSAGETYPE, _channel, _note,_on_color,_off_color)
return _button
def _set_colors(self, scene_dir):
tracks = self.getslots() #get clip slots to access clip colors
scene_off=self._session.scene_offset()
track_off=self._session.track_offset()
for scene_index in range(4):
sc=scene_index
scene = self._session.scene(sc)
self.log_message("scene offset + index " + str(scene_index))
scene.name = 'Scene_' + str(scene_index)
button_row = []
for track_index in range(4):
#button = self._set_button(BUTTONCHANNEL, CLIPNOTEMAP[scene_index][track_index], GREEN, OFF)
#button_row.append(button)
tr=track_index
clip_slot = scene.clip_slot(tr)
clip_slot.name = str(track_index) + '_Clip_Slot_' + str(scene_index)
#clip_slot.set_launch_button(button)
c = tracks[track_index][scene_index+scene_off+scene_dir] #get clip for color
clip_slot.set_stopped_value(LOWYELLOW)
if c.clip != None:
cval=self._get_MF3D_color(self.int_to_rgb(c.clip.color))
clip_slot.set_stopped_value(cval)
self.log_message("Clip: tr: " + str(track_index) + " clip: " + str(scene_index) + " has color: " + str(self.int_to_rgb(c.clip.color)) + " va " + str(cval))
def update_display(self):
ControlSurface.update_display(self)
#.........这里部分代码省略.........
示例3: MainSelectorComponent
# 需要导入模块: from SpecialSessionComponent import SpecialSessionComponent [as 别名]
# 或者: from SpecialSessionComponent.SpecialSessionComponent import scene [as 别名]
#.........这里部分代码省略.........
def channel_for_current_mode(self):
# trying to keep
if self._mode_index == 0:
return 0
elif self._mode_index == 1:
if self._sub_mode_index[self._mode_index] == 0:
new_channel = 4 # user 1
else:
new_channel = 1 # device ctrl
elif self._mode_index == 2:
if self._sub_mode_index[self._mode_index] == 0:
new_channel = 5 # user 2
else:
new_channel = 1 + self._sub_mode_index[self._mode_index] # step seq
elif self._mode_index == 3: # mixer modes
new_channel = 6 + self._sub_modes.mode()
# if (new_channel > 0):
# new_channel += 3
return new_channel
def update(self):
assert self._modes_buttons != None
if self.is_enabled():
# for index in range(len(self._modes_buttons)):
# self._modes_buttons[index].set_force_next_value()
# if index == self._mode_index:
# self._modes_buttons[index].turn_on()
# else:
# self._modes_buttons[index].turn_off()
self._update_mode_buttons()
# update matrix and side buttons
for scene_index in range(8):
# update scene button
self._side_buttons[scene_index].set_enabled(True)
for track_index in range(8):
# update matrix
self._matrix.get_button(track_index, scene_index).set_enabled(True)
for button in self._nav_buttons:
button.set_enabled(True)
as_active = True
as_enabled = True
self._session.set_allow_update(False)
self._zooming.set_allow_update(False)
self._config_button.send_value(40)
self._config_button.send_value(1)
release_buttons = self._mode_index == 1
if self._mode_index == 0:
# session
self._setup_mixer((not as_active))
self._setup_device_controller((not as_active))
self._setup_step_sequencer((not as_active), 0)
self._setup_device_controller((not as_active))
self._setup_session(as_active, as_enabled)
elif self._mode_index == 1:
# user mode + device controller
self._setup_mixer((not as_active))
if self._sub_mode_index[self._mode_index] == 0:
self._setup_step_sequencer((not as_active), 0)
self._setup_device_controller((not as_active))
self._setup_session((not as_active), (as_enabled))
self._setup_user1(True, True, True)
else:
self._setup_session(not as_active, not as_enabled)
示例4: MainSelectorComponent
# 需要导入模块: from SpecialSessionComponent import SpecialSessionComponent [as 别名]
# 或者: from SpecialSessionComponent.SpecialSessionComponent import scene [as 别名]
#.........这里部分代码省略.........
self._setup_mixer(not as_active)
if (self._sub_mode_index[self._mode_index]==0):
self._setup_step_sequencer(not as_active)
self._setup_user_mode(False, False, False, False)
else:
self._setup_step_sequencer(as_active, self._sub_mode_index[self._mode_index])
self._update_control_channels()
elif (self._mode_index == 3):
self._setup_device_controller(not as_active)
self._setup_step_sequencer(not as_active)
self._setup_instrument_controller(not as_active)
self._setup_session(not as_active, as_enabled)
self._setup_mixer(as_active)
self._update_control_channels()
else:
assert False
self._previous_mode_index=self._mode_index
self._session.set_allow_update(True)
self._zooming.set_allow_update(True)
def _setup_session(self, as_active, as_enabled):
assert isinstance(as_active, type(False))
for button in self._nav_buttons:
if as_enabled:
button.set_on_off_values(GREEN_FULL, GREEN_THIRD)
else:
button.set_on_off_values(127, LED_OFF)
#matrix
for scene_index in range(8):
scene = self._session.scene(scene_index)
if as_active:
self._activate_matrix(True)
scene_button = self._side_buttons[scene_index]
scene_button.set_on_off_values(127, LED_OFF)
scene.set_launch_button(scene_button)
else:
scene.set_launch_button(None)
for track_index in range(8):
if as_active:
button = self._matrix.get_button(track_index, scene_index)
button.set_on_off_values(127, LED_OFF)
scene.clip_slot(track_index).set_launch_button(button)
else:
scene.clip_slot(track_index).set_launch_button(None)
#zoom
if as_active:
self._zooming.set_zoom_button(self._modes_buttons[0])
self._zooming.set_button_matrix(self._matrix)
self._zooming.set_scene_bank_buttons(self._side_buttons)
self._zooming.set_nav_buttons(self._nav_buttons[0], self._nav_buttons[1], self._nav_buttons[2], self._nav_buttons[3])
self._zooming.update()
else:
self._zooming.set_zoom_button(None)
self._zooming.set_button_matrix(None)
self._zooming.set_scene_bank_buttons(None)
self._zooming.set_nav_buttons(None, None, None, None)
#nav buttons
if as_enabled:
self._session.set_track_bank_buttons(self._nav_buttons[3], self._nav_buttons[2])
示例5: Serato
# 需要导入模块: from SpecialSessionComponent import SpecialSessionComponent [as 别名]
# 或者: from SpecialSessionComponent.SpecialSessionComponent import scene [as 别名]
class Serato(ControlSurface):
def __init__(self, c_instance):
publish_in_cs_list = True
ControlSurface.__init__(self, c_instance, not publish_in_cs_list)
self._device_selection_follows_track_selection = True
with self.component_guard():
self._matrix = None
self._session = None
self._mixer = None
self._device = None
self._scene_launch_buttons = None
self._track_arm_buttons = None
self._track_solo_buttons = None
self._track_mute_buttons = None
self._track_stop_buttons = None
self._track_select_buttons = None
self._device_on_off_button = None
self._shift_button = None
self._serato_interface = PySCAClipControl()
self._serato_interface.PySCA_InitializeClipControl()
self._setup_session_control()
self._setup_mixer_control()
self._setup_device_control()
self._session.set_mixer(self._mixer)
self.set_highlighting_session_component(self._session)
return
def disconnect(self):
ControlSurface.disconnect(self)
self._serato_interface.PySCA_DeinitializeClipControl()
self._serato_interface = None
return
def connect_script_instances(self, instanciated_scripts):
""" Called by the Application as soon as all scripts are initialized.
You can connect yourself to other running scripts here, as we do it
connect the extension modules (MackieControlXTs).
"""
for control_surface in self._control_surfaces():
control_surface_session = control_surface.highlighting_session_component()
if control_surface_session:
self._session.sync_to(control_surface_session)
self._on_track_list_changed()
break
def build_midi_map(self, midi_map_handle):
pass
def update_display(self):
ControlSurface.update_display(self)
while self._serato_interface.PySCA_HasIncomingEvent():
new_event = self._serato_interface.PySCA_GetIncomingEvent()
if not self._handle_session_event(new_event):
if not self._handle_mixer_event(new_event):
if not self._handle_device_event(new_event):
print 'Unhandled Event: ' + str(new_event)
def _setup_session_control(self):
is_momentary = True
self._session = SpecialSessionComponent(NUM_TRACKS, NUM_SCENES)
self._session.set_serato_interface(self._serato_interface)
self._matrix = ButtonMatrixElement()
self._scene_launch_buttons = [ ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 0) for index in range(NUM_SCENES) ]
self._track_stop_buttons = [ ButtonElement(not is_momentary, MIDI_NOTE_TYPE, 0, 0) for index in range(NUM_TRACKS) ]
stop_all_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 0)
self._session.set_stop_all_clips_button(stop_all_button)
self._session.set_stop_track_clip_buttons(tuple(self._track_stop_buttons))
for scene_index in range(NUM_SCENES):
scene = self._session.scene(scene_index)
button_row = []
scene.set_launch_button(self._scene_launch_buttons[scene_index])
scene.set_index(scene_index)
scene.set_serato_interface(self._serato_interface)
for track_index in range(NUM_TRACKS):
button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 0)
button_row.append(button)
clip_slot = scene.clip_slot(track_index)
clip_slot.set_launch_button(button)
clip_slot.set_serato_interface(self._serato_interface)
self._matrix.add_row(tuple(button_row))
def _setup_mixer_control(self):
is_momentary = True
self._mixer = SpecialMixerComponent(NUM_TRACKS)
self._mixer.set_serato_interface(self._serato_interface)
self._mixer.master_strip().set_serato_interface(self._serato_interface)
self._track_arm_buttons = []
self._track_solo_buttons = []
self._track_mute_buttons = []
self._track_select_buttons = []
self._shift_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 0)
for track in range(NUM_TRACKS):
strip = self._mixer.channel_strip(track)
strip.set_serato_interface(self._serato_interface)
self._track_arm_buttons.append(ButtonElement(not is_momentary, MIDI_NOTE_TYPE, 0, 0))
self._track_solo_buttons.append(ButtonElement(not is_momentary, MIDI_NOTE_TYPE, 0, 0))
self._track_mute_buttons.append(ButtonElement(not is_momentary, MIDI_NOTE_TYPE, 0, 0))
self._track_select_buttons.append(ButtonElement(not is_momentary, MIDI_NOTE_TYPE, 0, 0))
#.........这里部分代码省略.........
示例6: MainSelectorComponent
# 需要导入模块: from SpecialSessionComponent import SpecialSessionComponent [as 别名]
# 或者: from SpecialSessionComponent.SpecialSessionComponent import scene [as 别名]
#.........这里部分代码省略.........
self._setup_session(not as_active, not as_enabled)
self._setup_step_sequencer(not as_active)
self._setup_step_sequencer2(not as_active)
self._setup_mixer(not as_active)
self._setup_instrument_controller(not as_active)
self._setup_device_controller(as_active)
self._update_control_channels()
self._mode_index = 5
elif mode == "user 2":
self._control_surface.show_message("USER 2 MODE" )
self._setup_session(not as_active, not as_enabled)
self._setup_instrument_controller(not as_active)
self._setup_device_controller(not as_active)
self._setup_mixer(not as_active)
self._setup_step_sequencer(not as_active)
self._setup_step_sequencer2(not as_active)
self._setup_user_mode(False, False, False, False)
self._update_control_channels()
self._mode_index = 2
self._osd.clear()
self._osd.mode = "User 2"
self._osd.update()
def _setup_session(self, as_active, as_navigation_enabled):
assert isinstance(as_active, type(False))#assert is boolean
for button in self._nav_buttons:
if as_navigation_enabled:
button.set_on_off_values("Mode.Session.On", "Mode.Session.Off")
else:
button.set_on_off_values("DefaultButton.Disabled", "DefaultButton.Disabled")
# matrix
self._activate_matrix(True)
for scene_index in range(self._session._num_scenes):#iterate over scenes
scene = self._session.scene(scene_index)
if as_active:#set scene launch buttons
scene_button = self._side_buttons[scene_index]
scene_button.set_enabled(as_active)
scene_button.set_on_off_values("DefaultButton.Disabled", "DefaultButton.Disabled")
scene.set_launch_button(scene_button)
else:
scene.set_launch_button(None)
for track_index in range(self._session._num_tracks):#iterate over tracks of a scene -> clip slots
if as_active:#set clip slot launch button
button = self._matrix.get_button(track_index, scene_index)
button.set_on_off_values("DefaultButton.Disabled", "DefaultButton.Disabled")
button.set_enabled(as_active)
scene.clip_slot(track_index).set_launch_button(button)
else:
scene.clip_slot(track_index).set_launch_button(None)
if as_active:#Set up stop clip buttons and stop all clips button
if self._session._stop_clip_buttons != None:
for button in self._session._stop_clip_buttons:
button.set_enabled(as_active)
# button.set_on_off_values("Session.StopClip", "DefaultButton.Disabled")
self._session.set_stop_track_clip_buttons(self._session._stop_clip_buttons)
self._side_buttons[self._session._num_scenes].set_enabled(as_active)
self._side_buttons[self._session._num_scenes].set_on_off_values("Session.StopClip", "DefaultButton.Disabled")
self._session.set_stop_all_clips_button(self._side_buttons[self._session._num_scenes])
else:
self._session.set_stop_track_clip_buttons(None)
self._session.set_stop_all_clips_button(None)
else:
示例7: MainSelectorComponent
# 需要导入模块: from SpecialSessionComponent import SpecialSessionComponent [as 别名]
# 或者: from SpecialSessionComponent.SpecialSessionComponent import scene [as 别名]
class MainSelectorComponent(ModeSelectorComponent):
""" Class that reassigns the button on the launchpad to different functions """
def __init__(self, matrix, top_buttons, side_buttons, config_button, script):
assert isinstance(matrix, ButtonMatrixElement)
assert matrix.width() == 8 and matrix.height() == 8
assert isinstance(top_buttons, tuple)
assert len(top_buttons) == 8
assert isinstance(side_buttons, tuple)
assert len(side_buttons) == 8
assert isinstance(config_button, ButtonElement)
ModeSelectorComponent.__init__(self)
self._script = script
self._session = SpecialSessionComponent(matrix.width(), matrix.height())
"""for scene in self._session._scenes:
for slot in scene._clip_slots:
slot._triggered_to_play_value = 24
slot._triggered_to_record_value = 27
slot._started_value = 7
slot._recording_value = 9
slot._stopped_value = 8"""
self._zooming = SessionZoomingComponent(self._session)
self._session.name = "Session_Control"
self._zooming.name = "Session_Overview"
"""self._zooming._stopped_value = 9
self._zooming._playing_value = 7
self._zooming._selected_value = 8"""
self._matrix = matrix
self._side_buttons = side_buttons
self._nav_buttons = top_buttons[:4]
self._config_button = config_button
self._zooming.set_empty_value(LED_OFF)
self._all_buttons = []
for button in self._side_buttons + self._nav_buttons:
self._all_buttons.append(button)
self._sub_modes = SubSelectorComponent(matrix, side_buttons, self._session)
self._sub_modes.name = "Mixer_Modes"
self._sub_modes.set_update_callback(self._update_control_channels)
self._init_session()
self._all_buttons = tuple(self._all_buttons)
self.set_modes_buttons(top_buttons[4:])
if START_IN_MOD is True:
self._set_protected_mode_index(4)
def disconnect(self):
for button in self._modes_buttons:
button.remove_value_listener(self._mode_value)
self._session = None
self._zooming = None
for button in self._all_buttons:
button.set_on_off_values(127, LED_OFF)
self._config_button.turn_off()
self._matrix = None
self._side_buttons = None
self._nav_buttons = None
self._config_button = None
ModeSelectorComponent.disconnect(self)
def session_component(self):
return self._session
def set_modes_buttons(self, buttons):
assert buttons == None or isinstance(buttons, tuple) or len(buttons) == self.number_of_modes()
identify_sender = True
for button in self._modes_buttons:
button.remove_value_listener(self._mode_value)
self._modes_buttons = []
if buttons != None:
for button in buttons:
assert isinstance(button, ButtonElement)
self._modes_buttons.append(button)
button.add_value_listener(self._mode_value, identify_sender)
self.set_mode(0)
def number_of_modes(self):
return 5
def on_enabled_changed(self):
self.update()
def set_mode(self, mode):
assert mode in range(self.number_of_modes())
if (self._mode_index != mode) or (mode == 3):
self._mode_index = mode
self.update()
def channel_for_current_mode(self):
new_channel = self._mode_index + self._sub_modes.mode()
if new_channel > 0:
new_channel += 3
return new_channel
def update(self):
assert self._modes_buttons != None
if self.is_enabled():
#.........这里部分代码省略.........
示例8: MainSelectorComponent
# 需要导入模块: from SpecialSessionComponent import SpecialSessionComponent [as 别名]
# 或者: from SpecialSessionComponent.SpecialSessionComponent import scene [as 别名]
class MainSelectorComponent(ModeSelectorComponent):
__module__ = __name__
__doc__ = ' Class that reassigns the button on the launchpad to different functions '
def __init__(self, matrix, top_buttons, side_buttons, config_button, script):
assert isinstance(matrix, ButtonMatrixElement)
assert ((matrix.width() == 8) and (matrix.height() == 8))
assert isinstance(top_buttons, tuple)
assert (len(top_buttons) == 8)
assert isinstance(side_buttons, tuple)
assert (len(side_buttons) == 8)
assert isinstance(config_button, ButtonElement)
ModeSelectorComponent.__init__(self)
self._script = script
self._session = SpecialSessionComponent(matrix.width(), matrix.height())
for scene in self._session._scenes:
for slot in scene._clip_slots:
slot._triggered_to_play_value = 24
slot._triggered_to_record_value = 27
slot._started_value = 7
slot._recording_value = 9
slot._stopped_value = 8
self._zooming = SessionZoomingComponent(self._session)
self._zooming._stopped_value = 9
self._zooming._playing_value = 7
self._zooming._selected_value = 8
self._matrix = matrix
self._side_buttons = side_buttons
self._nav_buttons = top_buttons[:4]
self._config_button = config_button
self._zooming.set_empty_value(LED_OFF)
self._all_buttons = []
for button in (self._side_buttons + self._nav_buttons):
self._all_buttons.append(button)
self._sub_modes = SubSelectorComponent(matrix, side_buttons, self._session)
self._sub_modes.set_update_callback(self._update_control_channels)
self._init_session()
self._all_buttons = tuple(self._all_buttons)
self.set_modes_buttons(top_buttons[4:])
def disconnect(self):
for button in self._modes_buttons:
button.remove_value_listener(self._mode_value)
self._session = None
self._zooming = None
for button in self._all_buttons:
button.set_on_off_values(127, LED_OFF)
self._config_button.turn_off()
self._matrix = None
self._side_buttons = None
self._nav_buttons = None
self._config_button = None
ModeSelectorComponent.disconnect(self)
def set_modes_buttons(self, buttons):
assert ((buttons == None) or (isinstance(buttons, tuple) or (len(buttons) == self.number_of_modes() + 1)))
identify_sender = True
for button in self._modes_buttons:
button.remove_value_listener(self._mode_value)
self._modes_buttons = []
if (buttons != None):
for button in buttons:
assert isinstance(button, ButtonElement)
self._modes_buttons.append(button)
button.add_value_listener(self._mode_value, identify_sender)
self.set_mode(0)
def _mode_value(self, value, sender):
assert (len(self._modes_buttons) > 0)
assert isinstance(value, int)
assert isinstance(sender, ButtonElement)
assert (self._modes_buttons.count(sender) == 1)
if self._script._host.is_enabled() != True:
if ((value is not 0) or (not sender.is_momentary())):
if ((self._modes_buttons[1]._last_received_value > 0) and (self._modes_buttons.index(sender) == 2)) or ((self._modes_buttons[2]._last_received_value > 0) and (self._modes_buttons.index(sender) == 1)):
if(self._script._host._active_client != None):
self.set_mode(4)
else:
self._script.show_message('Monomodular Script not inserted')
else:
self.set_mode(self._modes_buttons.index(sender))
else:
if self._modes_buttons.index(sender) == 3 and value > 0:
self.set_mode(0)
def number_of_modes(self):
return 5
#.........这里部分代码省略.........
示例9: MainSelectorComponent
# 需要导入模块: from SpecialSessionComponent import SpecialSessionComponent [as 别名]
# 或者: from SpecialSessionComponent.SpecialSessionComponent import scene [as 别名]
class MainSelectorComponent(ModeSelectorComponent):
""" Class that reassigns the button on the launchpad to different functions """
def __init__(self, matrix, top_buttons, side_buttons, config_button):
raise isinstance(matrix, ButtonMatrixElement) or AssertionError
raise matrix.width() == 8 and matrix.height() == 8 or AssertionError
raise isinstance(top_buttons, tuple) or AssertionError
raise len(top_buttons) == 8 or AssertionError
raise isinstance(side_buttons, tuple) or AssertionError
raise len(side_buttons) == 8 or AssertionError
raise isinstance(config_button, ButtonElement) or AssertionError
ModeSelectorComponent.__init__(self)
self._session = SpecialSessionComponent(matrix.width(), matrix.height())
self._zooming = DeprecatedSessionZoomingComponent(self._session)
self._session.name = 'Session_Control'
self._zooming.name = 'Session_Overview'
self._matrix = matrix
self._side_buttons = side_buttons
self._nav_buttons = top_buttons[:4]
self._config_button = config_button
self._zooming.set_empty_value(LED_OFF)
self._all_buttons = []
for button in self._side_buttons + self._nav_buttons:
self._all_buttons.append(button)
self._sub_modes = SubSelectorComponent(matrix, side_buttons, self._session)
self._sub_modes.name = 'Mixer_Modes'
self._sub_modes.set_update_callback(self._update_control_channels)
self._init_session()
self._all_buttons = tuple(self._all_buttons)
self.set_modes_buttons(top_buttons[4:])
def disconnect(self):
for button in self._modes_buttons:
button.remove_value_listener(self._mode_value)
self._session = None
self._zooming = None
for button in self._all_buttons:
button.set_on_off_values(127, LED_OFF)
self._config_button.turn_off()
self._matrix = None
self._side_buttons = None
self._nav_buttons = None
self._config_button = None
ModeSelectorComponent.disconnect(self)
return
def session_component(self):
return self._session
def set_modes_buttons(self, buttons):
raise buttons == None or isinstance(buttons, tuple) or len(buttons) == self.number_of_modes() or AssertionError
identify_sender = True
for button in self._modes_buttons:
button.remove_value_listener(self._mode_value)
self._modes_buttons = []
if buttons != None:
for button in buttons:
raise isinstance(button, ButtonElement) or AssertionError
self._modes_buttons.append(button)
button.add_value_listener(self._mode_value, identify_sender)
self.set_mode(0)
return
def number_of_modes(self):
return 4
def on_enabled_changed(self):
self.update()
def set_mode(self, mode):
if not mode in range(self.number_of_modes()):
raise AssertionError
self._mode_index = (self._mode_index != mode or mode == 3) and mode
self.update()
def channel_for_current_mode(self):
new_channel = self._mode_index + self._sub_modes.mode()
if new_channel > 0:
new_channel += 3
return new_channel
def update(self):
super(MainSelectorComponent, self).update()
if not self._modes_buttons != None:
raise AssertionError
if self.is_enabled():
for index in range(len(self._modes_buttons)):
self._modes_buttons[index].set_force_next_value()
if index == self._mode_index:
self._modes_buttons[index].turn_on()
else:
self._modes_buttons[index].turn_off()
for scene_index in range(8):
self._side_buttons[scene_index].set_enabled(True)
#.........这里部分代码省略.........
示例10: KontrolF1
# 需要导入模块: from SpecialSessionComponent import SpecialSessionComponent [as 别名]
# 或者: from SpecialSessionComponent.SpecialSessionComponent import scene [as 别名]
class KontrolF1(ControlSurface):
__module__ = __name__
__doc__ = " Script for Native Instruments Traktor Kontrol F1 Controller "
def __init__(self, c_instance):
ControlSurface.__init__(self, c_instance)
self.set_suppress_rebuild_requests(True)
self._suppress_send_midi = True
self._suppress_session_highlight = True
self._suggested_input_port = 'Traktor Kontrol F1'
self._suggested_output_port = 'Traktor Kontrol F1'
self._blink_state = False
self._matrix = ButtonMatrixElement()
for row in range(HEIGHT):
button_row = [ ConfigurableButtonElement(c_instance, True, MIDI_CC_TYPE, 2, ((row * HEIGHT) + column)) for column in range(WIDTH) ]
self._matrix.add_row(tuple(button_row))
self._nav_buttons = [ ConfigurableButtonElement(c_instance, True, MIDI_CC_TYPE, 0, NAV_ENCODER),
ConfigurableButtonElement(c_instance, True, MIDI_CC_TYPE, 0, TOGGLE_LEFT_DOWN) ]
self._scene_buttons = [ ConfigurableButtonElement(c_instance, True, MIDI_CC_TYPE, 0, SCENE_LAUNCH[index]) for index in range(HEIGHT) ]
self._stop_buttons = []
for index in range(WIDTH):
self._stop_buttons.append(ConfigurableButtonElement(c_instance, True, MIDI_CC_TYPE, 0, STOP_LAUNCH[index]))
self._session = SpecialSessionComponent(self._matrix.width(), self._matrix.height())
self._all_buttons = []
for button in (self._scene_buttons + self._nav_buttons + self._stop_buttons):
self._all_buttons.append(button)
for scene_index in range(self._matrix.height()):
for track_index in range(self._matrix.width()):
self._all_buttons.append(self._matrix.get_button(track_index, scene_index))
self._all_buttons = tuple(self._all_buttons)
self._suppress_session_highlight = False
self.set_suppress_rebuild_requests(False)
self._suppress_send_midi = False
self.set_enabled(True)
self.update()
self._set_session_highlight(0,0,WIDTH,HEIGHT,True)
def disconnect(self):
self._suppress_send_midi = True
self._session = None
for button in self._all_buttons:
button.set_on_off_values(127, 0)
self._matrix = None
self._stop_buttons = None
self._scene_buttons = None
self._nav_buttons = None
ControlSurface.disconnect(self)
self._suppress_send_midi = False
def update_display(self):
tracks = self.song().visible_tracks
number_tracks = len(tracks)
if self._blink_state:
self._blink_state = False
else:
self._blink_state = True
for track in range(WIDTH):
to = track + self._session._track_offset
if (to < number_tracks):
for y in range(HEIGHT):
ys = self._session._scene_offset+y
yx = (y*4)+track
slot = tracks[to].clip_slots[ys]
if (slot.controls_other_clips) or (slot.has_clip):
if slot.is_triggered:
if self._blink_state:
self._send_midi(tuple([178,yx,40]))
else:
self._send_midi(tuple([178,yx,127]))
def refresh_state(self):
ControlSurface.refresh_state(self)
def _send_midi(self, midi_bytes):
if (not self._suppress_send_midi):
ControlSurface._send_midi(self, midi_bytes)
def _update_hardware(self):
pass
def _send_challenge(self):
pass
#.........这里部分代码省略.........
示例11: FCB1020
# 需要导入模块: from SpecialSessionComponent import SpecialSessionComponent [as 别名]
# 或者: from SpecialSessionComponent.SpecialSessionComponent import scene [as 别名]
class FCB1020(ControlSurface):
__doc__ = " Script for FCB1010 in APC emulation mode "
_active_instances = []
def _combine_active_instances():
track_offset = 0
scene_offset = 0
for instance in FCB1020._active_instances:
instance._activate_combination_mode(track_offset, scene_offset)
track_offset += instance._session.width()
_combine_active_instances = staticmethod(_combine_active_instances)
def __init__(self, c_instance):
ControlSurface.__init__(self, c_instance)
#self.set_suppress_rebuild_requests(True)
with self.component_guard():
self._note_map = []
self._ctrl_map = []
self._load_MIDI_map()
self._session = None
self._session_zoom = None
self._mixer = None
self._setup_session_control()
self._setup_mixer_control()
self._session.set_mixer(self._mixer)
self._setup_device_and_transport_control()
self.set_highlighting_session_component(self._session)
#self.set_suppress_rebuild_requests(False)
self._pads = []
self._load_pad_translations()
self._do_combine()
def disconnect(self):
self._note_map = None
self._ctrl_map = None
self._pads = None
self._do_uncombine()
self._shift_button = None
self._session = None
self._session_zoom = None
self._mixer = None
ControlSurface.disconnect(self)
def _do_combine(self):
if self not in FCB1020._active_instances:
FCB1020._active_instances.append(self)
FCB1020._combine_active_instances()
def _do_uncombine(self):
if ((self in FCB1020._active_instances) and FCB1020._active_instances.remove(self)):
self._session.unlink()
FCB1020._combine_active_instances()
def _activate_combination_mode(self, track_offset, scene_offset):
if TRACK_OFFSET != -1:
track_offset = TRACK_OFFSET
if SCENE_OFFSET != -1:
scene_offset = SCENE_OFFSET
self._session.link_with_track_offset(track_offset, scene_offset)
def _setup_session_control(self):
is_momentary = True
self._session = SpecialSessionComponent(8, 5)
self._session.name = 'Session_Control'
self._session.set_track_bank_buttons(self._note_map[SESSIONRIGHT], self._note_map[SESSIONLEFT])
self._session.set_scene_bank_buttons(self._note_map[SESSIONDOWN], self._note_map[SESSIONUP])
self._session.set_select_buttons(self._note_map[SCENEDN], self._note_map[SCENEUP])
self._scene_launch_buttons = [self._note_map[SCENELAUNCH[index]] for index in range(5) ]
self._track_stop_buttons = [self._note_map[TRACKSTOP[index]] for index in range(8) ]
self._session.set_stop_all_clips_button(self._note_map[STOPALLCLIPS])
self._session.set_stop_track_clip_buttons(tuple(self._track_stop_buttons))
self._session.set_stop_track_clip_value(2)
self._session.selected_scene().name = 'Selected_Scene'
self._session.selected_scene().set_launch_button(self._note_map[SELSCENELAUNCH])
self._session.set_slot_launch_button(self._note_map[SELCLIPLAUNCH])
for scene_index in range(5):
scene = self._session.scene(scene_index)
scene.name = 'Scene_' + str(scene_index)
button_row = []
scene.set_launch_button(self._scene_launch_buttons[scene_index])
scene.set_triggered_value(2)
for track_index in range(8):
button = self._note_map[CLIPNOTEMAP[scene_index][track_index]]
button_row.append(button)
clip_slot = scene.clip_slot(track_index)
clip_slot.name = str(track_index) + '_Clip_Slot_' + str(scene_index)
clip_slot.set_launch_button(button)
self._session_zoom = SpecialZoomingComponent(self._session)
self._session_zoom.name = 'Session_Overview'
self._session_zoom.set_nav_buttons(self._note_map[ZOOMUP], self._note_map[ZOOMDOWN], self._note_map[ZOOMLEFT], self._note_map[ZOOMRIGHT])
def _setup_mixer_control(self):
is_momentary = True
self._mixer = SpecialMixerComponent(8)
self._mixer.name = 'Mixer'
#.........这里部分代码省略.........
示例12: MainSelectorComponent
# 需要导入模块: from SpecialSessionComponent import SpecialSessionComponent [as 别名]
# 或者: from SpecialSessionComponent.SpecialSessionComponent import scene [as 别名]
class MainSelectorComponent(ModeSelectorComponent):
" CLASS THAT REASSIGNS THE BUTTON ON THE LAUNCHPAD TO DIFFERENT FUNCTIONS "
" INIT "
def __init__(self, matrix, top_buttons, side_buttons, config_button):
assert isinstance(matrix, ButtonMatrixElement)
assert ((matrix.width() == 8) and (matrix.height() == 8))
assert isinstance(top_buttons, tuple)
assert (len(top_buttons) == 8)
assert isinstance(side_buttons, tuple)
assert (len(side_buttons) == 8)
assert isinstance(config_button, ButtonElement)
ModeSelectorComponent.__init__(self)
self._session = SpecialSessionComponent(self, len(self.song().tracks), matrix.height(), side_buttons)
self._session.name = "Session_Control"
self._matrix = matrix
self._side_buttons = side_buttons
self._nav_buttons = top_buttons[:4]
self._config_button = config_button
self._all_buttons = []
for button in (self._side_buttons + self._nav_buttons):
self._all_buttons.append(button)
self._sub_modes = SpecialMixerSelectorComponent(matrix, side_buttons, self._session)
self._sub_modes.name = "Mixer_Modes"
self._sub_modes.set_update_callback(self._update_control_channels)
self._init_session()
self._all_buttons = tuple(self._all_buttons)
self.set_modes_buttons(top_buttons[4:])
# mixer-session hack
self._buttons_for_mixer = []
for button in (self._side_buttons[5:]):
self._buttons_for_mixer.append(button)
for scene_index in range(self._matrix.height()):
for track_index in range(self._matrix.width()):
if scene_index > SESSION_HEIGHT_FOR_MIXER:
self._buttons_for_mixer.append(self._matrix.get_button(track_index, scene_index))
" DISCONNECT "
def disconnect(self):
for button in self._modes_buttons:
button.remove_value_listener(self._mode_value)
self._session = None
for button in self._all_buttons:
button.set_on_off_values(127, LED_OFF)
self._config_button.turn_off()
self._matrix = None
self._side_buttons = None
self._nav_buttons = None
self._config_button = None
self._buttons_for_mixer = None
ModeSelectorComponent.disconnect(self)
" GET SESSION COMPONENT "
def session_component(self):
return self._session
" SET THE MODE BUTTONS "
def set_modes_buttons(self, buttons):
assert ((buttons == None) or (isinstance(buttons, tuple) or (len(buttons) == self.number_of_modes())))
identify_sender = True
for button in self._modes_buttons:
button.remove_value_listener(self._mode_value)
self._modes_buttons = []
if (buttons != None):
for button in buttons:
assert isinstance(button, ButtonElement)
self._modes_buttons.append(button)
button.add_value_listener(self._mode_value, identify_sender)
self.set_mode(0)
" GET AMOUNT OF MODES "
def number_of_modes(self):
return 4
" CHANGE CALLBACK "
def on_enabled_changed(self):
self.update()
" SET THE MODE "
def set_mode(self, mode):
assert (mode in range(self.number_of_modes()))
if ((self._mode_index != mode) or (mode == 3) or True):
self._mode_index = mode
self.update()
" UPDATE MODE BUTTONS "
def _update_mode_buttons(self):
for index in range(4):
if (index == self._mode_index):
self._modes_buttons[index].turn_on()
else:
self._modes_buttons[index].turn_off()
" SET CHANNEL FOR THE CURRONT MODE "
def channel_for_current_mode(self):
#trying to keep
if self._mode_index==0:
return 0
elif self._mode_index==1:
new_channel=4#user 1
#.........这里部分代码省略.........
示例13: MainSelectorComponent
# 需要导入模块: from SpecialSessionComponent import SpecialSessionComponent [as 别名]
# 或者: from SpecialSessionComponent.SpecialSessionComponent import scene [as 别名]
#.........这里部分代码省略.........
self.update()
def set_mode(self, mode):
self._clean_heap()
self._modes_heap = [(mode, None, None)]
def number_of_modes(self):
return 4
def _update_mode_buttons(self):
"""lights up the mode buttons if selected"""
for index in range(4):
if (index == self._mode_index):
self._modes_buttons[index].turn_on()
else:
self._modes_buttons[index].turn_off()
def update(self):
"""main method of the class that calls the assignation methods corresponding to the current mode"""
"""it is called when the mode changes and when the selected track changes"""
assert (self._modes_buttons != None)
"links the session to the mixer, so that when change the selected track the session also changes position"
self._session.set_mixer(self._mixer)
if self.is_enabled():
self._update_mode_buttons()
self._translation_selector.update()
as_active = True
as_enabled = True
self._session.set_allow_update(False)#we dont want the controlls to change while we are updating the assignations
if (self._mode_index == 0):
"A: Transport mode"
"we activate the transport buttons and tha launch scenes buttons"
#self._parent.log_message("Launching mode")
self._setup_step_sequencer(not as_active)
self._setup_launch_clips(not as_active,not as_enabled)
self._setup_track_controls(not as_active)
self._setup_device_buttons(not as_active)
self._set_scale_control(not as_active)
self._setup_transport_buttons(as_active)
self._setup_launch_scenes(as_active, as_enabled)
self._setup_master_controls(as_active)
self._set_browser_control(as_active)
self._set_browser_button(as_active)
self._setup_select_buttons(as_active)
elif (self._mode_index == 1):
"B: Mixer mode"
"we activate the track selection, arm, and mute buttons and the launch clips buttons"
#self._parent.log_message("Launching clips mode")
self._setup_step_sequencer(not as_active)
self._setup_launch_scenes(not as_active, not as_enabled)
self._setup_master_controls(not as_active)
self._setup_device_buttons(not as_active)
self._set_scale_control(not as_active)
self._setup_transport_buttons(as_active)
self._setup_launch_clips(as_active, as_enabled)
self._setup_track_controls(as_active)
self._setup_select_buttons(as_active)
self._set_browser_control(as_active)
self._set_browser_button(as_active)
elif (self._mode_index == 2):
"C: Step sequencer mode"
self._setup_launch_scenes(not as_active, not as_enabled)
示例14: X1MK2
# 需要导入模块: from SpecialSessionComponent import SpecialSessionComponent [as 别名]
# 或者: from SpecialSessionComponent.SpecialSessionComponent import scene [as 别名]
class X1MK2(ControlSurface):
__doc__ = " Script for Traktor X1MK2 in APC emulation mode "
_active_instances = []
def _combine_active_instances():
track_offset = 0
scene_offset = 0
for instance in X1MK2._active_instances:
instance._activate_combination_mode(track_offset, scene_offset)
track_offset += instance._session.width()
_combine_active_instances = staticmethod(_combine_active_instances)
def __init__(self, c_instance):
ControlSurface.__init__(self, c_instance)
self._color_skin = make_rgb_skin()
#self.set_suppress_rebuild_requests(True)
with self.component_guard():
self._to_notify = []
self._clip_map = []
self._note_map = []
self._ctrl_map = []
self._enc_map = []
self._load_MIDI_map()
self._session = None
self._session_zoom = None
self._mixer = None
self._setup_session_control()
self._setup_mixer_control()
self._session.set_mixer(self._mixer)
self._setup_device_and_transport_control()
self.set_highlighting_session_component(self._session)
#self.set_suppress_rebuild_requests(False)
self._pads = []
self._load_pad_translations()
self._do_combine()
def disconnect(self):
self._clip_map = None
self._note_map = None
self._ctrl_map = None
self._pads = None
self._do_uncombine()
self._shift_button = None
self._session = None
self._session_zoom = None
self._mixer = None
ControlSurface.disconnect(self)
def _do_combine(self):
if self not in X1MK2._active_instances:
X1MK2._active_instances.append(self)
X1MK2._combine_active_instances()
def _do_uncombine(self):
if ((self in X1MK2._active_instances) and X1MK2._active_instances.remove(self)):
self._session.unlink()
X1MK2._combine_active_instances()
def _activate_combination_mode(self, track_offset, scene_offset):
if TRACK_OFFSET != -1:
track_offset = TRACK_OFFSET
if SCENE_OFFSET != -1:
scene_offset = SCENE_OFFSET
self._session.link_with_track_offset(track_offset, scene_offset)
def _setup_session_control(self):
is_momentary = True
self._session = SpecialSessionComponent(SESSION_WIDTH, SESSION_HEIGHT, self.log_message, enable_skinning = True)
self._session.set_rgb_mode(color_palette = CLIP_COLOR_TABLE(self.log_message), color_table = None, clip_slots_only = True)
self._session.name = 'Session_Control'
self._session.set_track_bank_buttons(self._note_map[SESSIONRIGHT], self._note_map[SESSIONLEFT])
self._session.set_scene_bank_buttons(self._note_map[SESSIONDOWN], self._note_map[SESSIONUP])
self._session.set_select_buttons(self._note_map[SCENEDN], self._note_map[SCENEUP])
self._scene_launch_buttons = [self._note_map[SCENELAUNCH[index]] for index in range(5) ]
self._track_stop_buttons = [self._note_map[TRACKSTOP[index]] for index in range(SESSION_WIDTH)]
self._session.set_stop_all_clips_button(self._note_map[STOPALLCLIPS])
self._session.set_stop_track_clip_buttons(tuple(self._track_stop_buttons))
self._session.selected_scene().name = 'Selected_Scene'
self._session.selected_scene().set_launch_button(self._note_map[SELSCENELAUNCH])
self._session.set_slot_launch_button(self._note_map[SELCLIPLAUNCH])
for scene_index in range(SESSION_HEIGHT):
scene = self._session.scene(scene_index)
scene.name = 'Scene_' + str(scene_index)
button_row = []
scene.set_launch_button(self._scene_launch_buttons[scene_index])
scene.set_triggered_value(2)
for track_index in range(SESSION_WIDTH):
button = self._clip_map[CLIPNOTEMAP[scene_index][track_index]]
button.num_delayed_messages = 3
delete_button = self._note_map[DELETECLIPNOTEMAP[scene_index][track_index]]
button_row.append(button)
clip_slot = scene.clip_slot(track_index)
clip_slot.name = str(track_index) + '_Clip_Slot_' + str(scene_index)
clip_slot.set_launch_button(button)
#.........这里部分代码省略.........
示例15: MainSelectorComponent
# 需要导入模块: from SpecialSessionComponent import SpecialSessionComponent [as 别名]
# 或者: from SpecialSessionComponent.SpecialSessionComponent import scene [as 别名]
#.........这里部分代码省略.........
self._update_control_channels()
elif self._main_mode_index == 3:
#mixer
self._m4lmode_index = 7
self.refresh_map_display()
self._setup_device_controller(not as_active)
self._setup_step_sequencer(not as_active)
self._setup_step_sequencer2(not as_active)
self._setup_instrument_controller(not as_active)
self._setup_session(not as_active, as_enabled)
self._setup_mixer(as_active)
self._update_control_channels()
else:
assert False
self._compute_mode_index()
self._previous_mode_index=self._main_mode_index
self._session.set_allow_update(True)
self._zooming.set_allow_update(True)
def _setup_session(self, as_active, as_enabled):
assert isinstance(as_active, type(False))
for button in self._nav_buttons:
if as_enabled:
button.set_on_off_values(GREEN_FULL, GREEN_THIRD)
else:
button.set_on_off_values(127, LED_OFF)
#matrix
self._activate_matrix(True)
for scene_index in range(8):
scene = self._session.scene(scene_index)
if as_active:
scene_button = self._side_buttons[scene_index]
scene_button.set_enabled(as_active)
scene_button.set_on_off_values(127, LED_OFF)
scene.set_launch_button(scene_button)
else:
scene.set_launch_button(None)
for track_index in range(8):
if as_active:
button = self._matrix.get_button(track_index, scene_index)
button.set_on_off_values(127, LED_OFF)
button.set_enabled(as_active)
scene.clip_slot(track_index).set_launch_button(button)
else:
scene.clip_slot(track_index).set_launch_button(None)
#zoom
if as_active:
self._zooming.set_zoom_button(self._modes_buttons[0])
self._zooming.set_button_matrix(self._matrix)
self._zooming.set_scene_bank_buttons(self._side_buttons)
self._zooming.set_nav_buttons(self._nav_buttons[0], self._nav_buttons[1], self._nav_buttons[2], self._nav_buttons[3])
self._zooming.update()
else:
self._zooming.set_zoom_button(None)
self._zooming.set_button_matrix(None)
self._zooming.set_scene_bank_buttons(None)
self._zooming.set_nav_buttons(None, None, None, None)
#nav buttons
if as_enabled: