本文整理汇总了Python中ConfigurableButtonElement.ConfigurableButtonElement类的典型用法代码示例。如果您正苦于以下问题:Python ConfigurableButtonElement类的具体用法?Python ConfigurableButtonElement怎么用?Python ConfigurableButtonElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ConfigurableButtonElement类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, c_instance):
ControlSurface.__init__(self, c_instance)
with self.component_guard():
self._suppress_send_midi = True
self._suppress_session_highlight = True
is_momentary = True
self._suggested_input_port = 'Launchpad'
self._suggested_output_port = 'Launchpad'
self._control_is_with_automap = False
self._user_byte_write_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 0, 16)
self._user_byte_write_button.name = 'User_Byte_Button'
self._user_byte_write_button.send_value(1)
self._user_byte_write_button.add_value_listener(self._user_byte_value)
self._wrote_user_byte = False
self._challenge = Live.Application.get_random_int(0, 400000000) & 2139062143
matrix = ButtonMatrixElement()
matrix.name = 'Button_Matrix'
for row in range(8):
button_row = []
for column in range(8):
button = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, row * 16 + column)
button.name = str(column) + '_Clip_' + str(row) + '_Button'
button_row.append(button)
matrix.add_row(tuple(button_row))
self._config_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 0, 0, optimized_send_midi=False)
self._config_button.add_value_listener(self._config_value)
top_buttons = [ ConfigurableButtonElement(is_momentary, MIDI_CC_TYPE, 0, 104 + index) for index in range(8) ]
side_buttons = [ ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, SIDE_NOTES[index]) for index in range(8) ]
top_buttons[0].name = 'Bank_Select_Up_Button'
top_buttons[1].name = 'Bank_Select_Down_Button'
top_buttons[2].name = 'Bank_Select_Left_Button'
top_buttons[3].name = 'Bank_Select_Right_Button'
top_buttons[4].name = 'Session_Button'
top_buttons[5].name = 'User1_Button'
top_buttons[6].name = 'User2_Button'
top_buttons[7].name = 'Mixer_Button'
side_buttons[0].name = 'Vol_Button'
side_buttons[1].name = 'Pan_Button'
side_buttons[2].name = 'SndA_Button'
side_buttons[3].name = 'SndB_Button'
side_buttons[4].name = 'Stop_Button'
side_buttons[5].name = 'Trk_On_Button'
side_buttons[6].name = 'Solo_Button'
side_buttons[7].name = 'Arm_Button'
self._selector = MainSelectorComponent(matrix, tuple(top_buttons), tuple(side_buttons), self._config_button, self)
self._selector.name = 'Main_Modes'
self._do_combine()
for control in self.controls:
if isinstance(control, ConfigurableButtonElement):
control.add_value_listener(self._button_value)
self.set_highlighting_session_component(self._selector.session_component())
self._suppress_session_highlight = False
#self.set_suppress_rebuild_requests(False)
self.log_message("LaunchPad95 Loaded !")
示例2: __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
is_momentary = True
self._suggested_input_port = "Launchpad"
self._suggested_output_port = "Launchpad"
self._control_is_with_automap = False
self._user_byte_write_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 0, 16)
self._user_byte_write_button.name = "User_Byte_Button"
self._user_byte_write_button.send_value(1)
self._user_byte_write_button.add_value_listener(self._user_byte_value)
self._wrote_user_byte = False
self._challenge = (Live.Application.get_random_int(0, 400000000) & 2139062143)
matrix = ButtonMatrixElement()
matrix.name = "Button_Matrix"
for row in range(8):
button_row = []
for column in range(8):
button = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, ((row * 16) + column))
button.name = (((str(column) + "_Clip_") + str(row)) + "_Button")
button_row.append(button)
matrix.add_row(tuple(button_row))
self._config_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 0, 0)
self._config_button.add_value_listener(self._config_value)
top_buttons = [ ConfigurableButtonElement(is_momentary, MIDI_CC_TYPE, 0, (104 + index)) for index in range(8) ]
side_buttons = [ ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, SIDE_NOTES[index]) for index in range(8) ]
top_buttons[0].name = "Bank_Select_Up_Button"
top_buttons[1].name = "Bank_Select_Down_Button"
top_buttons[2].name = "Bank_Select_Left_Button"
top_buttons[3].name = "Bank_Select_Right_Button"
top_buttons[4].name = "Session_Button"
top_buttons[5].name = "User1_Button"
top_buttons[6].name = "User2_Button"
top_buttons[7].name = "Mixer_Button"
side_buttons[0].name = "Vol_Button"
side_buttons[1].name = "Pan_Button"
side_buttons[2].name = "SndA_Button"
side_buttons[3].name = "SndB_Button"
side_buttons[4].name = "Stop_Button"
side_buttons[5].name = "Trk_On_Button"
side_buttons[6].name = "Solo_Button"
side_buttons[7].name = "Arm_Button"
self._selector = MainSelectorComponent(matrix, tuple(top_buttons), tuple(side_buttons), self._config_button, self)
self._selector.name = "Main_Modes"
for control in self.controls:
if isinstance(control, ConfigurableButtonElement):
control.add_value_listener(self._button_value)
self._suppress_session_highlight = False
self.set_suppress_rebuild_requests(False)
self.log_message("LaunchPad85 Loaded !")
示例3: create_configurable_button
def create_configurable_button(identifier, name, send_channel_offset=0, identifier_send_offset=0, send_msg_type=None):
button = ConfigurableButtonElement(
IS_MOMENTARY,
MIDI_CC_TYPE,
GLOBAL_CHANNEL,
identifier,
GLOBAL_SEND_CHANNEL + send_channel_offset,
identifier_send_offset,
send_msg_type,
)
button.name = name
return button
示例4: _setup_controls
def _setup_controls(self):
self._left_button = create_button(99, "Left_Button")
self._right_button = create_button(100, "Right_Button")
self._up_button = create_button(101, "Up_Button")
self._down_button = create_button(102, "Down_Button")
self._loop_button = create_button(113, "Loop_Button")
self._rwd_button = create_button(114, "Rwd_Button")
self._ffwd_button = create_button(115, "FFwd_Button")
self._stop_button = create_button(116, "Stop_Button")
self._play_button = create_button(117, "Play_Button")
self._rec_button = create_button(118, "Record_Button")
self._select_button = ConfigurableButtonElement(IS_MOMENTARY, MIDI_CC_TYPE, GLOBAL_CHANNEL, 98)
self._select_button.name = "Select_Button"
self._select_button.add_value_listener(self._select_button_value)
self._main_group_hyper_button = create_configurable_button(104, "Fader_Group_HyperControl_Button", 2, 14)
self._main_group_track_button = create_configurable_button(105, "Main_Group_Track_Button", 2, 11)
self._main_group_fx_button = create_configurable_button(106, "Main_Group_Inst_FX_Button", 2, 11)
self._identify_button = create_configurable_button(97, "Identify_Button", 2, 16)
self._identify_button.add_value_listener(self._identify_value)
self._fader_buttons = []
for index in range(8):
self._fader_buttons.append(create_configurable_button(49 + index, "Fader_Button_%d" % index))
self._fader_buttons[-1].add_value_listener(self._fader_button_value, identify_sender=True)
self._faders = []
for index in range(8):
self._faders.append(create_slider(33 + index, "Fader_%d" % index))
self._faders[-1].add_value_listener(self._fader_value, identify_sender=True)
self._master_fader_button = create_configurable_button(57, "Master_Fader_Button")
self._master_fader_button.add_value_listener(self._fader_button_value, identify_sender=True)
self._master_fader = create_slider(41, "Master_Fader")
self._master_fader.add_value_listener(self._fader_value, identify_sender=True)
self._fader_group_mode_button = create_configurable_button(61, "Fader_Group_Mode_Button")
self._fader_group_midi_button = create_configurable_button(60, "Fader_Group_MIDI_Button")
self._fader_group_midi_button.add_value_listener(self._midi_button_value, identify_sender=True)
self._fader_group_mix_button = create_configurable_button(58, "Fader_Group_Mix_Button", 0, 1)
self._fader_group_mix_button.add_value_listener(self._hyper_button_value, identify_sender=True)
self._fader_group_fx_button = create_configurable_button(59, "Fader_Group_Inst_FX_Button", 0, -1)
self._fader_group_fx_button.add_value_listener(self._hyper_button_value, identify_sender=True)
self._encoders = []
for index in range(8):
self._encoders.append(create_encoder(17 + index, "Encoder_%d" % index))
self._encoders[-1].add_value_listener(self._encoder_value, identify_sender=True)
self._encoder_group_midi_button = create_configurable_button(27, "Encoder_Group_MIDI_Button", 0, 72)
self._encoder_group_midi_button.add_value_listener(self._midi_button_value, identify_sender=True)
self._encoder_group_mix_button = create_configurable_button(25, "Encoder_Group_Mix_Button", 0, 72)
self._encoder_group_mix_button.add_value_listener(self._hyper_button_value, identify_sender=True)
self._encoder_group_fx_button = create_configurable_button(26, "Encoder_Group_Inst_FX_Button", 0, 72)
self._encoder_group_fx_button.add_value_listener(self._hyper_button_value, identify_sender=True)
示例5: __init__
def __init__(self, c_instance):
ControlSurface.__init__(self, c_instance)
with self.component_guard():
#self.set_suppress_rebuild_requests(True)
self._suppress_send_midi = True
self._suppress_session_highlight = True
is_momentary = True
self._suggested_input_port = "Launchpad"
self._suggested_output_port = "Launchpad"
self._control_is_with_automap = False
self._user_byte_write_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 0, 16)
self._user_byte_write_button.name = "User_Byte_Button"
self._user_byte_write_button.send_value(1)
self._user_byte_write_button.add_value_listener(self._user_byte_value)
self._wrote_user_byte = False
self._challenge = (Live.Application.get_random_int(0, 400000000) & 2139062143)
matrix = ButtonMatrixElement()
matrix.name = "Button_Matrix"
""" TRACKFINDER TEST
track_index = 0
for track in self.song().tracks:
if track_index < 8:
button_row = []
if track.is_foldable:
for column in range(8):
log("right one: " + str(track_index))
button = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, ((track_index * 16) + column)) #@UndefinedVariable
button.name = (((str(column) + "_Clip_") + str(track_index)) + "_Button")
button_row.append(button)
track_index = track_index + 1
else:
for column in range(8):
log("wrong one: " + str(track_index))
button = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 99, True) #@UndefinedVariable
button.name = (str(column) + "_Clip_Button-DUMMY")
button_row.append(button)
matrix.add_row(tuple(button_row))
log("done")"""
""" ORIGINAL CODE """
for row in range(8):
button_row = []
for column in range(8):
button = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, ((row * 16) + column))
button.name = (((str(column) + "_Clip_") + str(row)) + "_Button")
button_row.append(button)
matrix.add_row(tuple(button_row))
self._config_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 0, 0, optimized_send_midi=False)
self._config_button.add_value_listener(self._config_value)
top_buttons = [ ConfigurableButtonElement(is_momentary, MIDI_CC_TYPE, 0, (104 + index)) for index in range(8) ]
side_buttons = [ ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, SIDE_NOTES[index]) for index in range(8) ]
top_buttons[0].name = "Bank_Select_Up_Button"
top_buttons[1].name = "Bank_Select_Down_Button"
top_buttons[2].name = "Bank_Select_Left_Button"
top_buttons[3].name = "Bank_Select_Right_Button"
top_buttons[4].name = "Session_Button"
top_buttons[5].name = "User1_Button"
top_buttons[6].name = "User2_Button"
top_buttons[7].name = "Mixer_Button"
side_buttons[0].name = "Vol_Button"
side_buttons[1].name = "Pan_Button"
side_buttons[2].name = "SndA_Button"
side_buttons[3].name = "SndB_Button"
side_buttons[4].name = "Stop_Button"
side_buttons[5].name = "Trk_On_Button"
side_buttons[6].name = "Solo_Button"
side_buttons[7].name = "Arm_Button"
self._selector = MainSelectorComponent(matrix, tuple(top_buttons), tuple(side_buttons), self._config_button)
self._selector.name = "Main_Modes"
for control in self.controls:
if isinstance(control, ConfigurableButtonElement):
control.add_value_listener(self._button_value)
self.set_highlighting_session_component(self._selector.session_component())
self._suppress_session_highlight = False
示例6: init
def init(self):
#skip init if already done.
if self._init_done:
return
self._init_done = True
# second part of the __init__ after model has been identified using its challenge response
if self._mk2_rgb:
from SkinMK2 import make_skin
self._skin = make_skin()
self._side_notes = (89, 79, 69, 59, 49, 39, 29, 19)
#self._drum_notes = (20, 30, 31, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126)
self._drum_notes = (20, 30, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126)
else:
from SkinMK1 import make_skin
self._skin = make_skin()
self._side_notes = (8, 24, 40, 56, 72, 88, 104, 120)
self._drum_notes = (41, 42, 43, 44, 45, 46, 47, 57, 58, 59, 60, 61, 62, 63, 73, 74, 75, 76, 77, 78, 79, 89, 90, 91, 92, 93, 94, 95, 105, 106, 107)
with self.component_guard():
is_momentary = True
self._config_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 0, 0, optimized_send_midi=False)
self._config_button.add_value_listener(self._config_value)
self._user_byte_write_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 0, 16)
self._user_byte_write_button.name = 'User_Byte_Button'
self._user_byte_write_button.send_value(1)
self._user_byte_write_button.add_value_listener(self._user_byte_value)
matrix = ButtonMatrixElement()
matrix.name = 'Button_Matrix'
for row in range(8):
button_row = []
for column in range(8):
if self._mk2_rgb:
# for mk2 buttons are assigned "top to bottom"
midi_note = (81 - (10 * row)) + column
else:
midi_note = row * 16 + column
button = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, midi_note, skin = self._skin, control_surface = self)
button.name = str(column) + '_Clip_' + str(row) + '_Button'
button_row.append(button)
matrix.add_row(tuple(button_row))
top_buttons = [ConfigurableButtonElement(is_momentary, MIDI_CC_TYPE, 0, 104 + index, skin = self._skin) for index in range(8)]
side_buttons = [ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, self._side_notes[index], skin = self._skin) for index in range(8)]
top_buttons[0].name = 'Bank_Select_Up_Button'
top_buttons[1].name = 'Bank_Select_Down_Button'
top_buttons[2].name = 'Bank_Select_Left_Button'
top_buttons[3].name = 'Bank_Select_Right_Button'
top_buttons[4].name = 'Session_Button'
top_buttons[5].name = 'User1_Button'
top_buttons[6].name = 'User2_Button'
top_buttons[7].name = 'Mixer_Button'
side_buttons[0].name = 'Vol_Button'
side_buttons[1].name = 'Pan_Button'
side_buttons[2].name = 'SndA_Button'
side_buttons[3].name = 'SndB_Button'
side_buttons[4].name = 'Stop_Button'
side_buttons[5].name = 'Trk_On_Button'
side_buttons[6].name = 'Solo_Button'
side_buttons[7].name = 'Arm_Button'
self._osd = M4LInterface()
self._osd.name = "OSD"
self._selector = MainSelectorComponent(matrix, tuple(top_buttons), tuple(side_buttons), self._config_button, self._osd, self)
self._selector.name = 'Main_Modes'
self._do_combine()
for control in self.controls:
if isinstance(control, ConfigurableButtonElement):
control.add_value_listener(self._button_value)
self.set_highlighting_session_component(self._selector.session_component())
self._suppress_session_highlight = False
# due to our 2 stage init, we need to rebuild midi map
self.request_rebuild_midi_map()
# and request update
self._selector.update()
if self._mk2_rgb:
self.log_message("LaunchPad95 (mk2) Loaded !")
else:
self.log_message("LaunchPad95 Loaded !")
示例7: __init__
def __init__(self, c_instance):
ControlSurface.__init__(self, c_instance)
with self.component_guard(): # this line allows you to instanciate framework classes
is_momentary = True # all our controlls will be momentary
self._suggested_input_port = 'px700'
self._suggested_output_port = 'px700'
"definition of buttons represented by the keyboard notes"
launch_buttons = [] # row of buttons launching the clips of a track
for index in range(16):
button = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, index)
button.name = '_Clip_' + str(index) + '_Button'
launch_buttons.append(button)
"buttons A, B, C, D are the buttons choosing he mode"
mode_buttons = [ ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 16+index) for index in range(4) ]
mode_buttons[0].name = 'A_mode'
mode_buttons[1].name = 'B_mode'
mode_buttons[2].name = 'C_mode'
mode_buttons[3].name = 'D_mode'
"pad controls definition"
select_button = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 20)
select_button.name = '_Select_Button'
translate_button = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 21)
translate_button.name = '_Translate_Button'
mute_button = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 22)
mute_button.name = '_Mute_Button'
solo_button = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 23)
solo_button.name = '_Solo_Button'
copy_button = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 28)
copy_button.name = '_Copy_Button'
erase_button = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 29)
erase_button.name = '_Erase_Button'
rewind_button = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 36)
rewind_button.name = '_Rewind_Button'
forward_button = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 37)
forward_button.name = '_Forward_Button'
"pads definition"
pads = []
for index in range(8):
pad = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 60+index)
pad.name = '_Clip_' + str(index) + '_Button'
pads.append(pad)
"transport buttons"
transport_buttons = []
for index in range(4):
button = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 24+index)
button.name = '_Transport_Button_'+str(index)
transport_buttons.append(button)
"knobs definition"
tempo_control = EncoderElement(MIDI_CC_TYPE, 0, 48, Live.MidiMap.MapMode.relative_binary_offset)
tempo_control.name = "_Tempo_controller_"
volume_control = EncoderElement(MIDI_CC_TYPE, 0, 47, Live.MidiMap.MapMode.relative_binary_offset)
tempo_control.name = "_Volume_controller_"
param_controls = []
for index in range(3):
control = EncoderElement(MIDI_CC_TYPE, 0, 49+index, Live.MidiMap.MapMode.relative_binary_offset)
control.name = "_Param_"+str(index)+"_control"
param_controls.append(control)
"browser knob definition"
browser_control = EncoderElement(MIDI_CC_TYPE, 0, 54, Live.MidiMap.MapMode.relative_binary_offset)
browser_control.name = "_Browser_controller_"
"browser button definition"
browser_button = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 56)
browser_button.name = "_Browser_button_"
"pattern leds definition"
pattern_leds = []
for index in range(4):
led = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 41+index)
led.name = str(index) + 'Pattern_Led'
pattern_leds.append(led)
"divide knob definition"
divide_control = EncoderElement(MIDI_CC_TYPE, 0, 52, Live.MidiMap.MapMode.relative_binary_offset)
divide_control.name = "_divide_controller_"
"move knob definition"
move_control = EncoderElement(MIDI_CC_TYPE, 0, 53, Live.MidiMap.MapMode.relative_binary_offset)
move_control.name = "_move_controller_"
"track leds definition"
track_leds = []
for index in range(8):
led = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 68+index)
led.name = str(index) + 'Track_Led'
track_leds.append(led)
self._selector = MainSelectorComponent(tuple(launch_buttons), tuple(mode_buttons), tuple(pads), tuple(transport_buttons), select_button, translate_button, mute_button, solo_button, tempo_control, volume_control, tuple(param_controls), copy_button, erase_button, rewind_button, forward_button, browser_control, browser_button, tuple(pattern_leds), tuple(track_leds), divide_control, move_control, self)
self._selector.name = 'Main_Modes'
self.set_highlighting_session_component(self._selector._session)
self.log_message("SparkLE Loaded !")
示例8: __init__
def __init__(self, c_instance):
live = Live.Application.get_application()
self._live_major_version = live.get_major_version()
self._live_minor_version = live.get_minor_version()
self._live_bugfix_version = live.get_bugfix_version()
self._mk2 = Settings.DEVICE == 'Launchpad mk2'
if self._mk2:
self._skin = Skin('Launchpad mk2')
self._side_notes = (89, 79, 69, 59, 49, 39, 29, 19)
self._drum_notes = (20, 30, 31, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126)
else:
self._skin = Skin('Launchpad')
self._side_notes = (8, 24, 40, 56, 72, 88, 104, 120)
self._drum_notes = (41, 42, 43, 44, 45, 46, 47, 57, 58, 59, 60, 61, 62, 63, 73, 74, 75, 76, 77, 78, 79, 89, 90, 91, 92, 93, 94, 95, 105, 106, 107)
ControlSurface.__init__(self, c_instance)
with self.component_guard():
self._suppress_send_midi = True
self._suppress_session_highlight = True
is_momentary = True
if self._mk2:
self._suggested_input_port = 'Launchpad'
self._suggested_output_port = 'Launchpad'
else:
self._suggested_input_port = 'Launchpad MK2'
self._suggested_output_port = 'Launchpad MK2'
self._control_is_with_automap = False
self._user_byte_write_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 0, 16)
self._user_byte_write_button.name = 'User_Byte_Button'
self._user_byte_write_button.send_value(1)
self._user_byte_write_button.add_value_listener(self._user_byte_value)
self._wrote_user_byte = False
self._challenge = Live.Application.get_random_int(0, 400000000) & 2139062143
matrix = ButtonMatrixElement()
matrix.name = 'Button_Matrix'
for row in range(8):
button_row = []
for column in range(8):
if self._mk2:
# for mk2 buttons are assigned "top to bottom"
midi_note = (81 - (10 * row)) + column
else:
midi_note = row * 16 + column
button = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, midi_note, self._skin.off)
button.name = str(column) + '_Clip_' + str(row) + '_Button'
button_row.append(button)
matrix.add_row(tuple(button_row))
self._config_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 0, 0, optimized_send_midi=False)
self._config_button.add_value_listener(self._config_value)
top_buttons = [ConfigurableButtonElement(is_momentary, MIDI_CC_TYPE, 0, 104 + index, self._skin.off) for index in range(8)]
side_buttons = [ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, self._side_notes[index], self._skin.off) for index in range(8)]
top_buttons[0].name = 'Bank_Select_Up_Button'
top_buttons[1].name = 'Bank_Select_Down_Button'
top_buttons[2].name = 'Bank_Select_Left_Button'
top_buttons[3].name = 'Bank_Select_Right_Button'
top_buttons[4].name = 'Session_Button'
top_buttons[5].name = 'User1_Button'
top_buttons[6].name = 'User2_Button'
top_buttons[7].name = 'Mixer_Button'
side_buttons[0].name = 'Vol_Button'
side_buttons[1].name = 'Pan_Button'
side_buttons[2].name = 'SndA_Button'
side_buttons[3].name = 'SndB_Button'
side_buttons[4].name = 'Stop_Button'
side_buttons[5].name = 'Trk_On_Button'
side_buttons[6].name = 'Solo_Button'
side_buttons[7].name = 'Arm_Button'
self._osd = M4LInterface()
self._osd.name = "OSD"
self._selector = MainSelectorComponent(matrix, tuple(top_buttons), tuple(side_buttons), self._config_button, self._osd, self, self._skin)
self._selector.name = 'Main_Modes'
self._do_combine()
for control in self.controls:
if isinstance(control, ConfigurableButtonElement):
control.add_value_listener(self._button_value)
self.set_highlighting_session_component(self._selector.session_component())
self._suppress_session_highlight = False
self.log_message("LaunchPad95 Loaded !")
示例9: make_launch_control_button
def make_launch_control_button(identifier, name, channel = 0, is_pad = False):
button = ConfigurableButtonElement(True, MIDI_NOTE_TYPE if is_pad else MIDI_CC_TYPE, channel, identifier)
button.name = name
button.set_on_off_values(Colors.LED_ON, Colors.LED_OFF)
return button
示例10: Axiom_AIR_25_49_61
#.........这里部分代码省略.........
self._alt_device_component.restore_bank(bank_index)
def set_appointed_device(self, device):
ControlSurface.set_appointed_device(self, device)
with self.component_guard():
if self._alt_device_component != None:
self._alt_device_component.set_device(device)
def set_alt_device_component(self, device_component):
self._alt_device_component = device_component
def _update_device_selection(self):
track = self.song().view.selected_track
device_to_select = track.view.selected_device
if device_to_select == None and len(track.devices) > 0:
device_to_select = track.devices[0]
if device_to_select != None:
self.song().view.select_device(device_to_select)
self._device_component.set_device(device_to_select)
if self._alt_device_component != None:
self._alt_device_component.set_device(device_to_select)
def _setup_controls(self):
self._left_button = create_button(99, "Left_Button")
self._right_button = create_button(100, "Right_Button")
self._up_button = create_button(101, "Up_Button")
self._down_button = create_button(102, "Down_Button")
self._loop_button = create_button(113, "Loop_Button")
self._rwd_button = create_button(114, "Rwd_Button")
self._ffwd_button = create_button(115, "FFwd_Button")
self._stop_button = create_button(116, "Stop_Button")
self._play_button = create_button(117, "Play_Button")
self._rec_button = create_button(118, "Record_Button")
self._select_button = ConfigurableButtonElement(IS_MOMENTARY, MIDI_CC_TYPE, GLOBAL_CHANNEL, 98)
self._select_button.name = "Select_Button"
self._select_button.add_value_listener(self._select_button_value)
self._main_group_hyper_button = create_configurable_button(104, "Fader_Group_HyperControl_Button", 2, 14)
self._main_group_track_button = create_configurable_button(105, "Main_Group_Track_Button", 2, 11)
self._main_group_fx_button = create_configurable_button(106, "Main_Group_Inst_FX_Button", 2, 11)
self._identify_button = create_configurable_button(97, "Identify_Button", 2, 16)
self._identify_button.add_value_listener(self._identify_value)
self._fader_buttons = []
for index in range(8):
self._fader_buttons.append(create_configurable_button(49 + index, "Fader_Button_%d" % index))
self._fader_buttons[-1].add_value_listener(self._fader_button_value, identify_sender=True)
self._faders = []
for index in range(8):
self._faders.append(create_slider(33 + index, "Fader_%d" % index))
self._faders[-1].add_value_listener(self._fader_value, identify_sender=True)
self._master_fader_button = create_configurable_button(57, "Master_Fader_Button")
self._master_fader_button.add_value_listener(self._fader_button_value, identify_sender=True)
self._master_fader = create_slider(41, "Master_Fader")
self._master_fader.add_value_listener(self._fader_value, identify_sender=True)
self._fader_group_mode_button = create_configurable_button(61, "Fader_Group_Mode_Button")
self._fader_group_midi_button = create_configurable_button(60, "Fader_Group_MIDI_Button")
self._fader_group_midi_button.add_value_listener(self._midi_button_value, identify_sender=True)
self._fader_group_mix_button = create_configurable_button(58, "Fader_Group_Mix_Button", 0, 1)
self._fader_group_mix_button.add_value_listener(self._hyper_button_value, identify_sender=True)
self._fader_group_fx_button = create_configurable_button(59, "Fader_Group_Inst_FX_Button", 0, -1)
self._fader_group_fx_button.add_value_listener(self._hyper_button_value, identify_sender=True)
self._encoders = []
for index in range(8):
self._encoders.append(create_encoder(17 + index, "Encoder_%d" % index))
self._encoders[-1].add_value_listener(self._encoder_value, identify_sender=True)
示例11: _setup_session_control
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
示例12: __init__
def __init__(self, c_instance):
ControlSurface.__init__(self, c_instance)
with self.component_guard(): # this line allows you to instanciate framework classes
is_momentary = True # all our controlls will be momentary
self._suggested_input_port = "px700"
self._suggested_output_port = "px700"
"definition of buttons represented by the keyboard notes"
select_buttons = [] # row of buttons launching the clips of a track
for index in range(10):
button = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 20 + index)
button.name = "_Clip_" + str(index) + "_Button"
select_buttons.append(button)
"buttons sound and multi are the buttons choosing he mode"
mode_buttons = [
ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 118 + index) for index in range(2)
]
mode_buttons[0].name = "Sound_Mode"
mode_buttons[1].name = "Multi_Mode"
"knobs definition"
bank1_controls = []
for index in range(10):
control = EncoderElement(MIDI_CC_TYPE, 0, 74 + index, Live.MidiMap.MapMode.relative_binary_offset)
control.name = "_Param_" + str(index) + "_control"
bank1_controls.append(control)
bank2_controls = []
for index in range(10):
control = EncoderElement(MIDI_CC_TYPE, 0, 74 + index, Live.MidiMap.MapMode.relative_binary_offset)
control.name = "_Param_" + str(index) + "_control"
bank2_controls.append(control)
bank1_faders = []
for index in range(4):
control = EncoderElement(MIDI_CC_TYPE, 0, 73 + index, Live.MidiMap.MapMode.absolute)
control.name = "_Param_" + str(index) + "_control"
bank1_faders.append(control)
for index in range(5):
control = EncoderElement(MIDI_CC_TYPE, 0, 80 + index, Live.MidiMap.MapMode.absolute)
control.name = "_Param_" + str(index) + "_control"
bank1_faders.append(control)
bank2_faders = []
for index in range(4):
control = EncoderElement(MIDI_CC_TYPE, 0, 67 + index, Live.MidiMap.MapMode.absolute)
control.name = "_Param_" + str(index) + "_control"
bank2_faders.append(control)
for index in range(5):
control = EncoderElement(MIDI_CC_TYPE, 0, 87 + index, Live.MidiMap.MapMode.absolute)
control.name = "_Param_" + str(index) + "_control"
bank2_faders.append(control)
self._selector = MainSelectorComponent(
tuple(select_buttons),
tuple(mode_buttons),
tuple(bank1_controls),
tuple(bank2_controls),
tuple(bank1_faders),
tuple(bank2_faders),
self,
)
self._selector.name = "Main_Modes"
# self.set_highlighting_session_component(self._selector._session)
self.log_message("SparkLE Loaded !")
示例13: __init__
def __init__(self, c_instance):
live = Live.Application.get_application()
self._live_major_version = live.get_major_version()
self._live_minor_version = live.get_minor_version()
self._live_bugfix_version = live.get_bugfix_version()
ControlSurface.__init__(self, c_instance)
#self._device_selection_follows_track_selection = True
with self.component_guard():
self._suppress_send_midi = True
self._suppress_session_highlight = True
is_momentary = True
self._suggested_input_port = 'Launchpad'
self._suggested_output_port = 'Launchpad'
self._control_is_with_automap = False
self._user_byte_write_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 0, 16) # Apparently this CC is used to enable feedback, ie lighting up buttons that you pressed
self._user_byte_write_button.name = 'User_Byte_Button'
self._user_byte_write_button.send_value(1)
self._user_byte_write_button.add_value_listener(self._user_byte_value)
self._wrote_user_byte = False
self._challenge = Live.Application.get_random_int(0, 400000000) & 2139062143
matrix = ButtonMatrixElement()
matrix.name = 'Button_Matrix'
for row in range(8):
button_row = []
for column in range(8):
button = ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, (7-row) * 8 + column) # APCmini rows are in reverse order from Launchpad
button.name = str(column) + '_Clip_' + str(row) + '_Button'
button_row.append(button)
matrix.add_row(tuple(button_row))
self._config_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 0, 0, optimized_send_midi=False) # Control goes through here on LP, no real equivalent in APCmini (I don't think)
self._config_button.add_value_listener(self._config_value)
top_buttons = [ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 64 + index) for index in range(8)]
side_buttons = [ConfigurableButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, SIDE_NOTES[index]) for index in range(8)]
top_buttons[0].name = 'Bank_Select_Up_Button'
top_buttons[1].name = 'Bank_Select_Down_Button'
top_buttons[2].name = 'Bank_Select_Left_Button'
top_buttons[3].name = 'Bank_Select_Right_Button'
top_buttons[4].name = 'Session_Button'
top_buttons[5].name = 'User1_Button'
top_buttons[6].name = 'User2_Button'
top_buttons[7].name = 'Mixer_Button'
side_buttons[0].name = 'Vol_Button'
side_buttons[1].name = 'Pan_Button'
side_buttons[2].name = 'SndA_Button'
side_buttons[3].name = 'SndB_Button'
side_buttons[4].name = 'Stop_Button'
side_buttons[5].name = 'Trk_On_Button'
side_buttons[6].name = 'Solo_Button'
side_buttons[7].name = 'Arm_Button'
self._osd = M4LInterface()
self._osd.name = "OSD"
self._selector = MainSelectorComponent(matrix, tuple(top_buttons), tuple(side_buttons), self._config_button, self._osd, self)
self._selector.name = 'Main_Modes'
self._do_combine()
for control in self.controls:
if isinstance(control, ConfigurableButtonElement):
control.add_value_listener(self._button_value)
self.set_highlighting_session_component(self._selector.session_component())
self._suppress_session_highlight = False
self.log_message("LaunchPad95 Loaded !")
示例14: _setup_session_control
def _setup_session_control(self):
is_momentary = True
self._shift_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 98)
self._right_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 96)
self._left_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 97)
self._up_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 94)
self._down_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 95)
self._right_button.name = 'Bank_Select_Right_button'
self._left_button.name = 'Bank_Select_Left_button'
self._up_button.name = 'Bank_Select_Up_button'
self._down_button.name = 'Bank_Select_Down_button'
self._session = PedaledSessionComponent(8, 5)
self._session.name = 'Session_Control'
self._session.set_track_bank_buttons(self._right_button, self._left_button)
self._session.set_scene_bank_buttons(self._down_button, self._up_button)
self._matrix = ButtonMatrixElement()
self._matrix.name = 'Button_Matrix'
self._scene_launch_buttons = [ ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, index + 82) for index in range(5) ]
self._track_stop_buttons = [ ConfigurableButtonElement(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(self._track_stop_buttons)):
self._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(self._track_stop_buttons))
self._session.set_stop_clip_value(0)
self._session.set_stop_clip_triggered_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(self._scene_launch_buttons[scene_index])
scene.set_triggered_value(2)
for track_index in range(8):
button = ConfigurableButtonElement(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)
self._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 = ShiftableZoomingComponent(self._session, tuple(self._track_stop_buttons))
self._session_zoom.name = 'Session_Overview'
self._session_zoom.set_button_matrix(self._matrix)
self._session_zoom.set_zoom_button(self._shift_button)
self._session_zoom.set_nav_buttons(self._up_button, self._down_button, self._left_button, self._right_button)
self._session_zoom.set_scene_bank_buttons(tuple(self._scene_launch_buttons))
self._session_zoom.set_stopped_value(3)
self._session_zoom.set_selected_value(5)