本文整理汇总了Python中SpecialSessionComponent.SpecialSessionComponent类的典型用法代码示例。如果您正苦于以下问题:Python SpecialSessionComponent类的具体用法?Python SpecialSessionComponent怎么用?Python SpecialSessionComponent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SpecialSessionComponent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _setup_session
def _setup_session(self):
self._session = SpecialSessionComponent(8, 0)
self._session.name = "Session_Control"
self._session.selected_scene().name = "Selected_Scene"
self._session.set_mixer(self._mixer_for_encoders)
self._session.set_alt_mixer(self._mixer_for_faders)
self._session.add_offset_listener(self._update_bank_value)
示例2: _setup_session_control
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)
示例3: _setup_session_control
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])
示例4: _setup_session
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))
示例5: __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))
示例6: __init__
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:])
示例7: _setup_session
def _setup_session(self):
self._session = SpecialSessionComponent(0, 0)
self._session.name = 'Session_Control'
self._session.selected_scene().name = 'Selected_Scene'
self._session.set_mixer(self._mixer_for_encoders)
self._session.set_alt_mixer(self._mixer_for_faders)
self._session.set_track_banking_increment(8)
self._session.add_offset_listener(self._update_bank_value)
示例8: __init__
def __init__(self, matrix, top_buttons, side_buttons, config_button, osd, parent):
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._osd = osd
self._parent = parent
self._mode_index=0
self._previous_mode_index=-1
self._main_mode_index=0
self._sub_mode_index=[0,0,0,0]
for index in range(4):
self._sub_mode_index[index]=0
self.set_mode_buttons(top_buttons[4:])
self._session = SpecialSessionComponent(matrix.width(), matrix.height(),self)
self._session.set_osd(self._osd)
self._zooming = SessionZoomingComponent(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._mixer.set_osd(self._osd)
self._sub_modes.set_update_callback(self._update_control_channels)
self._stepseq = StepSequencerComponent(self._matrix, self._side_buttons, self._nav_buttons, self)
self._stepseq.set_osd(self._osd)
self._stepseq2 = StepSequencerComponent2(self._matrix, self._side_buttons, self._nav_buttons, self)
self._stepseq2.set_osd(self._osd)
self._instrument_controller = InstrumentControllerComponent( self._matrix, self._side_buttons, self._nav_buttons,self)
self._instrument_controller.set_osd(self._osd)
self._device_controller = DeviceControllerComponent(self._matrix, self._side_buttons, self._nav_buttons, self)
self._device_controller.set_osd(self._osd)
self._init_session()
self._all_buttons = tuple(self._all_buttons)
示例9: __init__
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)
示例10: __init__
def __init__(self, matrix, top_buttons, side_buttons, config_button, knobs, sliders, 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 = 4
slot._triggered_to_record_value = 3
slot._started_value = 2
slot._recording_value = 1
slot._stopped_value = 127
self._zooming = SessionZoomingComponent(self._session)
self._zooming._stopped_value = 127
self._zooming._playing_value = 2
self._zooming._selected_value = 1
self._matrix = matrix
self._knobs = knobs
self._sliders = sliders
self._side_buttons = side_buttons
self._nav_buttons = top_buttons[:4]
self._config_button = config_button
self._shift_button = top_buttons[5]
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._shift_pressed = 0
self._shift_pressed_timer = 0
self._last_normal_mode = 0
self._shift_button = None
self.set_shift_button(top_buttons[6])
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:6])
示例11: __init__
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)
示例12: _setup_session_control
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)
self._to_notify.append(clip_slot)
clip_slot.set_delete_button(delete_button)
# # clip_slot.set_triggered_to_play_value(CLIP_TRG_PLAY[self._rgb]) #set its triggered to play color
# # clip_slot.set_triggered_to_record_value(CLIP_TRG_REC[self._rgb])#set its triggered to record color
# # clip_slot.set_stopped_value(CLIP_STOP[self._rgb]) #set its stop color
# clip_slot.set_started_value(13) #set its started color
# clip_slot.set_recording_value(11) #set its recording value
self.log_message('Clip %s:%s' % (clip_slot.name, clip_slot._launch_button_value.subject.message_identifier()))
示例13: _init_session
def _init_session(self):
make_button = partial(make_launch_control_button, channel=9)
make_encoder = partial(make_launch_control_encoder, channel=9)
bottom_encoders, top_encoders = make_all_encoders('Session_Mixer', make_encoder)
pan_volume_layer = Layer(volume_controls=ButtonMatrixElement(rows=[bottom_encoders]), pan_controls=ButtonMatrixElement(rows=[top_encoders]))
self._session_mixer = SpecialMixerComponent(8, Layer(), pan_volume_layer, Layer())
self._session_mixer.set_enabled(False)
self._session_mixer.name = 'Session_Mixer'
clip_launch_buttons = [ make_button(identifier, 'Clip_Launch_Button_' + str(i), is_pad=True) for i, identifier in enumerate(pad_identifiers) ]
self._session = SpecialSessionComponent(num_tracks=8, num_scenes=0, name='Session')
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
示例14: __init__
def __init__(self, matrix, top_buttons, side_buttons, config_button, osd, parent, skin):
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._skin = skin
self._osd = osd
self._parent = parent
self._mode_index = 0
self._previous_mode_index = -1
self._main_mode_index = 0
self._sub_mode_index = [0, 0, 0, 0]
for index in range(4):
self._sub_mode_index[index] = 0
self.set_mode_buttons(top_buttons[4:])
if Settings.SESSION__STOP_BUTTONS:
#session with bottom stop buttons
clip_stop_buttons = []
for column in range(8):
clip_stop_buttons.append(matrix.get_button(column,matrix.height()-1))
self._session = SpecialSessionComponent(matrix.width(), matrix.height()-1, clip_stop_buttons, self, self._skin)
else:
#no stop buttons
self._session = SpecialSessionComponent(matrix.width(), matrix.height(), None, self, self._skin)
self._session.set_osd(self._osd)
self._session.name = 'Session_Control'
self._zooming = DeprecatedSessionZoomingComponent(self._session)
self._zooming.name = 'Session_Overview'
self._zooming.set_empty_value(self._skin.off)
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 = SubSelectorComponent(matrix, side_buttons, self._session, skin)
self._sub_modes.name = 'Mixer_Modes'
self._sub_modes._mixer.set_osd(self._osd)
self._sub_modes.set_update_callback(self._update_control_channels)
self._stepseq = StepSequencerComponent(self._matrix, self._side_buttons, self._nav_buttons, self, skin)
self._stepseq.set_osd(self._osd)
self._stepseq2 = StepSequencerComponent2(self._matrix, self._side_buttons, self._nav_buttons, self, skin)
self._stepseq2.set_osd(self._osd)
self._instrument_controller = InstrumentControllerComponent(self._matrix, self._side_buttons, self._nav_buttons, self, skin)
self._instrument_controller.set_osd(self._osd)
self._device_controller = DeviceControllerComponent(self._matrix, self._side_buttons, self._nav_buttons, self, skin)
self._device_controller.set_osd(self._osd)
self._init_session()
self._all_buttons = tuple(self._all_buttons)
示例15: MainSelectorComponent
class MainSelectorComponent(ModeSelectorComponent):
""" Class that reassigns the button on the launchpad to different functions """
def __init__(self, matrix, top_buttons, side_buttons, config_button, parent):
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._parent = parent
self._session = SpecialSessionComponent(matrix.width(), matrix.height())
self._zooming = SessionZoomingComponent(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._stepseq = StepSequencerComponent(self, self._matrix, self._side_buttons, self._nav_buttons)
self._quick_mix = None # QuickMixerComponent(self._nav_buttons,self._side_buttons,self)
self._device_controller = DeviceControllerComponent(self._matrix, self._side_buttons, self._nav_buttons, self)
self._init_session()
self._all_buttons = tuple(self._all_buttons)
self._mode_index = 0
self._previous_mode_index = -1
self._sub_mode_index = [0, 0, 0, 0]
for index in range(4):
self._sub_mode_index[index] = 0
self.set_mode_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 session_component(self):
return self._session
def _update_mode(self):
mode = self._modes_heap[-1][0]
assert mode in range(self.number_of_modes())
# self.log_message(str(mode))
if self._mode_index == mode:
if self._mode_index == 1:
# user mode 1 and device controller
self._sub_mode_index[self._mode_index] = (self._sub_mode_index[self._mode_index] + 1) % 2
self.update()
elif self._mode_index == 2:
# user mode 2 and step sequencer
self._sub_mode_index[self._mode_index] = (self._sub_mode_index[self._mode_index] + 1) % 3
self.update()
elif self._mode_index == 3:
self.update()
else:
self._sub_mode_index[self._mode_index] = 0
self._previous_mode_index = self._mode_index
else:
self._mode_index = mode
self.update()
def set_mode(self, mode):
self._clean_heap()
self._modes_heap = [(mode, None, None)]
# if ((self._mode_index != mode) or (mode == 3) or True):
# self._mode_index = mode
# self._update_mode()
# self.update()
def number_of_modes(self):
return 4
def on_enabled_changed(self):
self.update()
def _update_mode_buttons(self):
for index in range(4):
if self._sub_mode_index[index] == 0:
self._modes_buttons[index].set_on_off_values(AMBER_FULL, AMBER_THIRD)
#.........这里部分代码省略.........