本文整理汇总了Python中_Framework.SessionZoomingComponent.SessionZoomingComponent.set_selected_value方法的典型用法代码示例。如果您正苦于以下问题:Python SessionZoomingComponent.set_selected_value方法的具体用法?Python SessionZoomingComponent.set_selected_value怎么用?Python SessionZoomingComponent.set_selected_value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类_Framework.SessionZoomingComponent.SessionZoomingComponent
的用法示例。
在下文中一共展示了SessionZoomingComponent.set_selected_value方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: code
# 需要导入模块: from _Framework.SessionZoomingComponent import SessionZoomingComponent [as 别名]
# 或者: from _Framework.SessionZoomingComponent.SessionZoomingComponent import set_selected_value [as 别名]
#.........这里部分代码省略.........
mixer.channel_strip(index)._invert_mute_feedback = True
#mixer.channel_strip(index).set_select_button(ButtonElement(is_momentary, MIDI_NOTE_TYPE, CH, track_select_notes[index]))
self.song().view.selected_track = mixer.channel_strip(0)._track #set the selected strip to the first track, so that we don't, for example, try to assign a button to arm the master track, which would cause an assertion error
""" Technically, we aren't using the session control, but I'm going to set it up in case inter-script communication needs it"""
def _setup_session_control(self):
is_momentary = True
num_tracks = COLS
num_scenes = ROWS
global session
session = SessionComponent(num_tracks, num_scenes)
session.name = "Session"
session.set_offsets(0, 0)
self._session = session
self._session.set_stop_track_clip_value(0)
self._scene = [None for index in range(ROWS)]
for row in range(num_scenes):
self._scene[row] = session.scene(row)
self._scene[row].name = 'Scene_' + str(row)
for column in range(num_tracks):
clip_slot = self._scene[row].clip_slot(column)
clip_slot.name = str(column) + '_Clip_Slot_' + str(row)
clip_slot.set_triggered_to_play_value(64)
clip_slot.set_triggered_to_record_value(64)
clip_slot.set_stopped_value(0)
clip_slot.set_started_value(64)
clip_slot.set_recording_value(64)
#clip_slot.set_launch_button(self._grid[column][row]) #comment out if you don't want clip launch
session.set_mixer(mixer)
self._session_zoom = SessionZoomingComponent(session)
self._session_zoom.name = 'Session_Overview'
self._session_zoom.set_stopped_value(0)
self._session_zoom.set_playing_value(64)
self._session_zoom.set_selected_value(64)
if STANDALONE is True:
self.set_highlighting_session_component(self._session)
self._session.set_track_bank_buttons(self._grid[5][3], self._grid[4][3]) #comment out when using with Griid
self._session.set_scene_bank_buttons(self._grid[7][3], self._grid[6][3]) # comment out when using with Griid
"""this is where we take care of setting up the the multiple devices per page, we will need 4"""
def _setup_device_controls(self):
self._device = [None for index in range(4)]
for index in range(ROWS):
self._device[index] = DeviceComponent()
self._device[index].name = 'Device_Component_' + str(index)
#self.set_device_component(self._device) #this doesn't work anymore, because we have multiple devices for the controller....we'll have to get fancy here, but that's for later
#self._device_navigator = DetailViewControllerComponent() #its unclear if we'll need this....how is device navigation (i.e. banking for device parameter banks) going to be handled by the script?
#self._device_navigator.name = 'Device_Navigator'
device_param_controls = []
for control in range(COLS):
"""this setups up 8 device parameters per row"""
#dial_index = control + (index*COLS)
"""alternatively, this setus up device controls in 4 4x2 groups"""
dial_index = device_encoders[control + (index*COLS)]
device_param_controls.append(self._dial[dial_index])
self._device[index].set_parameter_controls(tuple(device_param_controls))
"""this is where we deassign every control that will be changing function when we switch modes...best to just deassign them all, and reassign them on update"""
def deassign_matrix(self):
for index in range(DIALCOUNT): #this should totally work!!! I'm over appealing to Python's sadistic mannerisms right now....
self._dial[index].send_value(0, True) ##this is kind of a hack, and should be unnecessary; the bool at the end tells the send_value method to force the value out to the controller
for index in range(COLS):
示例2: MainSelectorComponent
# 需要导入模块: from _Framework.SessionZoomingComponent import SessionZoomingComponent [as 别名]
# 或者: from _Framework.SessionZoomingComponent.SessionZoomingComponent import set_selected_value [as 别名]
#.........这里部分代码省略.........
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)
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)
if as_enabled:
self._session.set_track_bank_buttons(self._nav_buttons[3], self._nav_buttons[2])
self._session.set_scene_bank_buttons(self._nav_buttons[1], self._nav_buttons[0])
# self._session.set_show_highlight(True) #Needs to be replaced with L9 equivalent
else:
self._session.set_track_bank_buttons(None, None)
self._session.set_scene_bank_buttons(None, None)
# self._session.set_show_highlight(False) #Needs to be replaced with L9 equivalent
def _setup_mixer(self, as_active):
assert isinstance(as_active, type(False))
as_active and self._sub_modes.is_enabled() and self._sub_modes.set_mode(-1)
self._sub_modes.set_enabled(as_active)
def _setup_user(self, release_buttons):
for scene_index in range(8):
scene_button = self._side_buttons[scene_index]
scene_button.set_on_off_values(127, LED_OFF)
scene_button.turn_off()
scene_button.set_enabled(not release_buttons)
for track_index in range(8):
button = self._matrix.get_button(track_index, scene_index)
button.set_on_off_values(127, LED_OFF)
button.turn_off()
button.set_enabled(not release_buttons)
for button in self._nav_buttons:
button.set_on_off_values(127, LED_OFF)
button.turn_off()
button.set_enabled(not release_buttons)
if release_buttons:
self._config_button.send_value(2)
self._config_button.send_value(32, force=True)
def _init_session(self):
self._session.set_stop_track_clip_value(AMBER_BLINK)
for scene_index in range(self._matrix.height()):
scene = self._session.scene(scene_index)
scene.set_triggered_value(GREEN_BLINK)
scene.name = "Scene_" + str(scene_index)
for track_index in range(self._matrix.width()):
clip_slot = scene.clip_slot(track_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.name = str(track_index) + "_Clip_Slot_" + str(scene_index)
self._all_buttons.append(self._matrix.get_button(track_index, scene_index))
self._zooming.set_stopped_value(RED_FULL)
self._zooming.set_selected_value(AMBER_FULL)
self._zooming.set_playing_value(GREEN_FULL)
"""Mono Overrides and Additions"""
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)
示例3: _setup_session_control
# 需要导入模块: from _Framework.SessionZoomingComponent import SessionZoomingComponent [as 别名]
# 或者: from _Framework.SessionZoomingComponent.SessionZoomingComponent import set_selected_value [as 别名]
def _setup_session_control(self):
is_momentary = True
num_tracks = 4
num_scenes = 4
global session #We want to instantiate the global session as a SessionComponent object (it was a global "None" type up until now...)
session = MaschineSessionComponent(num_tracks, num_scenes) #(num_tracks, num_scenes)
session.set_offsets(0, 0) #(track_offset, scene_offset) Sets the initial offset of the red box from top left
matrix = ButtonMatrixElement()
self._register_timer_callback(session.flash_clip_slots)
"""set up the session buttons"""
left_button = ButtonElement(is_momentary, MIDI_CC_TYPE, CHANNEL, 91)
right_button = ButtonElement(is_momentary, MIDI_CC_TYPE, CHANNEL, 93)
session.set_track_bank_buttons(right_button, left_button)
# Stop buttons
track_stop_buttons = [ ButtonElement(is_momentary, MIDI_CC_TYPE, 4, (55 + index)) for index in range(num_tracks) ]
session.set_stop_track_clip_buttons(tuple(track_stop_buttons))
up_button = ButtonElement(is_momentary, MIDI_CC_TYPE, CHANNEL, 81)
down_button = ButtonElement(is_momentary, MIDI_CC_TYPE, CHANNEL, 92)
session.set_scene_bank_buttons(down_button, up_button) # (up_button, down_button) This is to move the "red box" up or down (increment track up or down, not screen up or down, so they are inversed)
session.set_mixer(mixer) #Bind the mixer to the session so that they move together
selected_scene = self.song().view.selected_scene #this is from the Live API
all_scenes = self.song().scenes
index = list(all_scenes).index(selected_scene)
session.set_offsets(0, index) #(track_offset, scene_offset)
scene_launch_buttons = []
for scene_index in range(4):
scene = session.scene(scene_index)
launch_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 1, (124 + scene_index))
scene.set_launch_button(launch_button)
scene_launch_buttons.append(launch_button)
clip_launch_notes = [
[24, 25, 26, 27],
[20, 21, 22, 23],
[16, 17, 18, 19],
[12, 13, 14, 15],
]
for scene_index in range(num_scenes):
button_row = []
for track_index in range(num_tracks):
clip_slot = session.scene(scene_index).clip_slot(track_index)
clip_slot.set_triggered_to_record_value(127)
clip_slot.set_recording_value(127)
clip_slot.set_started_value(127)
clip_slot.set_stopped_value(127)
button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 2, clip_launch_notes[scene_index][track_index])
clip_slot.set_launch_button(button)
button_row.append(button)
matrix.add_row(tuple(button_row))
session_zoom = SessionZoomingComponent(session)
session_zoom.set_zoom_button(self.shift_button)
session_zoom.set_nav_buttons(up_button, down_button, left_button, right_button)
session_zoom.set_scene_bank_buttons(tuple(scene_launch_buttons))
session_zoom.set_button_matrix(matrix)
session_zoom.set_stopped_value(0)
session_zoom.set_selected_value(127)
示例4: APC40plus22
# 需要导入模块: from _Framework.SessionZoomingComponent import SessionZoomingComponent [as 别名]
# 或者: from _Framework.SessionZoomingComponent.SessionZoomingComponent import set_selected_value [as 别名]
class APC40plus22(APC):
__doc__ = " Script for Akai's APC40 Controller with extra features added "
def __init__(self, c_instance):
self._c_instance = c_instance
self._shift_modes = None #added from APC20 script
self._encoder_modes = None #added
self._slider_modes = None #added
APC.__init__(self, c_instance)
self.show_message("APC40_22 script loaded")
# Disabling the scene launch buttons and assigning them to the first 5 repeats on Master
self._device_buttons = []
self.setup_device_buttons()
def disconnect(self): #this is from the APC20 script
for button in self._device_buttons:
button.remove_value_listener(self._device_toggle)
self._device_buttons = None
self._shift_modes = None
self._encoder_modes = None
self._slider_modes = None
APC.disconnect(self)
def setup_device_buttons(self):
repeat = RepeatComponent(self)
repeat.set_shift_button(self._shift_button)
def _setup_session_control(self):
is_momentary = True
self._shift_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 98)
right_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 96)
left_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 97)
up_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 94)
down_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 95)
right_button.name = 'Bank_Select_Right_Button'
left_button.name = 'Bank_Select_Left_Button'
up_button.name = 'Bank_Select_Up_Button'
down_button.name = 'Bank_Select_Down_Button'
self._session = PedaledSessionComponent(8, 5)
self._session.name = 'Session_Control'
self._session.set_track_bank_buttons(right_button, left_button)
self._session.set_scene_bank_buttons(down_button, up_button)
self._matrix = ButtonMatrixElement() #was: matrix = ButtonMatrixElement()
self._matrix.name = 'Button_Matrix' #was: matrix.name = 'Button_Matrix'
scene_launch_buttons = [ ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, (index + 82)) for index in range(5) ]
#self._track_stop_buttons = [ ButtonElement(is_momentary, MIDI_NOTE_TYPE, index, 52) for index in range(8) ]
self._track_stop_buttons = [ ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, index, 52) for index in range(8) ]
for index in range(len(scene_launch_buttons)):
scene_launch_buttons[index].name = 'Scene_'+ str(index) + '_Launch_Button'
for index in range(len(self._track_stop_buttons)):
self._track_stop_buttons[index].name = 'Track_' + str(index) + '_Stop_Button'
stop_all_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 81)
stop_all_button.name = 'Stop_All_Clips_Button'
self._session.set_stop_all_clips_button(stop_all_button)
self._session.set_stop_track_clip_buttons(tuple(self._track_stop_buttons))
self._session.set_stop_track_clip_value(2)
for scene_index in range(5):
scene = self._session.scene(scene_index)
scene.name = 'Scene_' + str(scene_index)
button_row = []
scene.set_launch_button(scene_launch_buttons[scene_index])
scene.set_triggered_value(2)
for track_index in range(8):
#button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, track_index, (scene_index + 53))
button = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, track_index, (scene_index + 53)) #use Launchpad configurable button instead
button.name = str(track_index) + '_Clip_' + str(scene_index) + '_Button'
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_triggered_to_play_value(2)
clip_slot.set_triggered_to_record_value(4)
clip_slot.set_stopped_value(3)
clip_slot.set_started_value(1)
clip_slot.set_recording_value(5)
clip_slot.set_launch_button(button)
self._matrix.add_row(tuple(button_row)) #matrix.add_row(tuple(button_row))
# Removing the launch selected clip footpedal option
#self._session.set_slot_launch_button(ButtonElement(is_momentary, MIDI_CC_TYPE, 0, 67))
self._session.selected_scene().name = 'Selected_Scene'
self._session.selected_scene().set_launch_button(ButtonElement(is_momentary, MIDI_CC_TYPE, 0, 64))
self._session_zoom = SessionZoomingComponent(self._session) #use APC20 Zooming instead
self._session_zoom.name = 'Session_Overview'
self._session_zoom.set_button_matrix(self._matrix) #was: self._session_zoom.set_button_matrix(matrix)
self._session_zoom.set_zoom_button(self._shift_button) #set in MatrixModesComponent instead
self._session_zoom.set_nav_buttons(up_button, down_button, left_button, right_button)
self._session_zoom.set_scene_bank_buttons(tuple(scene_launch_buttons))
self._session_zoom.set_stopped_value(3)
self._session_zoom.set_selected_value(5)
return None
def _setup_mixer_control(self):
is_momentary = True
self._mixer = SpecialMixerComponent(self, 8) #added self for parent
self._mixer.name = 'Mixer'
self._mixer.master_strip().name = 'Master_Channel_Strip'
master_select_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 80)
master_select_button.name = 'Master_Select_Button'
#.........这里部分代码省略.........
示例5: MainSelectorComponent
# 需要导入模块: from _Framework.SessionZoomingComponent import SessionZoomingComponent [as 别名]
# 或者: from _Framework.SessionZoomingComponent.SessionZoomingComponent import set_selected_value [as 别名]
#.........这里部分代码省略.........
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)
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_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)
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)
if as_enabled:
self._session.set_track_bank_buttons(self._nav_buttons[3], self._nav_buttons[2])
self._session.set_scene_bank_buttons(self._nav_buttons[1], self._nav_buttons[0])
self._session.set_show_highlight(True)
else:
self._session.set_track_bank_buttons(None, None)
self._session.set_scene_bank_buttons(None, None)
self._session.set_show_highlight(False)
def _setup_mixer(self, as_active):
assert isinstance(as_active, type(False))
self._sub_modes.set_enabled(as_active)
def _setup_user(self, release_buttons):
for scene_index in range(8):
scene_button = self._side_buttons[scene_index]
scene_button.set_on_off_values(127, LED_OFF)
scene_button.turn_off()
scene_button.set_enabled((not release_buttons))
for track_index in range(8):
button = self._matrix.get_button(track_index, scene_index)
button.set_on_off_values(127, LED_OFF)
button.turn_off()
button.set_enabled((not release_buttons))
for button in self._nav_buttons:
button.set_on_off_values(127, LED_OFF)
button.turn_off()
button.set_enabled((not release_buttons))
self._config_button.send_value(32)
if release_buttons:
self._config_button.send_value(2)
def _init_session(self):
self._session.set_stop_track_clip_value(AMBER_BLINK)
for scene_index in range(self._matrix.height()):
scene = self._session.scene(scene_index)
scene.set_triggered_value(GREEN_BLINK)
for track_index in range(self._matrix.width()):
clip_slot = scene.clip_slot(track_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)
self._all_buttons.append(self._matrix.get_button(track_index, scene_index))
self._zooming.set_stopped_value(RED_FULL)
self._zooming.set_selected_value(AMBER_FULL)
self._zooming.set_playing_value(GREEN_FULL)
示例6: OhmModesHH
# 需要导入模块: from _Framework.SessionZoomingComponent import SessionZoomingComponent [as 别名]
# 或者: from _Framework.SessionZoomingComponent.SessionZoomingComponent import set_selected_value [as 别名]
#.........这里部分代码省略.........
num_scenes = 7 ###changed from 5 for HH
global session
session = SessionComponent(num_tracks, num_scenes)
session.name = "Session"
session.set_offsets(0, 0)
self._session = session
self._scene = [None for index in range(num_scenes)]
for row in range(num_scenes):
self._scene[row] = session.scene(row)
self._scene[row].name = 'Scene_' + str(row)
for column in range(num_tracks):
clip_slot = self._scene[row].clip_slot(column)
clip_slot.name = str(column) + '_Clip_Slot_' + str(row)
session.set_mixer(mixer)
self._session_zoom = SessionZoomingComponent(session)
self._session_zoom.name = 'Session_Overview'
#self._session_zoom.set_enabled(False)
self.set_highlighting_session_component(self._session)
def _assign_session_colors(self):
num_tracks = 7
num_scenes = 7
self._session.set_stop_clip_value(STOP_CLIP_COLOR[self._rgb])
for row in range(num_scenes):
for column in range(num_tracks):
self._scene[row].clip_slot(column).set_triggered_to_play_value(CLIP_TRIGD_TO_PLAY_COLOR[self._rgb])
self._scene[row].clip_slot(column).set_triggered_to_record_value(CLIP_TRIGD_TO_RECORD_COLOR[self._rgb])
self._scene[row].clip_slot(column).set_stopped_value(CLIP_STOPPED_COLOR[self._rgb])
self._scene[row].clip_slot(column).set_started_value(CLIP_STARTED_COLOR[self._rgb])
self._scene[row].clip_slot(column).set_recording_value(CLIP_RECORDING_COLOR[self._rgb])
self._session_zoom.set_stopped_value(ZOOM_STOPPED_COLOR[self._rgb])
self._session_zoom.set_playing_value(ZOOM_PLAYING_COLOR[self._rgb])
self._session_zoom.set_selected_value(ZOOM_SELECTED_COLOR[self._rgb])
def _setup_device_control(self):
self._device = DeviceComponent()
self._device.name = 'Device_Component'
self.set_device_component(self._device)
self._device_navigator = DetailViewControllerComponent()
self._device_navigator.name = 'Device_Navigator'
self._device_selection_follows_track_selection = FOLLOW
def device_follows_track(self, val):
self._device_selection_follows_track_selection = (val == 1)
return self
def _setup_crossfader(self):
self._mixer.set_crossfader_control(self._crossfader)
def _setup_scene_selector(self):
for index in range(5):
self._menu[index].add_value_listener(self._select_new_scene, True)
def set_bank(self, val):
self._scene_bank = int(val)
self._monobridge._send('bank', self._scene_bank)
self._display_bank()
def _select_mode(self, value):
self.log_message('select mode update' + str(value))
self._bank_is_on = value!=0
示例7: APC40
# 需要导入模块: from _Framework.SessionZoomingComponent import SessionZoomingComponent [as 别名]
# 或者: from _Framework.SessionZoomingComponent.SessionZoomingComponent import set_selected_value [as 别名]
class APC40(APC):
__doc__ = " Script for Akai's APC40 Controller "
def __init__(self, c_instance):
APC.__init__(self, c_instance)
self._device_selection_follows_track_selection = True
def _setup_session_control(self):
is_momentary = True
self._shift_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 98)
right_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 96)
left_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 97)
up_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 94)
down_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 95)
right_button.name = 'Bank_Select_Right_Button'
left_button.name = 'Bank_Select_Left_Button'
up_button.name = 'Bank_Select_Up_Button'
down_button.name = 'Bank_Select_Down_Button'
self._session = PedaledSessionComponent(8, 5)
self._session.name = 'Session_Control'
self._session.set_track_bank_buttons(right_button, left_button)
self._session.set_scene_bank_buttons(down_button, up_button)
matrix = ButtonMatrixElement()
matrix.name = 'Button_Matrix'
self._matrix = matrix
scene_launch_buttons = [ ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, (index + 82)) for index in range(5) ]
track_stop_buttons = [ ButtonElement(is_momentary, MIDI_NOTE_TYPE, index, 52) for index in range(8) ]
self._track_stop_buttons = track_stop_buttons
for index in range(len(scene_launch_buttons)):
scene_launch_buttons[index].name = 'Scene_'+ str(index) + '_Launch_Button'
for index in range(len(track_stop_buttons)):
track_stop_buttons[index].name = 'Track_' + str(index) + '_Stop_Button'
stop_all_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 81)
stop_all_button.name = 'Stop_All_Clips_Button'
self._session.set_stop_all_clips_button(stop_all_button)
self._session.set_stop_track_clip_buttons(tuple(track_stop_buttons))
self._session.set_stop_track_clip_value(2)
self._button_rows = []
for scene_index in range(5):
scene = self._session.scene(scene_index)
scene.name = 'Scene_' + str(scene_index)
button_row = []
scene.set_launch_button(scene_launch_buttons[scene_index])
scene.set_triggered_value(2)
for track_index in range(8):
button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, track_index, (scene_index + 53))
button.name = str(track_index) + '_Clip_' + str(scene_index) + '_Button'
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_triggered_to_play_value(2)
clip_slot.set_triggered_to_record_value(4)
clip_slot.set_stopped_value(5)
clip_slot.set_started_value(1)
clip_slot.set_recording_value(3)
clip_slot.set_launch_button(button)
matrix.add_row(tuple(button_row))
self._button_rows.append(button_row)
self._session.set_slot_launch_button(ButtonElement(is_momentary, MIDI_CC_TYPE, 0, 67))
self._session.selected_scene().name = 'Selected_Scene'
self._session.selected_scene().set_launch_button(ButtonElement(is_momentary, MIDI_CC_TYPE, 0, 64))
self._session_zoom = SessionZoomingComponent(self._session)
self._session_zoom.name = 'Session_Overview'
self._session_zoom.set_button_matrix(matrix)
self._session_zoom.set_zoom_button(self._shift_button)
self._session_zoom.set_nav_buttons(up_button, down_button, left_button, right_button)
self._session_zoom.set_scene_bank_buttons(tuple(scene_launch_buttons))
self._session_zoom.set_stopped_value(3)
self._session_zoom.set_selected_value(5)
return None
def _setup_mixer_control(self):
is_momentary = True
self._mixer = SpecialMixerComponent(8)
self._mixer.name = 'Mixer'
self._mixer.master_strip().name = 'Master_Channel_Strip'
self._mixer.selected_strip().name = 'Selected_Channel_Strip'
self._select_buttons = []
for track in range(8):
strip = self._mixer.channel_strip(track)
strip.name = 'Channel_Strip_' + str(track)
volume_control = SliderElement(MIDI_CC_TYPE, track, 7)
arm_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, track, 48)
solo_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, track, 49)
mute_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, track, 50)
select_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, track, 51)
self._select_buttons.append(select_button)
volume_control.name = str(track) + '_Volume_Control'
arm_button.name = str(track) + '_Arm_Button'
solo_button.name = str(track) + '_Solo_Button'
mute_button.name = str(track) + '_Mute_Button'
select_button.name = str(track) + '_Select_Button'
strip.set_volume_control(volume_control)
strip.set_arm_button(arm_button)
strip.set_solo_button(solo_button)
strip.set_mute_button(mute_button)
strip.set_select_button(select_button)
strip.set_shift_button(self._shift_button)
strip.set_invert_mute_feedback(True)
#.........这里部分代码省略.........
示例8: AumPC40
# 需要导入模块: from _Framework.SessionZoomingComponent import SessionZoomingComponent [as 别名]
# 或者: from _Framework.SessionZoomingComponent.SessionZoomingComponent import set_selected_value [as 别名]
class AumPC40(APC):
__doc__ = " Script for Akai's APC40 Controller "
def __init__(self, c_instance):
APC.__init__(self, c_instance)
self._device_selection_follows_track_selection = True
def _setup_session_control(self):
is_momentary = True
self._shift_button = FlashingButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 98, self)
right_button = FlashingButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 96, self)
self._right_button = right_button
left_button = FlashingButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 97, self)
self._left_button = left_button
up_button = FlashingButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 94, self)
self._up_button = up_button
down_button = FlashingButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 95, self)
self._down_button = down_button
right_button.name = 'Bank_Select_Right_Button'
left_button.name = 'Bank_Select_Left_Button'
up_button.name = 'Bank_Select_Up_Button'
down_button.name = 'Bank_Select_Down_Button'
self._session = PedaledSessionComponent(8, 5)
self._session.name = 'Session_Control'
self._session.set_track_bank_buttons(right_button, left_button)
self._session.set_scene_bank_buttons(down_button, up_button)
matrix = ButtonMatrixElement()
self._matrix = matrix # added a
matrix.name = 'Button_Matrix'
scene_launch_buttons = [ ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, (index + 82)) for index in range(5) ]
track_stop_buttons = [ FlashingButtonElement(is_momentary, MIDI_NOTE_TYPE, index, 52, self) for index in range(8) ]
self._track_stop_buttons = track_stop_buttons # added a
for index in range(len(scene_launch_buttons)):
scene_launch_buttons[index].name = 'Scene_'+ str(index) + '_Launch_Button'
for index in range(len(track_stop_buttons)):
track_stop_buttons[index].name = 'Track_' + str(index) + '_Stop_Button'
stop_all_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 81)
stop_all_button.name = 'Stop_All_Clips_Button'
self._session.set_stop_all_clips_button(stop_all_button)
self._session.set_stop_track_clip_buttons(tuple(track_stop_buttons))
self._session.set_stop_track_clip_value(2)
for scene_index in range(5):
scene = self._session.scene(scene_index)
scene.name = 'Scene_' + str(scene_index)
button_row = []
scene.set_launch_button(scene_launch_buttons[scene_index])
scene.set_triggered_value(2)
for track_index in range(8):
button = FlashingButtonElement(is_momentary, MIDI_NOTE_TYPE, track_index, (scene_index + 53), self)
button.name = str(track_index) + '_Clip_' + str(scene_index) + '_Button'
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_triggered_to_play_value(2)
clip_slot.set_triggered_to_record_value(4)
clip_slot.set_stopped_value(5)
clip_slot.set_started_value(1)
clip_slot.set_recording_value(3)
clip_slot.set_launch_button(button)
matrix.add_row(tuple(button_row))
self._session.set_slot_launch_button(ButtonElement(is_momentary, MIDI_CC_TYPE, 0, 67))
self._session.selected_scene().name = 'Selected_Scene'
self._session.selected_scene().set_launch_button(ButtonElement(is_momentary, MIDI_CC_TYPE, 0, 64))
self._session_zoom = SessionZoomingComponent(self._session)
self._session_zoom.name = 'Session_Overview'
self._session_zoom.set_button_matrix(matrix)
self._session_zoom.set_zoom_button(self._shift_button)
self._session_zoom.set_nav_buttons(up_button, down_button, left_button, right_button)
self._session_zoom.set_scene_bank_buttons(tuple(scene_launch_buttons))
self._session_zoom.set_stopped_value(3)
self._session_zoom.set_selected_value(5)
return None
def _setup_mixer_control(self):
is_momentary = True
self._mixer = SpecialMixerComponent(8)
self._mixer.name = 'Mixer'
self._mixer.master_strip().name = 'Master_Channel_Strip'
self._mixer.selected_strip().name = 'Selected_Channel_Strip'
self._solo_buttons = [] # added a
self._select_buttons = [] # added a
for track in range(8):
strip = self._mixer.channel_strip(track)
strip.name = 'Channel_Strip_' + str(track)
volume_control = MonoEncoderElement2(MIDI_CC_TYPE, track, 7, Live.MidiMap.MapMode.absolute, 'Slider_' + str(track), track, self)
arm_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, track, 48)
solo_button = FlashingButtonElement(is_momentary, MIDI_NOTE_TYPE, track, 50, self)
self._solo_buttons.append(solo_button) # added a
mute_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, track, 49)
select_button = FlashingButtonElement(is_momentary, MIDI_NOTE_TYPE, track, 51, self)
self._select_buttons.append(select_button) # added a
#volume_control.name = str(track) + '_Volume_Control'
arm_button.name = str(track) + '_Arm_Button'
solo_button.name = str(track) + '_Solo_Button'
mute_button.name = str(track) + '_Mute_Button'
select_button.name = str(track) + '_Select_Button'
strip.set_volume_control(volume_control)
strip.set_arm_button(arm_button)
#.........这里部分代码省略.........
示例9: MainSelectorComponent
# 需要导入模块: from _Framework.SessionZoomingComponent import SessionZoomingComponent [as 别名]
# 或者: from _Framework.SessionZoomingComponent.SessionZoomingComponent import set_selected_value [as 别名]
#.........这里部分代码省略.........
else:
raise False or AssertionError
self._session.set_allow_update(True)
self._zooming.set_allow_update(True)
self._update_control_channels()
def _update_control_channels(self):
new_channel = self.channel_for_current_mode()
for button in self._all_buttons:
button.set_channel(new_channel)
button.set_force_next_value()
def _setup_session(self, as_active, as_enabled):
if not isinstance(as_active, type(False)):
raise AssertionError
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)
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_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)
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)
as_enabled and self._session.set_track_bank_buttons(self._nav_buttons[3], self._nav_buttons[2])
self._session.set_scene_bank_buttons(self._nav_buttons[1], self._nav_buttons[0])
else:
self._session.set_track_bank_buttons(None, None)
self._session.set_scene_bank_buttons(None, None)
def _setup_mixer(self, as_active):
if not isinstance(as_active, type(False)):
raise AssertionError
as_active and self._sub_modes.is_enabled() and self._sub_modes.set_mode(-1)
self._sub_modes.set_enabled(as_active)
def _setup_user(self, release_buttons):
for scene_index in range(8):
scene_button = self._side_buttons[scene_index]
scene_button.set_on_off_values(127, LED_OFF)
scene_button.turn_off()
scene_button.set_enabled(not release_buttons)
for track_index in range(8):
button = self._matrix.get_button(track_index, scene_index)
button.set_on_off_values(127, LED_OFF)
button.turn_off()
button.set_enabled(not release_buttons)
for button in self._nav_buttons:
button.set_on_off_values(127, LED_OFF)
button.turn_off()
button.set_enabled(not release_buttons)
if release_buttons:
self._config_button.send_value(2)
self._config_button.send_value(32, force_send=True)
def _init_session(self):
self._session.set_stop_track_clip_value(AMBER_BLINK)
for scene_index in range(self._matrix.height()):
scene = self._session.scene(scene_index)
scene.set_triggered_value(GREEN_BLINK)
scene.name = 'Scene_' + str(scene_index)
for track_index in range(self._matrix.width()):
clip_slot = scene.clip_slot(track_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.name = str(track_index) + '_Clip_Slot_' + str(scene_index)
self._all_buttons.append(self._matrix.get_button(track_index, scene_index))
self._zooming.set_stopped_value(RED_FULL)
self._zooming.set_selected_value(AMBER_FULL)
self._zooming.set_playing_value(GREEN_FULL)
示例10: APC40
# 需要导入模块: from _Framework.SessionZoomingComponent import SessionZoomingComponent [as 别名]
# 或者: from _Framework.SessionZoomingComponent.SessionZoomingComponent import set_selected_value [as 别名]
class APC40(APC):
__doc__ = " Script for Akai's APC40 Controller "
def __init__(self, c_instance):
APC.__init__(self, c_instance)
self._device_selection_follows_track_selection = True
def _setup_session_control(self):
is_momentary = True
self._shift_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 98)
right_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 96)
left_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 97)
up_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 94)
down_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 95)
right_button.name = 'Bank_Select_Right_Button'
left_button.name = 'Bank_Select_Left_Button'
up_button.name = 'Bank_Select_Up_Button'
down_button.name = 'Bank_Select_Down_Button'
self._session = PedaledSessionComponent(8, 5)
self._session.name = 'Session_Control'
self._session.set_track_bank_buttons(right_button, left_button)
self._session.set_scene_bank_buttons(down_button, up_button)
matrix = ButtonMatrixElement()
matrix.name = 'Button_Matrix'
self.scene_launch_buttons = [ ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, (index + 82)) for index in range(5) ]
track_stop_buttons = [ ButtonElement(is_momentary, MIDI_NOTE_TYPE, index, 52) for index in range(8) ]
for index in range(len(self.scene_launch_buttons)):
self.scene_launch_buttons[index].name = 'Scene_'+ str(index) + '_Launch_Button'
for index in range(len(track_stop_buttons)):
track_stop_buttons[index].name = 'Track_' + str(index) + '_Stop_Button'
self.stop_all_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 81)
self.stop_all_button.name = 'Stop_All_Clips_Button'
self._session.set_stop_all_clips_button(self.stop_all_button)
self._session.set_stop_track_clip_buttons(tuple(track_stop_buttons))
self._session.set_stop_track_clip_value(2)
## Quirksmode
self.newZoom_buttons = []
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 = ButtonElement(is_momentary, MIDI_NOTE_TYPE, track_index, (scene_index + 53))
## Quirksmode - This moves the zoomer to allow for scene launch customisation (Currently not working 100%)
if(track_index == 4):
self.newZoom_buttons.append(button)
button.name = str(track_index) + '_Clip_' + str(scene_index) + '_Button'
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_triggered_to_play_value(2)
clip_slot.set_triggered_to_record_value(4)
clip_slot.set_stopped_value(3)
clip_slot.set_started_value(1)
clip_slot.set_recording_value(3)
clip_slot.set_launch_button(button)
matrix.add_row(tuple(button_row))
self._session.set_slot_launch_button(ButtonElement(is_momentary, MIDI_CC_TYPE, 0, 67))
self._session.selected_scene().name = 'Selected_Scene'
self._session.selected_scene().set_launch_button(ButtonElement(is_momentary, MIDI_CC_TYPE, 0, 64))
self._session_zoom = SessionZoomingComponent(self._session)
self._session_zoom.name = 'Session_Overview'
self._session_zoom.set_button_matrix(matrix)
self._session_zoom.set_zoom_button(self._shift_button)
self._session_zoom.set_nav_buttons(up_button, down_button, left_button, right_button)
self._session_zoom.set_scene_bank_buttons(tuple(self.newZoom_buttons))
self._session_zoom.set_stopped_value(3)
self._session_zoom.set_selected_value(5)
return None #return session
def _setup_mixer_control(self):
is_momentary = True
## Quirksmode
self.arm_buttons = []
self._mixer = SpecialMixerComponent(self, 8) #added self for parent
self._mixer.name = 'Mixer'
self._mixer.master_strip().name = 'Master_Channel_Strip'
self._mixer.selected_strip().name = 'Selected_Channel_Strip'
for track in range(8):
self.strip = self._mixer.channel_strip(track)
self.strip.name = 'Channel_Strip_' + str(track)
volume_control = SliderElement(MIDI_CC_TYPE, track, 7)
arm_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, track, 48)
solo_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, track, 49)
mute_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, track, 50)
select_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, track, 51)
volume_control.name = str(track) + '_Volume_Control'
arm_button.name = str(track) + '_Arm_Button'
solo_button.name = str(track) + '_Solo_Button'
#.........这里部分代码省略.........
示例11: OhmModes
# 需要导入模块: from _Framework.SessionZoomingComponent import SessionZoomingComponent [as 别名]
# 或者: from _Framework.SessionZoomingComponent.SessionZoomingComponent import set_selected_value [as 别名]
#.........这里部分代码省略.........
is_momentary = True
num_tracks = 7
num_scenes = 5
global session
session = SessionComponent(num_tracks, num_scenes)
session.name = "Session"
self._session = session
session.set_offsets(0, 0)
self._scene = [None for index in range(6)]
for row in range(num_scenes):
self._scene[row] = session.scene(row)
self._scene[row].name = 'Scene_' + str(row)
for column in range(num_tracks):
clip_slot = self._scene[row].clip_slot(column)
clip_slot.name = str(column) + '_Clip_Slot_' + str(row)
session.set_mixer(self._mixer)
self._session_zoom = SessionZoomingComponent(session)
self._session_zoom.name = 'Session_Overview'
def _assign_session_colors(self):
num_tracks = 7
num_scenes = 5
self._session.set_stop_track_clip_value(STOP_CLIP_COLOR[self._rgb])
for row in range(num_scenes):
for column in range(num_tracks):
self._scene[row].clip_slot(column).set_triggered_to_play_value(CLIP_TRIGD_TO_PLAY_COLOR[self._rgb])
self._scene[row].clip_slot(column).set_triggered_to_record_value(CLIP_TRIGD_TO_RECORD_COLOR[self._rgb])
self._scene[row].clip_slot(column).set_stopped_value(CLIP_STOPPED_COLOR[self._rgb])
self._scene[row].clip_slot(column).set_started_value(CLIP_STARTED_COLOR[self._rgb])
self._scene[row].clip_slot(column).set_recording_value(CLIP_RECORDING_COLOR[self._rgb])
self._session_zoom.set_stopped_value(ZOOM_STOPPED_COLOR[self._rgb])
self._session_zoom.set_playing_value(ZOOM_PLAYING_COLOR[self._rgb])
self._session_zoom.set_selected_value(ZOOM_SELECTED_COLOR[self._rgb])
def _setup_device_control(self):
self._device = DeviceComponent()
self._device.name = 'Device_Component'
self.set_device_component(self._device)
self._device_navigator = DetailViewControllerComponent()
self._device_navigator.name = 'Device_Navigator'
self._device_selection_follows_track_selection = FOLLOW
def device_follows_track(self, val):
self._device_selection_follows_track_selection = (val == 1)
return self
def _setup_crossfader(self):
self._mixer.set_crossfader_control(self._crossfader)
def disconnect(self):
"""clean things up on disconnect"""
self.song().view.remove_selected_track_listener(self._update_selected_device)
self.log_message(time.strftime("%d.%m.%Y %H:%M:%S", time.localtime()) + "--------------= OhmModes log closed =--------------") #Create entry in log file
ControlSurface.disconnect(self)
return None
def _get_num_tracks(self):
return self.num_tracks
示例12: Tweaker
# 需要导入模块: from _Framework.SessionZoomingComponent import SessionZoomingComponent [as 别名]
# 或者: from _Framework.SessionZoomingComponent.SessionZoomingComponent import set_selected_value [as 别名]
#.........这里部分代码省略.........
def _setup_session_control(self):
is_momentary = True
num_tracks = NUM_TRACKS
num_scenes = NUM_SCENES
self._session = SessionComponent(num_tracks, num_scenes)
self._session.name = "Session"
self._session.set_offsets(0, 0)
self._session.set_stop_track_clip_value(STOP_CLIP)
self._scene = [None for index in range(3)]
for row in range(num_scenes):
self._scene[row] = self._session.scene(row)
self._scene[row].name = 'Scene_' + str(row)
for column in range(num_tracks):
clip_slot = self._scene[row].clip_slot(column)
clip_slot.name = str(column) + '_Clip_Slot_' + str(row)
clip_slot.set_triggered_to_play_value(CLIP_TRG_PLAY)
clip_slot.set_triggered_to_record_value(CLIP_TRG_REC)
clip_slot.set_stopped_value(CLIP_STOP)
clip_slot.set_started_value(CLIP_STARTED)
clip_slot.set_recording_value(CLIP_RECORDING)
self._session._stop_track_value = self._session_stop_track_value(self._session)
self._session._on_fired_slot_index_changed = self._session_on_fired_slot_index_changed(self._session)
self._session._change_offsets = self._session_change_offsets(self._session)
self._session.update = self._session_update(self._session)
#self._session.add_offset_listener(self._update_navigation_view)
self._session.set_mixer(self._mixer)
self.set_highlighting_session_component(self._session)
self._session_zoom = SessionZoomingComponent(self._session)
self._session_zoom.name = 'Session_Overview'
self._session_zoom.set_stopped_value(ZOOM_STOPPED)
self._session_zoom.set_playing_value(ZOOM_PLAYING)
self._session_zoom.set_selected_value(ZOOM_SELECTED)
#self._session_zoom.set_enabled(True)
def _setup_device_control(self):
self._device = [None for index in range(2)]
for index in range(2):
self._device[index] = DeviceComponent()
self._device[index].name = 'Device_Component_'+str(index)
self._device[index].set_enabled(True)
self._device[index]._number_of_parameter_banks = self._device_number_of_parameter_banks(self._device[index])
self._device[index]._assign_parameters = self._device_assign_parameters(self._device[index])
self._device[index]._device_banks = DEVICE_DICT
self._device[index]._device_best_banks = DEVICE_BOB_DICT
self._device[index]._device_bank_names = BANK_NAME_DICT
def _setup_crossfader(self):
self._mixer.set_crossfader_control(self._crossfader)
def _setup_modes(self):
self._pad_offset = PadOffsetComponent(self)
self._pad_offset._set_protected_mode_index(0)
self._pad_offset.set_enabled(False)
def _setup_pads(self):
for pad in self._pad_pressure:
pad.add_value_listener(self._light_pad, True)
def _setup_navigation_lock(self):
示例13: AumTroll_G
# 需要导入模块: from _Framework.SessionZoomingComponent import SessionZoomingComponent [as 别名]
# 或者: from _Framework.SessionZoomingComponent.SessionZoomingComponent import set_selected_value [as 别名]
class AumTroll_G(AumTroll):
def __init__(self, *a, **k):
super(AumTroll_G, self).__init__(*a, **k)
with self.component_guard():
self._setup_session_recording_component()
self._setup_APC_detail_component()
self.log_message('Aumtroll G 4')
def _setup_session_recording_component(self):
self._recorder = SessionRecordingComponent(ClipCreator(), ViewControlComponent())
def _setup_APC_detail_component(self):
self._alt_device_navigator = DetailViewCntrlComponent()
"""the mixer component corresponds and moves with our selection in Live, and allows us to assign physical controls"""
"""to Live's mixer functions without having to make all the links ourselves"""
def _setup_mixer_control(self):
is_momentary = True
self._num_tracks = (8) #A mixer is one-dimensional;
self._mixer = MixerComponent(8, 2, True, False) #These values represent the (Number_of_tracks, Number_of_returns, EQ_component, Filter_component)
self._mixer.name = 'Mixer' #We name everything that we might want to access in m4l
self._mixer.set_track_offset(0) #Sets start point for mixer strip (offset from left)
for index in range(8):
#self._mixer.channel_strip(index).set_volume_control(self._fader[index]) #Since we gave our mixer 4 tracks above, we'll now assign our fader controls to it
self._mixer.channel_strip(index).name = 'Mixer_ChannelStrip_' + str(index) #We also name the individual channel_strip so we can access it
self._mixer.track_eq(index).name = 'Mixer_EQ_' + str(index) #We also name the individual EQ_component so we can access it
self._mixer.channel_strip(index)._invert_mute_feedback = True #This makes it so that when a track is muted, the corresponding button is turned off
self.song().view.selected_track = self._mixer.channel_strip(0)._track #set the selected strip to the first track, so that we don't, for example, try to assign a button to arm the master track, which would cause an assertion error
self._send_reset = ResetSendsComponent(self) #This creates a custom MonoComponent that allows us to reset all the sends on a track to zero with a single button
self._send_reset.name = 'Sends_Reset' #We name it so that we can access it from m4l
"""the session component represents a grid of buttons that can be used to fire, stop, and navigate clips in the session view"""
def _setup_session_control(self):
is_momentary = True
num_tracks = 8 #we are working with a 4x4 grid,
num_scenes = 4 #so the height and width are both set to 4
self._session = SessionComponent(num_tracks, num_scenes) #we create our SessionComponent with the variables we set above it
self._session.name = "Session" #we name it so we can access it in m4l
self._session.set_offsets(0, 0) #we set the initial offset to the far left, top of the session grid
self._session._track_banking_increment = 4
self._session.set_stop_clip_value(STOP_CLIP[self._rgb]) #we assign the colors that will be displayed when the stop_clip button is pressed. This value comes from CNTRLR_Map.py, which is imported in the header of our script
self._scene = [None for index in range(4)] #we create an array to hold the Scene subcomponents so that we can get to them if we need them.
for row in range(num_scenes): #now we'll fill the array with different objects that were created when we called the SessionComponent() module
self._scene[row] = self._session.scene(row) #each session row is a SceneComponent
self._scene[row].name = 'Scene_' + str(row) #name it so we can access it in m4l
for column in range(num_tracks): #now we'll create holders and names for the contents of each scene
clip_slot = self._scene[row].clip_slot(column) #we use our assignment of the scene above to gain access to the individual clipslots. Here, we are just assigning 'clip_slot' each time as a local variable so we can manipulated it's properties
clip_slot.name = str(column) + '_Clip_Slot' + str(row) #name it so that we can acces it in m4l
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(CLIP_STARTED[self._rgb]) #set its started color
clip_slot.set_recording_value(CLIP_RECORDING[self._rgb]) #set its recording value
self._session.set_mixer(self._mixer) #now we link the MixerComponent we created in _setup_mixer_control() to our session component so that they will follow each other when either is navigated
self.set_highlighting_session_component(self._session)
self._session_zoom = SessionZoomingComponent(self._session) #this creates the ZoomingComponent that allows navigation when the shift button is pressed
self._session_zoom.name = 'Session_Overview' #name it so we can access it in m4l
self._session_zoom.set_stopped_value(ZOOM_STOPPED[self._rgb]) #set the zooms stopped color
self._session_zoom.set_playing_value(ZOOM_PLAYING[self._rgb]) #set the zooms playing color
self._session_zoom.set_selected_value(ZOOM_SELECTED[self._rgb]) #set the zooms selected color
self._session_zoom.set_button_matrix(self._matrix) #assign the ButtonMatrixElement that we created in _setup_controls() to the zooming component so that we can control it
self._session_zoom.set_zoom_button(self._button[31]) #assign a shift button so that we can switch states between the SessionComponent and the SessionZoomingComponent
"""this section is used so that we can reassign the color properties of each state. Legacy, from the OhmModes script, to support either RGB or Monochrome"""
def _assign_session_colors(self):
num_tracks = 8
num_scenes = 4
self._session.set_stop_clip_value(STOP_ALL[self._rgb])
for row in range(num_scenes):
for column in range(num_tracks):
self._scene[row].clip_slot(column).set_triggered_to_play_value(CLIP_TRG_PLAY[self._rgb])
self._scene[row].clip_slot(column).set_triggered_to_record_value(CLIP_TRG_REC[self._rgb])
self._scene[row].clip_slot(column).set_stopped_value(CLIP_STOP[self._rgb])
self._scene[row].clip_slot(column).set_started_value(CLIP_STARTED[self._rgb])
self._scene[row].clip_slot(column).set_recording_value(CLIP_RECORDING[self._rgb])
self._session_zoom.set_stopped_value(ZOOM_STOPPED[self._rgb])
self._session_zoom.set_playing_value(ZOOM_PLAYING[self._rgb])
self._session_zoom.set_selected_value(ZOOM_SELECTED[self._rgb])
self.refresh_state()
def deassign_live_controls(self, *a, **k):
for index in range(4):
self._encoder[index].send_value(0, True)
self._encoder[index].clear_send_cache()
self._mixer.channel_strip(index+4).set_volume_control(None) #Since we gave our mixer 4 tracks above, we'll now assign our fader controls to it #for the left side of the mixer
self._mixer.channel_strip(index+4).set_solo_button(None) #remove the solo button assignments
self._mixer.channel_strip(index+4).set_arm_button(None) #remove the arm button assignments
self._mixer.channel_strip(index+4).set_mute_button(None) #remove the mute button assignments
self._mixer.channel_strip(index+4).set_select_button(None) #remove the select button assignments
#self._alt_device_navigator.set_arrange_session_toggle_button(None)
self._alt_device_navigator.set_device_clip_toggle_button(None)
self._alt_device_navigator.set_detail_toggle_button(None)
#.........这里部分代码省略.........
示例14: LemurPad
# 需要导入模块: from _Framework.SessionZoomingComponent import SessionZoomingComponent [as 别名]
# 或者: from _Framework.SessionZoomingComponent.SessionZoomingComponent import set_selected_value [as 别名]
#.........这里部分代码省略.........
self._pedal = [None for index in range(8)]
if self._use_pedal is True:
for index in range(8):
self._pedal[index] = EncoderElement(MIDI_CC_TYPE, 0, 25+index, Live.MidiMap.MapMode.absolute)
self._pedal[index].name = 'Pedal_'+str(index)
self._pedal[index]._report = False
def _setup_session_control(self):
is_momentary = True
num_tracks = 4
num_scenes = 5
self._session = NameServerSessionComponent(num_tracks, num_scenes, self)
self._session.name = "Left_Session"
self._session.set_offsets(0, 0)
self._session.set_stop_clip_value(self._color_defs['STOP_CLIP'])
self._scene = [None for index in range(5)]
for row in range(num_scenes):
self._scene[row] = self._session.scene(row)
self._scene[row].name = 'L_Scene_' + str(row)
for column in range(num_tracks):
clip_slot = self._scene[row].clip_slot(column)
clip_slot.name = str(column) + '_Clip_Slot_L_' + str(row)
clip_slot.set_triggered_to_play_value(self._color_defs['CLIP_TRG_PLAY'])
clip_slot.set_triggered_to_record_value(self._color_defs['CLIP_TRG_REC'])
clip_slot.set_stopped_value(self._color_defs['CLIP_STOP'])
clip_slot.set_started_value(self._color_defs['CLIP_STARTED'])
clip_slot.set_recording_value(self._color_defs['CLIP_RECORDING'])
self._session.set_mixer(self._mixer)
self._session_zoom = SessionZoomingComponent(self._session)
self._session_zoom.name = 'L_Session_Overview'
self._session_zoom.set_stopped_value(self._color_defs['ZOOM_STOPPED'])
self._session_zoom.set_playing_value(self._color_defs['ZOOM_PLAYING'])
self._session_zoom.set_selected_value(self._color_defs['ZOOM_SELECTED'])
self._session_zoom._zoom_button = (self._dummy_button)
self._session_zoom.set_enabled(True)
self._session2 = SessionComponent(num_tracks, num_scenes)
self._session2.name = 'Right_Session'
self._session2.set_offsets(4, 0)
self._session2.set_stop_clip_value(self._color_defs['STOP_CLIP'])
self._scene2 = [None for index in range(5)]
for row in range(num_scenes):
self._scene2[row] = self._session2.scene(row)
self._scene2[row].name = 'R_Scene_' + str(row)
for column in range(num_tracks):
clip_slot = self._scene2[row].clip_slot(column)
clip_slot.name = str(column) + '_Clip_Slot_R_' + str(row)
clip_slot.set_triggered_to_play_value(self._color_defs['CLIP_TRG_PLAY'])
clip_slot.set_triggered_to_record_value(self._color_defs['CLIP_TRG_REC'])
clip_slot.set_stopped_value(self._color_defs['CLIP_STOP'])
clip_slot.set_started_value(self._color_defs['CLIP_STARTED'])
clip_slot.set_recording_value(self._color_defs['CLIP_RECORDING'])
self._session2.set_mixer(self._mixer2)
self._session2.add_offset_listener(self._on_session_offset_changes)
self._session_zoom2 = SessionZoomingComponent(self._session2)
self._session_zoom2.name = 'R_Session_Overview'
self._session_zoom2.set_stopped_value(self._color_defs['ZOOM_STOPPED'])
self._session_zoom2.set_playing_value(self._color_defs['ZOOM_PLAYING'])
self._session_zoom2.set_selected_value(self._color_defs['ZOOM_SELECTED'])
self._session_zoom.set_enabled(True)
self._session_zoom2._zoom_button = (self._dummy_button2)
self._session_main = SessionComponent(8, num_scenes)
self._session_main.name = 'Main_Session'
self._session_main.set_stop_clip_value(self._color_defs['STOP_CLIP'])
self._scene_main = [None for index in range(5)]
for row in range(num_scenes):
示例15: OhmModes
# 需要导入模块: from _Framework.SessionZoomingComponent import SessionZoomingComponent [as 别名]
# 或者: from _Framework.SessionZoomingComponent.SessionZoomingComponent import set_selected_value [as 别名]
#.........这里部分代码省略.........
session = SessionComponent(num_tracks, num_scenes)
session.name = 'Session'
self._session = session
session.set_offsets(0, 0)
self._scene = [ None for index in range(6) ]
for row in range(num_scenes):
self._scene[row] = session.scene(row)
self._scene[row].name = 'Scene_' + str(row)
for column in range(num_tracks):
clip_slot = self._scene[row].clip_slot(column)
clip_slot.name = str(column) + '_Clip_Slot_' + str(row)
session.set_mixer(self._mixer)
session.set_show_highlight(True)
self._session_zoom = SessionZoomingComponent(session)
self._session_zoom.name = 'Session_Overview'
self.set_highlighting_session_component(self._session)
def _assign_session_colors(self):
self.log_message('assign session colors')
num_tracks = 7
num_scenes = 5
self._session.set_stop_track_clip_value(STOP_CLIP_COLOR[self._rgb])
for row in range(num_scenes):
for column in range(num_tracks):
self._scene[row].clip_slot(column).set_triggered_to_play_value(CLIP_TRIGD_TO_PLAY_COLOR[self._rgb])
self._scene[row].clip_slot(column).set_triggered_to_record_value(CLIP_TRIGD_TO_RECORD_COLOR[self._rgb])
self._scene[row].clip_slot(column).set_stopped_value(CLIP_STOPPED_COLOR[self._rgb])
self._scene[row].clip_slot(column).set_started_value(CLIP_STARTED_COLOR[self._rgb])
self._scene[row].clip_slot(column).set_recording_value(CLIP_RECORDING_COLOR[self._rgb])
self._session_zoom.set_stopped_value(ZOOM_STOPPED_COLOR[self._rgb])
self._session_zoom.set_playing_value(ZOOM_PLAYING_COLOR[self._rgb])
self._session_zoom.set_selected_value(ZOOM_SELECTED_COLOR[self._rgb])
for row in range(8):
for column in range(8):
self._grid[column][row].set_force_next_value()
self._session.on_scene_list_changed()
self._shift_mode.update()
def _setup_device_control(self):
self._device = DeviceComponent()
self._device.name = 'Device_Component'
self.set_device_component(self._device)
self._device_navigator = DetailViewControllerComponent()
self._device_navigator.name = 'Device_Navigator'
self._device_selection_follows_track_selection = FOLLOW
def device_follows_track(self, val):
self._device_selection_follows_track_selection = val == 1
return self
def _setup_crossfader(self):
self._mixer.set_crossfader_control(self._crossfader)
def disconnect(self):
"""clean things up on disconnect"""
self.song().view.remove_selected_track_listener(self._update_selected_device)
self.log_message(time.strftime('%d.%m.%Y %H:%M:%S', time.localtime()) + '--------------= OhmModes log closed =--------------')
ControlSurface.disconnect(self)
def _get_num_tracks(self):
return self.num_tracks
def flash(self):