def _create_controls(self): make_color_button = partial(make_button, skin=self._skin) self._shift_button = make_button(0, 81, name='Shift_Button') self._matrix = ButtonMatrixElement(name='Button_Matrix') self._scene_launch_buttons = [ make_color_button(0, index + 82, name='Scene_%d_Launch_Button' % index) for index in xrange(SESSION_HEIGHT) ] self._track_stop_buttons = [ make_color_button(index, 52, name='Track_%d_Stop_Button' % index) for index in xrange(SESSION_WIDTH) ] for scene_index in xrange(SESSION_HEIGHT): row = [ make_color_button(track_index, scene_index + 53, name='%d_Clip_%d_Button' % (track_index, scene_index)) for track_index in xrange(SESSION_WIDTH) ] self._matrix.add_row(row) self._selected_scene_launch_button = make_pedal_button(64, name='Selected_Scene_Launch_Button') self._scene_launch_buttons = ButtonMatrixElement(name='Scene_Launch_Buttons', rows=[self._scene_launch_buttons]) self._solo_buttons = [ make_button(track_index, 49, name='%d_Solo_Button' % track_index) for track_index in xrange(MIXER_SIZE) ] self._mute_buttons = [ make_button(track_index, 50, name='%d_Mute_Button' % track_index) for track_index in xrange(MIXER_SIZE) ] self._master_volume_control = make_slider(0, 14, name='Master_Volume_Control') self._prehear_control = EncoderElement(MIDI_CC_TYPE, 0, 47, MapMode.relative_two_compliment, name='Prehear_Volume_Control') self._master_select_button = make_button(0, 80, name='Master_Select_Button') self._select_buttons = [ make_button(track_index, 51, name='%d_Select_Button' % track_index) for track_index in xrange(8) ] self._arm_buttons = [ make_button(track_index, 48, name='%d_Arm_Button' % track_index) for track_index in xrange(8) ] self._sliders = [ make_slider(track_index, 7, name='%d_Volume_Control' % track_index) for track_index in xrange(8) ] self._note_matrix = ButtonMatrixElement(name='Note_Button_Matrix') self._note_buttons = [ [ make_button(9, note + i, name='Note_%d_Button' % (note + i)) for i in xrange(4) ] for note in xrange(36, 75, 4) ] for row in self._note_buttons: for button in row: button.send_depends_on_forwarding = False self._note_matrix.add_row(row)
def _create_controls(self): make_color_button = partial(make_button, skin=self._skin) self._shift_button = make_button(0, 81, name='Shift_Button', num = 0, cs = self) self._matrix = ButtonMatrixElement(name='Button_Matrix') self._scene_launch_buttons_raw = [ make_color_button(0, index + 82, name='Scene_%d_Launch_Button' % index, num = index, cs = self) for index in xrange(SESSION_HEIGHT) ] self._track_stop_buttons = [ make_color_button(index, 52, name='Track_%d_Stop_Button' % index, num = index, cs = self) for index in xrange(SESSION_WIDTH) ] self._matrix_rows_raw = [] for scene_index in xrange(SESSION_HEIGHT): row = [ make_color_button(track_index, scene_index + 53, name='%d_Clip_%d_Button' % (track_index, scene_index), num = index, cs = self) for track_index in xrange(SESSION_WIDTH) ] self._matrix_rows_raw.append(row) self._matrix.add_row(row) self._selected_scene_launch_button = make_pedal_button(64, name='Selected_Scene_Launch_Button') self._scene_launch_buttons = ButtonMatrixElement(rows=[self._scene_launch_buttons_raw]) self._solo_buttons = [ make_button(track_index, 49, name='%d_Solo_Button' % track_index, num = track_index, cs = self) for track_index in xrange(MIXER_SIZE) ] self._mute_buttons = [ make_button(track_index, 50, name='%d_Mute_Button' % track_index, num = track_index, cs = self) for track_index in xrange(MIXER_SIZE) ] self._master_volume_control = make_slider(0, 14, name='Master_Volume_Control', num = 0, script = self) self._prehear_control = EncoderElement(MIDI_CC_TYPE, 0, 47, MapMode.relative_two_compliment, name='Prehear_Volume_Control', num = 0, script = self) self._master_select_button = make_button(0, 80, name='Master_Select_Button', num = index, cs = self) self._select_buttons = [ make_button(track_index, 51, name='%d_Select_Button' % track_index, num = track_index, cs = self ) for track_index in xrange(8) ] self._arm_buttons = [ make_button(track_index, 48, name='%d_Arm_Button' % track_index, num = track_index, cs = self) for track_index in xrange(8) ] self._sliders = [ make_slider(track_index, 7, name='%d_Volume_Control' % track_index, num = track_index, script = self) for track_index in xrange(8) ] self._monomod = ButtonMatrixElement(name = 'Monomod') for row in self._matrix_rows_raw: self._monomod.add_row(row) self._monomod.add_row(self._track_stop_buttons) self._monomod.add_row(self._select_buttons) self._monomod.add_row(self._mute_buttons) self._setup_monobridge() #had to put this here b/c the original author foolishly placed assignment methods inside of creation methods...argh.
def _create_controls(self): make_on_off_button = partial(make_button, skin=self._default_skin) def make_color_button(*a, **k): button = make_button(skin=self._color_skin, *a, **k) button.is_rgb = True button.num_delayed_messages = 2 return button def make_matrix_button(track, scene): return make_color_button(0, 32 + track - NUM_TRACKS * scene, name=u'%d_Clip_%d_Button' % (track, scene)) def make_stop_button(track): return make_button(track, 52, name=u'%d_Stop_Button' % track, skin=self._stop_button_skin) self._shift_button = make_button(0, 98, name=u'Shift_Button', resource_type=PrioritizedResource) self._bank_button = make_on_off_button(0, 103, name=u'Bank_Button') self._left_button = make_button(0, 97, name=u'Bank_Select_Left_Button') self._right_button = make_button(0, 96, name=u'Bank_Select_Right_Button') self._up_button = make_button(0, 94, name=u'Bank_Select_Up_Button') self._down_button = make_button(0, 95, name=u'Bank_Select_Down_Button') self._stop_buttons = ButtonMatrixElement( rows=[[make_stop_button(track) for track in xrange(NUM_TRACKS)]]) self._stop_all_button = make_button(0, 81, name=u'Stop_All_Clips_Button') self._scene_launch_buttons_raw = [ make_color_button(0, scene + 82, name=u'Scene_%d_Launch_Button' % scene) for scene in xrange(NUM_SCENES) ] self._scene_launch_buttons = ButtonMatrixElement( rows=[self._scene_launch_buttons_raw]) self._matrix_rows_raw = [[ make_matrix_button(track, scene) for track in xrange(NUM_TRACKS) ] for scene in xrange(NUM_SCENES)] self._session_matrix = ButtonMatrixElement(rows=self._matrix_rows_raw) self._pan_button = make_on_off_button(0, 87, name=u'Pan_Button') self._sends_button = make_on_off_button( 0, 88, name=u'Sends_Button', resource_type=PrioritizedResource) self._user_button = make_on_off_button(0, 89, name=u'User_Button') self._mixer_encoders = ButtonMatrixElement(rows=[[ make_ring_encoder( 48 + track, 56 + track, name=u'Track_Control_%d' % track) for track in xrange(NUM_TRACKS) ]]) self._volume_controls = ButtonMatrixElement(rows=[[ make_slider(track, 7, name=u'%d_Volume_Control' % track) for track in xrange(NUM_TRACKS) ]]) self._master_volume_control = make_slider( 0, 14, name=u'Master_Volume_Control') self._prehear_control = make_encoder(0, 47, name=u'Prehear_Volume_Control') self._crossfader_control = make_slider(0, 15, name=u'Crossfader') self._raw_select_buttons = [ make_on_off_button(channel, 51, name=u'%d_Select_Button' % channel) for channel in xrange(NUM_TRACKS) ] self._arm_buttons = ButtonMatrixElement(rows=[[ make_on_off_button(channel, 48, name=u'%d_Arm_Button' % channel) for channel in xrange(NUM_TRACKS) ]]) self._solo_buttons = ButtonMatrixElement(rows=[[ make_on_off_button(channel, 49, name=u'%d_Solo_Button' % channel) for channel in xrange(NUM_TRACKS) ]]) self._mute_buttons = ButtonMatrixElement(rows=[[ make_on_off_button(channel, 50, name=u'%d_Mute_Button' % channel) for channel in xrange(NUM_TRACKS) ]]) self._crossfade_buttons = ButtonMatrixElement(rows=[[ make_button(channel, 66, name=u'%d_Crossfade_Button' % channel, skin=self._crossfade_button_skin) for channel in xrange(NUM_TRACKS) ]]) self._select_buttons = ButtonMatrixElement( rows=[self._raw_select_buttons]) self._master_select_button = make_on_off_button( channel=0, identifier=80, name=u'Master_Select_Button') self._send_select_buttons = ButtonMatrixElement(rows=[[ ComboElement(button, modifiers=[self._sends_button]) for button in self._raw_select_buttons ]]) self._quantization_buttons = ButtonMatrixElement(rows=[[ ComboElement(button, modifiers=[self._shift_button]) for button in self._raw_select_buttons ]]) self._metronome_button = make_on_off_button(0, 90, name=u'Metronome_Button') self._play_button = make_on_off_button(0, 91, name=u'Play_Button') self._record_button = make_on_off_button(0, 93, name=u'Record_Button') self._session_record_button = make_on_off_button( 0, 102, name=u'Session_Record_Button') self._nudge_down_button = make_button(0, 100, name=u'Nudge_Down_Button') self._nudge_up_button = make_button(0, 101, name=u'Nudge_Up_Button') self._tap_tempo_button = make_button(0, 99, name=u'Tap_Tempo_Button') self._tempo_control = make_encoder(0, 13, name=u'Tempo_Control') self._device_controls = ButtonMatrixElement(rows=[[ make_ring_encoder( 16 + index, 24 + index, name=u'Device_Control_%d' % index) for index in xrange(8) ]]) self._device_control_buttons_raw = [ make_on_off_button(0, 58 + index) for index in xrange(8) ] self._device_bank_buttons = ButtonMatrixElement(rows=[[ DeviceBankButtonElement(button, modifiers=[self._shift_button]) for button in self._device_control_buttons_raw ]]) self._device_prev_bank_button = self._device_control_buttons_raw[2] self._device_prev_bank_button.name = u'Device_Prev_Bank_Button' self._device_next_bank_button = self._device_control_buttons_raw[3] self._device_next_bank_button.name = u'Device_Next_Bank_Button' self._device_on_off_button = self._device_control_buttons_raw[4] self._device_on_off_button.name = u'Device_On_Off_Button' self._device_lock_button = self._device_control_buttons_raw[5] self._device_lock_button.name = u'Device_Lock_Button' self._prev_device_button = self._device_control_buttons_raw[0] self._prev_device_button.name = u'Prev_Device_Button' self._next_device_button = self._device_control_buttons_raw[1] self._next_device_button.name = u'Next_Device_Button' self._clip_device_button = self._device_control_buttons_raw[6] self._clip_device_button.name = u'Clip_Device_Button' self._detail_view_button = self._device_control_buttons_raw[7] self._detail_view_button.name = u'Detail_View_Button' self._foot_pedal_button = DoublePressElement( make_pedal_button(64, name=u'Foot_Pedal')) self._shifted_matrix = ButtonMatrixElement( rows=recursive_map(self._with_shift, self._matrix_rows_raw)) self._shifted_scene_buttons = ButtonMatrixElement(rows=[[ self._with_shift(button) for button in self._scene_launch_buttons_raw ]])
def _create_controls(self): make_on_off_button = partial(make_button, skin=self._default_skin) def make_color_button(*a, **k): button = make_button(skin=self._color_skin, *a, **k) button.is_rgb = True button.num_delayed_messages = 2 return button def make_matrix_button(track, scene): return make_color_button(0, 32 + track - NUM_TRACKS * scene, name='%d_Clip_%d_Button' % (track, scene)) def make_stop_button(track): return make_button(track, 52, name='%d_Stop_Button' % track, skin=self._stop_button_skin) self._shift_button = make_button(0, 98, name='Shift_Button', resource_type=PrioritizedResource) self._bank_button = make_on_off_button(0, 103, name='Bank_Button') self._left_button = make_button(0, 97, name='Bank_Select_Left_Button') self._right_button = make_button(0, 96, name='Bank_Select_Right_Button') self._up_button = make_button(0, 94, name='Bank_Select_Up_Button') self._down_button = make_button(0, 95, name='Bank_Select_Down_Button') self._stop_buttons = ButtonMatrixElement(rows=[[ make_stop_button(track) for track in xrange(NUM_TRACKS) ]]) self._stop_all_button = make_button(0, 81, name='Stop_All_Clips_Button') self._scene_launch_buttons_raw = [ make_color_button(0, scene + 82, name='Scene_%d_Launch_Button' % scene) for scene in xrange(NUM_SCENES) ] self._scene_launch_buttons = ButtonMatrixElement(rows=[self._scene_launch_buttons_raw]) self._matrix_rows_raw = [ [ make_matrix_button(track, scene) for track in xrange(NUM_TRACKS) ] for scene in xrange(NUM_SCENES) ] self._session_matrix = ButtonMatrixElement(rows=self._matrix_rows_raw) self._pan_button = make_on_off_button(0, 87, name='Pan_Button') self._sends_button = make_on_off_button(0, 88, name='Sends_Button', resource_type=PrioritizedResource) self._user_button = make_on_off_button(0, 89, name='User_Button') self._mixer_encoders = ButtonMatrixElement(rows=[[ make_ring_encoder(48 + track, 56 + track, name='Track_Control_%d' % track) for track in xrange(NUM_TRACKS) ]]) self._volume_controls = ButtonMatrixElement(rows=[[ make_slider(track, 7, name='%d_Volume_Control' % track) for track in xrange(NUM_TRACKS) ]]) self._master_volume_control = make_slider(0, 14, name='Master_Volume_Control') self._prehear_control = make_encoder(0, 47, name='Prehear_Volume_Control') self._crossfader_control = make_slider(0, 15, name='Crossfader') self._raw_select_buttons = [ make_on_off_button(channel, 51, name='%d_Select_Button' % channel) for channel in xrange(NUM_TRACKS) ] self._arm_buttons = ButtonMatrixElement(rows=[[ make_on_off_button(channel, 48, name='%d_Arm_Button' % channel) for channel in xrange(NUM_TRACKS) ]]) self._solo_buttons = ButtonMatrixElement(rows=[[ make_on_off_button(channel, 49, name='%d_Solo_Button' % channel) for channel in xrange(NUM_TRACKS) ]]) self._mute_buttons = ButtonMatrixElement(rows=[[ make_on_off_button(channel, 50, name='%d_Mute_Button' % channel) for channel in xrange(NUM_TRACKS) ]]) self._crossfade_buttons = ButtonMatrixElement(rows=[[ make_button(channel, 66, name='%d_Crossfade_Button' % channel, skin=self._crossfade_button_skin) for channel in xrange(NUM_TRACKS) ]]) self._select_buttons = ButtonMatrixElement(rows=[self._raw_select_buttons]) self._master_select_button = make_on_off_button(channel=0, identifier=80, name='Master_Select_Button') self._send_select_buttons = ButtonMatrixElement(rows=[[ ComboElement(button, modifiers=[self._sends_button]) for button in self._raw_select_buttons ]]) self._quantization_buttons = ButtonMatrixElement(rows=[[ ComboElement(button, modifiers=[self._shift_button]) for button in self._raw_select_buttons ]]) self._metronome_button = make_on_off_button(0, 90, name='Metronome_Button') self._play_button = make_on_off_button(0, 91, name='Play_Button') self._record_button = make_on_off_button(0, 93, name='Record_Button') self._session_record_button = make_on_off_button(0, 102, name='Session_Record_Button') self._nudge_down_button = make_button(0, 100, name='Nudge_Down_Button') self._nudge_up_button = make_button(0, 101, name='Nudge_Up_Button') self._tap_tempo_button = make_button(0, 99, name='Tap_Tempo_Button') self._tempo_control = make_encoder(0, 13, name='Tempo_Control') self._device_controls = ButtonMatrixElement(rows=[[ make_ring_encoder(16 + index, 24 + index, name='Device_Control_%d' % index) for index in xrange(8) ]]) self._device_control_buttons_raw = [ make_on_off_button(0, 58 + index) for index in xrange(8) ] self._device_bank_buttons = ButtonMatrixElement(rows=[[ DeviceBankButtonElement(button, modifiers=[self._shift_button]) for button in self._device_control_buttons_raw ]]) self._device_prev_bank_button = self._device_control_buttons_raw[2] self._device_prev_bank_button.name = 'Device_Prev_Bank_Button' self._device_next_bank_button = self._device_control_buttons_raw[3] self._device_next_bank_button.name = 'Device_Next_Bank_Button' self._device_on_off_button = self._device_control_buttons_raw[4] self._device_on_off_button.name = 'Device_On_Off_Button' self._device_lock_button = self._device_control_buttons_raw[5] self._device_lock_button.name = 'Device_Lock_Button' self._prev_device_button = self._device_control_buttons_raw[0] self._prev_device_button.name = 'Prev_Device_Button' self._next_device_button = self._device_control_buttons_raw[1] self._next_device_button.name = 'Next_Device_Button' self._clip_device_button = self._device_control_buttons_raw[6] self._clip_device_button.name = 'Clip_Device_Button' self._detail_view_button = self._device_control_buttons_raw[7] self._detail_view_button.name = 'Detail_View_Button' self._foot_pedal_button = DoublePressElement(make_pedal_button(64, name='Foot_Pedal')) self._shifted_matrix = ButtonMatrixElement(rows=recursive_map(self._with_shift, self._matrix_rows_raw)) self._shifted_scene_buttons = ButtonMatrixElement(rows=[[ self._with_shift(button) for button in self._scene_launch_buttons_raw ]])
def _create_controls(self): make_on_off_button = partial(make_button, skin=self._default_skin) make_color_button = partial(make_button, skin=self._color_skin) self._shift_button = make_button(0, 98, resource_type=PrioritizedResource, name='Shift_Button') self._right_button = make_button(0, 96, name='Bank_Select_Right_Button') self._left_button = make_button(0, 97, name='Bank_Select_Left_Button') self._up_button = make_button(0, 94, name='Bank_Select_Up_Button') self._down_button = make_button(0, 95, name='Bank_Select_Down_Button') self._session_matrix = ButtonMatrixElement(name='Button_Matrix') self._scene_launch_buttons_raw = [ make_color_button(0, index + 82, name='Scene_%d_Launch_Button' % index) for index in xrange(SESSION_HEIGHT) ] self._track_stop_buttons = [ make_color_button(index, 52, name='Track_%d_Stop_Button' % index) for index in xrange(SESSION_WIDTH) ] self._stop_all_button = make_color_button(0, 81, name='Stop_All_Clips_Button') self._matrix_rows_raw = [ [ make_color_button(track_index, scene_index + 53, name='%d_Clip_%d_Button' % (track_index, scene_index)) for track_index in xrange(SESSION_WIDTH) ] for scene_index in xrange(SESSION_HEIGHT) ] for row in self._matrix_rows_raw: self._session_matrix.add_row(row) self._selected_slot_launch_button = make_pedal_button(67, name='Selected_Slot_Launch_Button') self._selected_scene_launch_button = make_pedal_button(64, name='Selected_Scene_Launch_Button') self._volume_controls = [] self._arm_buttons = [] self._solo_buttons = [] self._mute_buttons = [] self._select_buttons = [] for index in xrange(MIXER_SIZE): self._volume_controls.append(make_slider(index, 7, name='%d_Volume_Control' % index)) self._arm_buttons.append(make_on_off_button(index, 48, name='%d_Arm_Button' % index)) self._solo_buttons.append(make_on_off_button(index, 49, name='%d_Solo_Button' % index)) self._mute_buttons.append(make_on_off_button(index, 50, name='%d_Mute_Button' % index)) self._select_buttons.append(make_on_off_button(index, 51, name='%d_Select_Button' % index)) self._crossfader_control = make_slider(0, 15, name='Crossfader') self._master_volume_control = make_slider(0, 14, name='Master_Volume_Control') self._master_select_button = make_on_off_button(0, 80, name='Master_Select_Button') self._prehear_control = make_encoder(0, 47, name='Prehear_Volume_Control') self._device_bank_buttons = [] self._device_param_controls_raw = [] bank_button_labels = ('Clip_Track_Button', 'Device_On_Off_Button', 'Previous_Device_Button', 'Next_Device_Button', 'Detail_View_Button', 'Rec_Quantization_Button', 'Midi_Overdub_Button', 'Metronome_Button') for index in range(8): self._device_bank_buttons.append(make_on_off_button(0, 58 + index, name=bank_button_labels[index])) encoder_name = 'Device_Control_%d' % index ringed_encoder = make_ring_encoder(16 + index, 24 + index, name=encoder_name) self._device_param_controls_raw.append(ringed_encoder) self._play_button = make_button(0, 91, name='Play_Button') self._stop_button = make_button(0, 92, name='Stop_Button') self._record_button = make_button(0, 93, name='Record_Button') self._nudge_up_button = make_button(0, 100, name='Nudge_Up_Button') self._nudge_down_button = make_button(0, 101, name='Nudge_Down_Button') self._tap_tempo_button = make_button(0, 99, name='Tap_Tempo_Button') self._global_bank_buttons = [] self._global_param_controls = [] for index in range(8): encoder_name = 'Track_Control_%d' % index ringed_encoder = make_ring_encoder(48 + index, 56 + index, name=encoder_name) self._global_param_controls.append(ringed_encoder) self._global_bank_buttons = [ make_on_off_button(0, 87 + index, name=name) for index, name in enumerate(('Pan_Button', 'Send_A_Button', 'Send_B_Button', 'Send_C_Button')) ] self._device_clip_toggle_button = self._device_bank_buttons[0] self._device_on_off_button = self._device_bank_buttons[1] self._detail_left_button = self._device_bank_buttons[2] self._detail_right_button = self._device_bank_buttons[3] self._detail_toggle_button = self._device_bank_buttons[4] self._rec_quantization_button = self._device_bank_buttons[5] self._overdub_button = self._device_bank_buttons[6] self._metronome_button = self._device_bank_buttons[7] def wrap_matrix(control_list, wrapper = nop): return ButtonMatrixElement(rows=[map(wrapper, control_list)]) self._scene_launch_buttons = wrap_matrix(self._scene_launch_buttons_raw) self._track_stop_buttons = wrap_matrix(self._track_stop_buttons) self._volume_controls = wrap_matrix(self._volume_controls) self._arm_buttons = wrap_matrix(self._arm_buttons) self._solo_buttons = wrap_matrix(self._solo_buttons) self._mute_buttons = wrap_matrix(self._mute_buttons) self._select_buttons = wrap_matrix(self._select_buttons) self._device_param_controls = wrap_matrix(self._device_param_controls_raw) self._device_bank_buttons = wrap_matrix(self._device_bank_buttons, partial(DeviceBankButtonElement, modifiers=[self._shift_button])) self._shifted_matrix = ButtonMatrixElement(rows=recursive_map(self._with_shift, self._matrix_rows_raw)) self._shifted_scene_buttons = ButtonMatrixElement(rows=[[ self._with_shift(button) for button in self._scene_launch_buttons_raw ]])
def _create_controls(self): make_on_off_button = partial(make_button, skin=self._default_skin) make_color_button = partial(make_button, skin=self._color_skin) self._shift_button = make_button(0, 98, resource_type=PrioritizedResource, name=u'Shift_Button') self._right_button = make_button(0, 96, name=u'Bank_Select_Right_Button') self._left_button = make_button(0, 97, name=u'Bank_Select_Left_Button') self._up_button = make_button(0, 94, name=u'Bank_Select_Up_Button') self._down_button = make_button(0, 95, name=u'Bank_Select_Down_Button') self._session_matrix = ButtonMatrixElement(name=u'Button_Matrix') self._scene_launch_buttons_raw = [ make_color_button(0, index + 82, name=u'Scene_%d_Launch_Button' % index) for index in range(SESSION_HEIGHT) ] self._track_stop_buttons = [ make_color_button(index, 52, name=u'Track_%d_Stop_Button' % index) for index in range(SESSION_WIDTH) ] self._stop_all_button = make_color_button( 0, 81, name=u'Stop_All_Clips_Button') self._matrix_rows_raw = [[ make_color_button(track_index, scene_index + 53, name=u'%d_Clip_%d_Button' % (track_index, scene_index)) for track_index in range(SESSION_WIDTH) ] for scene_index in range(SESSION_HEIGHT)] for row in self._matrix_rows_raw: self._session_matrix.add_row(row) self._selected_slot_launch_button = make_pedal_button( 67, name=u'Selected_Slot_Launch_Button') self._selected_scene_launch_button = make_pedal_button( 64, name=u'Selected_Scene_Launch_Button') self._volume_controls = [] self._arm_buttons = [] self._solo_buttons = [] self._mute_buttons = [] self._select_buttons = [] for index in range(MIXER_SIZE): self._volume_controls.append( make_slider(index, 7, name=u'%d_Volume_Control' % index)) self._arm_buttons.append( make_on_off_button(index, 48, name=u'%d_Arm_Button' % index)) self._solo_buttons.append( make_on_off_button(index, 49, name=u'%d_Solo_Button' % index)) self._mute_buttons.append( make_on_off_button(index, 50, name=u'%d_Mute_Button' % index)) self._select_buttons.append( make_on_off_button(index, 51, name=u'%d_Select_Button' % index)) self._crossfader_control = make_slider(0, 15, name=u'Crossfader') self._master_volume_control = make_slider( 0, 14, name=u'Master_Volume_Control') self._master_select_button = make_on_off_button( 0, 80, name=u'Master_Select_Button') self._prehear_control = make_encoder(0, 47, name=u'Prehear_Volume_Control') self._device_bank_buttons = [] self._device_param_controls_raw = [] bank_button_labels = (u'Clip_Track_Button', u'Device_On_Off_Button', u'Previous_Device_Button', u'Next_Device_Button', u'Detail_View_Button', u'Rec_Quantization_Button', u'Midi_Overdub_Button', u'Metronome_Button') for index in range(8): self._device_bank_buttons.append( make_on_off_button(0, 58 + index, name=bank_button_labels[index])) encoder_name = u'Device_Control_%d' % index ringed_encoder = make_ring_encoder(16 + index, 24 + index, name=encoder_name) self._device_param_controls_raw.append(ringed_encoder) self._play_button = make_button(0, 91, name=u'Play_Button') self._stop_button = make_button(0, 92, name=u'Stop_Button') self._record_button = make_button(0, 93, name=u'Record_Button') self._nudge_up_button = make_button(0, 100, name=u'Nudge_Up_Button') self._nudge_down_button = make_button(0, 101, name=u'Nudge_Down_Button') self._tap_tempo_button = make_button(0, 99, name=u'Tap_Tempo_Button') self._global_bank_buttons = [] self._global_param_controls = [] for index in range(8): encoder_name = u'Track_Control_%d' % index ringed_encoder = make_ring_encoder(48 + index, 56 + index, name=encoder_name) self._global_param_controls.append(ringed_encoder) self._global_bank_buttons = [ make_on_off_button(0, 87 + index, name=name) for index, name in enumerate((u'Pan_Button', u'Send_A_Button', u'Send_B_Button', u'Send_C_Button')) ] self._device_clip_toggle_button = self._device_bank_buttons[0] self._device_on_off_button = self._device_bank_buttons[1] self._detail_left_button = self._device_bank_buttons[2] self._detail_right_button = self._device_bank_buttons[3] self._detail_toggle_button = self._device_bank_buttons[4] self._rec_quantization_button = self._device_bank_buttons[5] self._overdub_button = self._device_bank_buttons[6] self._metronome_button = self._device_bank_buttons[7] def wrap_matrix(control_list, wrapper=nop): return ButtonMatrixElement(rows=[list(map(wrapper, control_list))]) self._scene_launch_buttons = wrap_matrix( self._scene_launch_buttons_raw) self._track_stop_buttons = wrap_matrix(self._track_stop_buttons) self._volume_controls = wrap_matrix(self._volume_controls) self._arm_buttons = wrap_matrix(self._arm_buttons) self._solo_buttons = wrap_matrix(self._solo_buttons) self._mute_buttons = wrap_matrix(self._mute_buttons) self._select_buttons = wrap_matrix(self._select_buttons) self._device_param_controls = wrap_matrix( self._device_param_controls_raw) self._device_bank_buttons = wrap_matrix( self._device_bank_buttons, partial(DeviceBankButtonElement, modifiers=[self._shift_button])) self._shifted_matrix = ButtonMatrixElement( rows=recursive_map(self._with_shift, self._matrix_rows_raw)) self._shifted_scene_buttons = ButtonMatrixElement(rows=[[ self._with_shift(button) for button in self._scene_launch_buttons_raw ]])
def _create_controls(self): make_on_off_button = partial(make_button, skin=self._default_skin) make_color_button = partial(make_button, skin=self._color_skin) make_stop_button = partial(make_button, skin=self._stop_button_skin) self._shift_button = make_button(0, 98, name='Shift_Button', resource_type=PrioritizedResource) self._left_button = make_button(0, 97, name='Bank_Select_Left_Button') self._right_button = make_button(0, 96, name='Bank_Select_Right_Button') self._up_button = make_button(0, 94, name='Bank_Select_Up_Button') self._down_button = make_button(0, 95, name='Bank_Select_Down_Button') self._stop_buttons = ButtonMatrixElement(rows=[[ make_stop_button(track, 52, name='%d_Stop_Button' % track) for track in xrange(NUM_TRACKS) ]], name="Stop_Buttons") self._stop_all_button = make_button(0, 81, name='Stop_All_Clips_Button') self._scene_launch_buttons_raw = [ make_color_button(0, scene + 82, name='Scene_%d_Launch_Button' % scene) for scene in xrange(NUM_SCENES) ] self._scene_launch_buttons = ButtonMatrixElement(rows=[self._scene_launch_buttons_raw], name="Scene_Launch_Buttons") self._matrix_rows_raw = [ [ make_color_button(track, 53 + scene, name='%d_Clip_%d_Button' % (track, scene)) for track in xrange(NUM_TRACKS) ] for scene in xrange(NUM_SCENES) ] self._session_matrix = ButtonMatrixElement(rows=self._matrix_rows_raw, name='Button_Matrix') self._pan_button = make_on_off_button(0, 87, name='Pan_Button') self._send_a_button = make_on_off_button(0, 88, name='Send_A_Button') self._send_b_button = make_on_off_button(0, 89, name='Send_B_Button') self._send_c_button = make_on_off_button(0, 90, name='Send_C_Button') self._mixer_encoders = ButtonMatrixElement(rows=[[ make_ring_encoder(48 + track, 56 + track, name='Track_Control_%d' % track) for track in xrange(NUM_TRACKS) ]], name="Track_Controls") self._volume_controls = ButtonMatrixElement(rows=[[ make_slider(track, 7, name='%d_Volume_Control' % track) for track in xrange(NUM_TRACKS) ]]) self._master_volume_control = make_slider(0, 14, name='Master_Volume_Control') self._prehear_control = make_encoder(0, 47, name='Prehear_Volume_Control') self._crossfader_control = make_slider(0, 15, name='Crossfader') self._raw_select_buttons = [ make_on_off_button(channel, 51, name='%d_Select_Button' % channel) for channel in xrange(NUM_TRACKS) ] self._arm_buttons = ButtonMatrixElement(rows=[[ make_on_off_button(channel, 48, name='%d_Arm_Button' % channel) for channel in xrange(NUM_TRACKS) ]], name="Arm_Buttons") self._solo_buttons = ButtonMatrixElement(rows=[[ make_on_off_button(channel, 49, name='%d_Solo_Button' % channel) for channel in xrange(NUM_TRACKS) ]], name="Solo_Buttons") self._mute_buttons = ButtonMatrixElement(rows=[[ make_on_off_button(channel, 50, name='%d_Mute_Button' % channel) for channel in xrange(NUM_TRACKS) ]], name="Mute_Buttons") self._select_buttons = ButtonMatrixElement(rows=[self._raw_select_buttons], name="Select_Buttons") self._master_select_button = make_on_off_button(channel=0, identifier=80, name='Master_Select_Button') self._quantization_buttons = ButtonMatrixElement(rows=[[ ComboElement(button, modifiers=[self._shift_button]) for button in self._raw_select_buttons ]], name="Quantization_Buttons") self._play_button = make_on_off_button(0, 91, name='Play_Button') self._stop_button = make_on_off_button(0, 92, name='Stop_Button') self._record_button = make_on_off_button(0, 93, name='Record_Button') self._nudge_down_button = make_button(0, 101, name='Nudge_Down_Button') self._nudge_up_button = make_button(0, 100, name='Nudge_Up_Button') self._tap_tempo_button = make_button(0, 99, name='Tap_Tempo_Button') self._device_controls = ButtonMatrixElement(rows=[[ make_ring_encoder(16 + index, 24 + index, name='Device_Control_%d' % index) for index in xrange(8) ]], name="Device_Controls") self._device_control_buttons_raw = [ make_on_off_button(0, 58 + index) for index in xrange(8) ] self._device_bank_buttons = ButtonMatrixElement(rows=[[ DeviceBankButtonElement(button, modifiers=[self._shift_button]) for button in self._device_control_buttons_raw ]], name="Device_Bank_Buttons") self._device_clip_toggle_button = self._device_control_buttons_raw[0] self._device_clip_toggle_button.name = 'Clip_Device_Button' self._device_on_off_button = self._device_control_buttons_raw[1] self._device_on_off_button.name = 'Device_On_Off_Button' self._detail_left_button = self._device_control_buttons_raw[2] self._detail_left_button.name = 'Prev_Device_Button' self._detail_right_button = self._device_control_buttons_raw[3] self._detail_right_button.name = 'Next_Device_Button' self._detail_toggle_button = self._device_control_buttons_raw[4] self._detail_toggle_button.name = 'Detail_View_Button' self._rec_quantization_button = self._device_control_buttons_raw[5] self._rec_quantization_button.name ='Rec_Quantization_Button' self._overdub_button = self._device_control_buttons_raw[6] self._overdub_button.name = 'Overdub_Button' self._metronome_button = self._device_control_buttons_raw[7] self._metronome_button.name = 'Metronome_Button' self._selected_slot_launch_button = make_pedal_button(67, name='Selected_Slot_Launch_Button') self._selected_scene_launch_button = make_pedal_button(64, name='Selected_Scene_Launch_Button') self._shifted_matrix = ButtonMatrixElement(rows=recursive_map(self._with_shift, self._matrix_rows_raw), name="Shifted_Matrix") self._shifted_scene_buttons = ButtonMatrixElement(rows=[[ self._with_shift(button) for button in self._scene_launch_buttons_raw ]], name="Shifted_Scene_Buttons")