def make_launch_control_encoder(identifier, name, channel=0): encoder = EncoderElement(MIDI_CC_TYPE, channel, identifier, Live.MidiMap.MapMode.absolute) encoder.reset = nop encoder.set_feedback_delay(-1) encoder.name = name return encoder
def _setup_mixer_control(self): is_momentary = True # We use non-latching buttons (keys) throughout, so we'll set this as a constant num_tracks = 7 # Here we define the mixer width in tracks (a mixer has only one dimension) global mixer # We want to instantiate the global mixer as a MixerComponent object (it was a global "None" type up until now...) mixer = MixerComponent(num_tracks, 0) #(num_tracks, num_returns, with_eqs, with_filters) mixer.set_track_offset(0) #Sets start point for mixer strip (offset from left) """set up the mixer buttons""" self.song().view.selected_track = mixer.channel_strip(0)._track mixer.selected_strip().set_mute_button(ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, 64)) #mixer.selected_strip().set_solo_button(ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, 44)) mixer.selected_strip().set_arm_button(ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, 72)) track_select_notes = [65, 73, 66, 74, 67, 75, 68, 76] #more note numbers need to be added if num_scenes is increased slider_select_notes = [23, 22, 15, 14, 5, 7, 6, 4] pan_select_notes = [21, 20, 13, 12, 3, 1, 0, 2] master_volume_control = SliderElement(MIDI_CC_TYPE, 0, 4) master_select_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 76) prehear_control = EncoderElement(MIDI_CC_TYPE, 0, 26, Live.MidiMap.MapMode.absolute) crossfader = SliderElement(MIDI_CC_TYPE, 0, 24) for index in range(num_tracks): mixer.channel_strip(index).set_select_button(ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, track_select_notes[index])) mixer.channel_strip(index).set_volume_control(SliderElement(MIDI_CC_TYPE, CHANNEL, slider_select_notes[index])) mixer.channel_strip(index).set_pan_control(EncoderElement(MIDI_CC_TYPE, CHANNEL, pan_select_notes[index], Live.MidiMap.MapMode.absolute)) crossfader.name = 'Crossfader' master_volume_control.name = 'Master_Volume_Control' master_select_button.name = 'Master_Select_Button' prehear_control.name = 'Prehear_Volume_Control' mixer.set_crossfader_control(crossfader) mixer.set_prehear_volume_control(prehear_control) mixer.master_strip().set_volume_control(master_volume_control) mixer.master_strip().set_select_button(master_select_button)
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 = [] for track in range(8): strip = self._mixer.channel_strip(track) strip.name = 'Channel_Strip_' + str(track) solo_button = FlashingButtonElement(is_momentary, MIDI_NOTE_TYPE, track, 50, self) self._solo_buttons.append(solo_button) mute_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, track, 49) solo_button.name = str(track) + '_Solo_Button' mute_button.name = str(track) + '_Mute_Button' strip.set_solo_button(solo_button) strip.set_mute_button(mute_button) strip.set_shift_button(self._shift_button) strip.set_invert_mute_feedback(True) master_volume_control = SliderElement(MIDI_CC_TYPE, 0, 14) prehear_control = EncoderElement(MIDI_CC_TYPE, 0, 47, Live.MidiMap.MapMode.relative_two_compliment) master_volume_control.name = 'Master_Volume_Control' prehear_control.name = 'Prehear_Volume_Control' self._mixer.set_prehear_volume_control(prehear_control) self._mixer.master_strip().set_volume_control(master_volume_control)
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' for track in range(8): strip = self._mixer.channel_strip(track) strip.name = 'Channel_Strip_' + str(track) solo_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, track, 49) mute_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, track, 50) solo_button.name = str(track) + '_Solo_Button' mute_button.name = str(track) + '_Mute_Button' strip.set_solo_button(solo_button) strip.set_mute_button(mute_button) strip.set_shift_button(self._shift_button) strip.set_invert_mute_feedback(True) master_volume_control = SliderElement(MIDI_CC_TYPE, 0, 14) prehear_control = EncoderElement( MIDI_CC_TYPE, 0, 47, Live.MidiMap.MapMode.relative_two_compliment) master_volume_control.name = 'Master_Volume_Control' prehear_control.name = 'Prehear_Volume_Control' self._mixer.set_prehear_volume_control(prehear_control) self._mixer.master_strip().set_volume_control(master_volume_control)
def _init_device_component(self, device_controls, bank_controls, global_channel, macro_map_mode): is_momentary = True if device_controls: device = DeviceComponent() device.name = 'Device_Component' if bank_controls: next_button = None prev_button = None if 'NEXTBANK' in bank_controls.keys() and bank_controls['NEXTBANK'] in range(128): next_button = ButtonElement(is_momentary, MIDI_CC_TYPE, global_channel, bank_controls['NEXTBANK']) next_button.name = 'Device_Next_Bank_Button' if 'PREVBANK' in bank_controls.keys() and bank_controls['PREVBANK'] in range(128): prev_button = ButtonElement(is_momentary, MIDI_CC_TYPE, global_channel, bank_controls['PREVBANK']) prev_button.name = 'Device_Previous_Bank_Button' device.set_bank_nav_buttons(prev_button, next_button) if 'TOGGLELOCK' in bank_controls.keys() and bank_controls['TOGGLELOCK'] in range(128): lock_button = ButtonElement(is_momentary, MIDI_CC_TYPE, global_channel, bank_controls['TOGGLELOCK']) lock_button.name = 'Device_Lock_Button' device.set_lock_button(lock_button) bank_buttons = [] for index in range(8): key = 'BANK' + str(index + 1) if key in bank_controls.keys(): control_info = bank_controls[key] channel = global_channel cc = -1 if isinstance(control_info, (tuple, list)): cc = control_info[0] if control_info[1] in range(16): channel = control_info[1] else: cc = control_info if cc in range(128) and channel in range(16): button = ButtonElement(is_momentary, MIDI_CC_TYPE, channel, cc) button.name = 'Device_Bank_' + str(index) + '_Button' bank_buttons.append(button) if len(bank_buttons) > 0: device.set_bank_buttons(tuple(bank_buttons)) parameter_encoders = [] for control_info in device_controls: channel = global_channel cc = -1 if isinstance(control_info, (tuple, list)): cc = control_info[0] if control_info[1] in range(16): channel = control_info[1] else: cc = control_info if cc in range(128) and channel in range(16): encoder = EncoderElement(MIDI_CC_TYPE, channel, cc, macro_map_mode) encoder.name = 'Device_Parameter_' + str(list(device_controls).index(control_info)) + '_Control' parameter_encoders.append(encoder) if len(parameter_encoders) > 0: device.set_parameter_controls(tuple(parameter_encoders)) self.set_device_component(device) return
def _init_device_component(self, device_controls, bank_controls, global_channel, macro_map_mode): is_momentary = True if device_controls: device = DeviceComponent() device.name = 'Device_Component' if bank_controls: next_button = None prev_button = None if 'NEXTBANK' in bank_controls.keys() and bank_controls['NEXTBANK'] in range(128): next_button = ButtonElement(is_momentary, MIDI_CC_TYPE, global_channel, bank_controls['NEXTBANK']) next_button.name = 'Device_Next_Bank_Button' if 'PREVBANK' in bank_controls.keys() and bank_controls['PREVBANK'] in range(128): prev_button = ButtonElement(is_momentary, MIDI_CC_TYPE, global_channel, bank_controls['PREVBANK']) prev_button.name = 'Device_Previous_Bank_Button' device.set_bank_nav_buttons(prev_button, next_button) if 'TOGGLELOCK' in bank_controls.keys() and bank_controls['TOGGLELOCK'] in range(128): lock_button = ButtonElement(is_momentary, MIDI_CC_TYPE, global_channel, bank_controls['TOGGLELOCK']) lock_button.name = 'Device_Lock_Button' device.set_lock_button(lock_button) bank_buttons = [] for index in range(8): key = 'BANK' + str(index + 1) if key in bank_controls.keys(): control_info = bank_controls[key] channel = global_channel cc = -1 if isinstance(control_info, (tuple, list)): cc = control_info[0] if control_info[1] in range(16): channel = control_info[1] else: cc = control_info if cc in range(128) and channel in range(16): button = ButtonElement(is_momentary, MIDI_CC_TYPE, channel, cc) button.name = 'Device_Bank_' + str(index) + '_Button' bank_buttons.append(button) if len(bank_buttons) > 0: device.set_bank_buttons(tuple(bank_buttons)) parameter_encoders = [] for control_info in device_controls: channel = global_channel cc = -1 if isinstance(control_info, (tuple, list)): cc = control_info[0] if control_info[1] in range(16): channel = control_info[1] else: cc = control_info if cc in range(128) and channel in range(16): encoder = EncoderElement(MIDI_CC_TYPE, channel, cc, macro_map_mode) encoder.name = 'Device_Parameter_' + str(list(device_controls).index(control_info)) + '_Control' parameter_encoders.append(encoder) if len(parameter_encoders) > 0: device.set_parameter_controls(tuple(parameter_encoders)) self.set_device_component(device)
def make_control_encoder(identifier, name, channel=0): encoder = EncoderElement( MIDI_CC_TYPE, channel, identifier, Live.MidiMap.MapMode.absolute if not self._relative else Live.MidiMap.MapMode.relative_two_compliment) encoder.reset = nop encoder.set_feedback_delay(-1) encoder.name = name return encoder
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 = EncoderElement( 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 = AumPCMonoButtonElement(is_momentary, MIDI_NOTE_TYPE, track, 50, str(track) + '_Solo_Button', self) self._solo_buttons.append(solo_button) # added a mute_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, track, 49) select_button = AumPCMonoButtonElement( is_momentary, MIDI_NOTE_TYPE, track, 51, str(track) + '_Select_Button', 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) 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) crossfader = SliderElement(MIDI_CC_TYPE, 0, 15) self._crossfader = crossfader self._crossfader.name = 'Crossfader' master_volume_control = SliderElement(MIDI_CC_TYPE, 0, 14) master_select_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 80) self._master_select_button = master_select_button prehear_control = EncoderElement( MIDI_CC_TYPE, 0, 47, Live.MidiMap.MapMode.relative_two_compliment) crossfader.name = 'Crossfader' master_volume_control.name = 'Master_Volume_Control' master_select_button.name = 'Master_Select_Button' prehear_control.name = 'Prehear_Volume_Control' self._mixer.set_crossfader_control(crossfader) self._mixer.set_prehear_volume_control(prehear_control) self._mixer.master_strip().set_volume_control(master_volume_control) self._mixer.master_strip().set_select_button(master_select_button)
def _setup_mixer_control(self): is_momentary = True # We use non-latching buttons (keys) throughout, so we'll set this as a constant num_tracks = 4 # Here we define the mixer width in tracks (a mixer has only one dimension) global mixer # We want to instantiate the global mixer as a MixerComponent object (it was a global "None" type up until now...) mixer = MixerComponent(num_tracks, 2, with_eqs=True, with_filters=False) #(num_tracks, num_returns, with_eqs, with_filters) mixer.set_track_offset(0) #Sets start point for mixer strip (offset from left) """set up the mixer buttons""" self.song().view.selected_track = mixer.channel_strip(0)._track #mute_notes = [1,5,9,13] #solo_notes = [2,6,10,14] #arm_notes = [3,7,11,15] track_select_notes = [38,39,40,41]#more note numbers need to be added if num_scenes is increased send_ccs = [2,6,10,14,1,5,9,13] pan_ccs = [3,7,11,15] slider_ccs = [4,8,12,16] for index in range(num_tracks): mixer.channel_strip(index).set_select_button(ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHAN, track_select_notes[index])) mixer.channel_strip(index).set_volume_control(SliderElement(MIDI_CC_TYPE, CHAN, slider_ccs[index])) mixer.channel_strip(index).set_pan_control(EncoderElement(MIDI_CC_TYPE, CHAN, pan_ccs[index], Live.MidiMap.MapMode.absolute)) #put send A and send B controllers into an array, which is then "tupled" for set_send_controls: send_controlers = [EncoderElement(MIDI_CC_TYPE, CHAN, send_ccs[index], Live.MidiMap.MapMode.absolute), EncoderElement(MIDI_CC_TYPE, CHAN, send_ccs[index+num_tracks], Live.MidiMap.MapMode.absolute)] mixer.channel_strip(index).set_send_controls(tuple(send_controlers)) crossfader = SliderElement(MIDI_CC_TYPE, CHAN, 28) master_volume_control = SliderElement(MIDI_CC_TYPE, CHAN, 32) returna_pan_control = SliderElement(MIDI_CC_TYPE, CHAN, 19) returna_volume_control = SliderElement(MIDI_CC_TYPE, CHAN, 20) returnb_pan_control = SliderElement(MIDI_CC_TYPE, CHAN, 23) returnb_volume_control = SliderElement(MIDI_CC_TYPE, CHAN, 24) master_select_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHAN, 31) prehear_control = EncoderElement(MIDI_CC_TYPE, CHAN, 30, Live.MidiMap.MapMode.absolute) crossfader.name = 'Crossfader' master_volume_control.name = 'Master_Volume_Control' returna_pan_control.name = 'ReturnA_Pan_Control' returna_volume_control.name = 'ReturnA_Volume_Control' returnb_pan_control.name = 'ReturnB_Pan_Control' returnb_volume_control.name = 'ReturnB_Volume_Control' master_select_button.name = 'Master_Select_Button' prehear_control.name = 'Prehear_Volume_Control' mixer.set_crossfader_control(crossfader) mixer.master_strip().set_volume_control(master_volume_control) mixer.master_strip().set_select_button(master_select_button) mixer.set_prehear_volume_control(prehear_control) mixer.return_strip(0).set_pan_control(returna_pan_control) mixer.return_strip(0).set_volume_control(returna_volume_control) mixer.return_strip(1).set_pan_control(returnb_pan_control) mixer.return_strip(1).set_volume_control(returnb_volume_control)
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 = EncoderElement(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 = AumPCMonoButtonElement(is_momentary, MIDI_NOTE_TYPE, track, 50, str(track) + '_Solo_Button', self) self._solo_buttons.append(solo_button) # added a mute_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, track, 49) select_button = AumPCMonoButtonElement(is_momentary, MIDI_NOTE_TYPE, track, 51, str(track) + '_Select_Button', 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) 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) crossfader = SliderElement(MIDI_CC_TYPE, 0, 15) self._crossfader = crossfader self._crossfader.name = 'Crossfader' master_volume_control = SliderElement(MIDI_CC_TYPE, 0, 14) master_select_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 80) self._master_select_button = master_select_button prehear_control = EncoderElement(MIDI_CC_TYPE, 0, 47, Live.MidiMap.MapMode.relative_two_compliment) crossfader.name = 'Crossfader' master_volume_control.name = 'Master_Volume_Control' master_select_button.name = 'Master_Select_Button' prehear_control.name = 'Prehear_Volume_Control' self._mixer.set_crossfader_control(crossfader) self._mixer.set_prehear_volume_control(prehear_control) self._mixer.master_strip().set_volume_control(master_volume_control) self._mixer.master_strip().set_select_button(master_select_button)
def _setup_mixer_control(self): is_momentary = True # We use non-latching buttons (keys) throughout, so we'll set this as a constant num_tracks = 7 # Here we define the mixer width in tracks (a mixer has only one dimension) global mixer # We want to instantiate the global mixer as a MixerComponent object (it was a global "None" type up until now...) mixer = MixerComponent( num_tracks, 0) #(num_tracks, num_returns, with_eqs, with_filters) mixer.set_track_offset( 0) #Sets start point for mixer strip (offset from left) """set up the mixer buttons""" self.song().view.selected_track = mixer.channel_strip(0)._track mixer.selected_strip().set_mute_button( ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, 64)) #mixer.selected_strip().set_solo_button(ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, 44)) mixer.selected_strip().set_arm_button( ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, 72)) track_select_notes = [ 65, 73, 66, 74, 67, 75, 68, 76 ] #more note numbers need to be added if num_scenes is increased slider_select_notes = [23, 22, 15, 14, 5, 7, 6, 4] pan_select_notes = [21, 20, 13, 12, 3, 1, 0, 2] master_volume_control = SliderElement(MIDI_CC_TYPE, 0, 4) master_select_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 76) prehear_control = EncoderElement(MIDI_CC_TYPE, 0, 26, Live.MidiMap.MapMode.absolute) crossfader = SliderElement(MIDI_CC_TYPE, 0, 24) for index in range(num_tracks): mixer.channel_strip(index).set_select_button( ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, track_select_notes[index])) mixer.channel_strip(index).set_volume_control( SliderElement(MIDI_CC_TYPE, CHANNEL, slider_select_notes[index])) mixer.channel_strip(index).set_pan_control( EncoderElement(MIDI_CC_TYPE, CHANNEL, pan_select_notes[index], Live.MidiMap.MapMode.absolute)) crossfader.name = 'Crossfader' master_volume_control.name = 'Master_Volume_Control' master_select_button.name = 'Master_Select_Button' prehear_control.name = 'Prehear_Volume_Control' mixer.set_crossfader_control(crossfader) mixer.set_prehear_volume_control(prehear_control) mixer.master_strip().set_volume_control(master_volume_control) mixer.master_strip().set_select_button(master_select_button)
def _init_transport_component(self, transport_controls, global_channel, macro_map_mode): is_momentary = True if transport_controls: transport = TransportComponent() transport.name = 'Transport' #THIS IS NEW STUFF #if 'TEMPO' in transport_control.keys() and transport_controls['TEMPO'] in range(128): tempo_slider = EncoderElement(MIDI_CC_TYPE, global_channel, 1, macro_map_mode) tempo_slider.name = 'Tempo_Slider' transport.set_tempo_control(tempo_slider) #END NEW STUFF if 'STOP' in transport_controls.keys() and transport_controls['STOP'] in range(128): stop_button = ButtonElement(is_momentary, MIDI_CC_TYPE, global_channel, transport_controls['STOP']) stop_button.name = 'Stop_Button' transport.set_stop_button(stop_button) if 'PLAY' in transport_controls.keys() and transport_controls['PLAY'] in range(128): play_button = ButtonElement(is_momentary, MIDI_CC_TYPE, global_channel, transport_controls['PLAY']) play_button.name = 'Play_Button' transport.set_play_button(play_button) if 'REC' in transport_controls.keys() and transport_controls['REC'] in range(128): rec_button = ButtonElement(is_momentary, MIDI_CC_TYPE, global_channel, transport_controls['REC']) rec_button.name = 'Record_Button' transport.set_record_button(rec_button) if 'LOOP' in transport_controls.keys() and transport_controls['LOOP'] in range(128): loop_button = ButtonElement(is_momentary, MIDI_CC_TYPE, global_channel, transport_controls['LOOP']) loop_button.name = 'Loop_Button' transport.set_loop_button(loop_button) ffwd_button = None rwd_button = None momentary_seek = 'NORELEASE' not in transport_controls.keys() if 'FFWD' in transport_controls.keys() and transport_controls['FFWD'] in range(128): ffwd_button = ButtonElement(momentary_seek, MIDI_CC_TYPE, global_channel, transport_controls['FFWD']) ffwd_button.name = 'FFwd_Button' if 'RWD' in transport_controls.keys() and transport_controls['RWD'] in range(128): rwd_button = ButtonElement(momentary_seek, MIDI_CC_TYPE, global_channel, transport_controls['RWD']) rwd_button.name = 'Rwd_Button' transport.set_seek_buttons(ffwd_button, rwd_button)
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" 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) 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) crossfader = SliderElement(MIDI_CC_TYPE, 0, 15) master_volume_control = SliderElement(MIDI_CC_TYPE, 0, 14) master_select_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 80) prehear_control = EncoderElement(MIDI_CC_TYPE, 0, 47, Live.MidiMap.MapMode.relative_two_compliment) crossfader.name = "Crossfader" master_volume_control.name = "Master_Volume_Control" master_select_button.name = "Master_Select_Button" prehear_control.name = "Prehear_Volume_Control" self._mixer.set_crossfader_control(crossfader) self._mixer.set_prehear_volume_control(prehear_control) self._mixer.master_strip().set_volume_control(master_volume_control) self._mixer.master_strip().set_select_button(master_select_button)
def _load_MIDI_map(self): is_momentary = True rgb_skin = make_rgb_skin() for note in range(128): button = ButtonElement(is_momentary, MESSAGETYPE, BUTTONCHANNEL, note,) button.name = 'Button Note_' + str(note) button.is_rgb = True self._note_map.append(button) self._note_map.append(None) #add None to the end of the list, selectable with [-1] for note in range(128): clip_button = ColorButtonElement(self.log_message,is_momentary, MESSAGETYPE, BUTTONCHANNEL, note, skin = rgb_skin) clip_button.name = 'Clip Note_' + str(note) button.num_delayed_messages = 3 self._clip_map.append(clip_button) self._clip_map.append(None) #add None if MESSAGETYPE == MIDI_CC_TYPE and BUTTONCHANNEL == SLIDERCHANNEL: for i in range(128): self._ctrl_map.append(None) self._enc_map.append(None) else: for ctrl in range(128): control = SliderElement(MIDI_CC_TYPE, SLIDERCHANNEL, ctrl) control.name = 'Ctrl_' + str(ctrl) self._ctrl_map.append(control) self._ctrl_map.append(None) for enc in range(128): encoder = EncoderElement(MIDI_CC_TYPE, SLIDERCHANNEL, enc, Live.MidiMap.MapMode.absolute) encoder.name = "Encoder_" + str(enc) self._enc_map.append(encoder) self._enc_map.append(None) self.log_message('Note Map: %s' % self._note_map) self.log_message('Ctrl Map: %s' % self._ctrl_map) self.log_message('Enc Map: %s' % self._enc_map)
def _init_mixer_component(self, volume_controls, trackarm_controls, mixer_options, global_channel, volume_map_mode): if volume_controls != None and trackarm_controls != None: num_strips = max(len(volume_controls), len(trackarm_controls)) send_info = [] momentary_buttons = False mixer = SpecialMixerComponent(num_strips) mixer.name = 'Mixer' mixer.master_strip().name = 'Master_Channel_Strip' mixer.selected_strip().name = 'Selected_Channel_Strip' if mixer_options != None: if 'MASTERVOLUME' in mixer_options.keys() and mixer_options['MASTERVOLUME'] in range(128): encoder = EncoderElement(MIDI_CC_TYPE, global_channel, mixer_options['MASTERVOLUME'], volume_map_mode) encoder.name = 'Master_Volume_Control' mixer.master_strip().set_volume_control(encoder) if 'NUMSENDS' in mixer_options.keys() and mixer_options['NUMSENDS'] > 0: for send in range(mixer_options['NUMSENDS']): key = 'SEND' + str(send + 1) raise key in mixer_options.keys() or AssertionError send_info.append(mixer_options[key]) momentary_buttons = 'NOTOGGLE' in mixer_options.keys() next_bank_button = None prev_bank_button = None if 'NEXTBANK' in mixer_options.keys() and mixer_options['NEXTBANK'] in range(128): next_bank_button = ButtonElement(momentary_buttons, MIDI_CC_TYPE, global_channel, mixer_options['NEXTBANK']) next_bank_button.name = 'Mixer_Next_Bank_Button' if 'PREVBANK' in mixer_options.keys() and mixer_options['PREVBANK'] in range(128): prev_bank_button = ButtonElement(momentary_buttons, MIDI_CC_TYPE, global_channel, mixer_options['PREVBANK']) prev_bank_button.name = 'Mixer_Previous_Bank_Button' mixer.set_bank_buttons(next_bank_button, prev_bank_button) for track in range(num_strips): strip = mixer.channel_strip(track) strip.name = 'Channel_Strip_' + str(track) if track in range(len(volume_controls)): channel = global_channel cc = volume_controls[track] if isinstance(volume_controls[track], (tuple, list)): cc = volume_controls[track][0] if volume_controls[track][1] in range(16): channel = volume_controls[track][1] if cc in range(128) and channel in range(16): encoder = EncoderElement(MIDI_CC_TYPE, channel, cc, volume_map_mode) encoder.name = str(track) + '_Volume_Control' strip.set_volume_control(encoder) if track in range(len(trackarm_controls)) and trackarm_controls[track] in range(128): button = ButtonElement(momentary_buttons, MIDI_CC_TYPE, global_channel, trackarm_controls[track]) button.name = str(track) + '_Arm_Button' strip.set_arm_button(button) send_controls = [] for send in send_info: encoder = None if track in range(len(send)): channel = global_channel cc = send[track] if isinstance(send[track], (tuple, list)): cc = send[track][0] if send[track][1] in range(16): channel = send[track][1] if cc in range(128) and channel in range(16): encoder = EncoderElement(MIDI_CC_TYPE, channel, cc, volume_map_mode) encoder.name = str(track) + '_Send_' + str(list(send_info).index(send)) + '_Control' send_controls.append(encoder) strip.set_send_controls(tuple(send_controls))
def make_encoder(cc_no, name): encoder = EncoderElement(MIDI_CC_TYPE, 0, cc_no, Live.MidiMap.MapMode.absolute) encoder.set_feedback_delay(-1) encoder.name = name return encoder
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 !")
def make_launch_control_encoder(identifier, name, channel = 0): encoder = EncoderElement(MIDI_CC_TYPE, channel, identifier, Live.MidiMap.MapMode.absolute) encoder.reset = nop encoder.set_feedback_delay(-1) encoder.name = name return encoder
def _setup_mixer_control(self): is_momentary = True # We use non-latching buttons (keys) throughout, so we'll set this as a constant num_tracks = 4 # Here we define the mixer width in tracks (a mixer has only one dimension) global mixer # We want to instantiate the global mixer as a MixerComponent object (it was a global "None" type up until now...) mixer = MixerComponent( num_tracks, 2, with_eqs=True, with_filters=False ) #(num_tracks, num_returns, with_eqs, with_filters) mixer.set_track_offset( 0) #Sets start point for mixer strip (offset from left) """set up the mixer buttons""" self.song().view.selected_track = mixer.channel_strip(0)._track #mute_notes = [1,5,9,13] #solo_notes = [2,6,10,14] #arm_notes = [3,7,11,15] track_select_notes = [ 38, 39, 40, 41 ] #more note numbers need to be added if num_scenes is increased send_ccs = [2, 6, 10, 14, 1, 5, 9, 13] pan_ccs = [3, 7, 11, 15] slider_ccs = [4, 8, 12, 16] for index in range(num_tracks): mixer.channel_strip(index).set_select_button( ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHAN, track_select_notes[index])) mixer.channel_strip(index).set_volume_control( SliderElement(MIDI_CC_TYPE, CHAN, slider_ccs[index])) mixer.channel_strip(index).set_pan_control( EncoderElement(MIDI_CC_TYPE, CHAN, pan_ccs[index], Live.MidiMap.MapMode.absolute)) #put send A and send B controllers into an array, which is then "tupled" for set_send_controls: send_controlers = [ EncoderElement(MIDI_CC_TYPE, CHAN, send_ccs[index], Live.MidiMap.MapMode.absolute), EncoderElement(MIDI_CC_TYPE, CHAN, send_ccs[index + num_tracks], Live.MidiMap.MapMode.absolute) ] mixer.channel_strip(index).set_send_controls( tuple(send_controlers)) crossfader = SliderElement(MIDI_CC_TYPE, CHAN, 28) master_volume_control = SliderElement(MIDI_CC_TYPE, CHAN, 32) returna_pan_control = SliderElement(MIDI_CC_TYPE, CHAN, 19) returna_volume_control = SliderElement(MIDI_CC_TYPE, CHAN, 20) returnb_pan_control = SliderElement(MIDI_CC_TYPE, CHAN, 23) returnb_volume_control = SliderElement(MIDI_CC_TYPE, CHAN, 24) master_select_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHAN, 31) prehear_control = EncoderElement(MIDI_CC_TYPE, CHAN, 30, Live.MidiMap.MapMode.absolute) crossfader.name = 'Crossfader' master_volume_control.name = 'Master_Volume_Control' returna_pan_control.name = 'ReturnA_Pan_Control' returna_volume_control.name = 'ReturnA_Volume_Control' returnb_pan_control.name = 'ReturnB_Pan_Control' returnb_volume_control.name = 'ReturnB_Volume_Control' master_select_button.name = 'Master_Select_Button' prehear_control.name = 'Prehear_Volume_Control' mixer.set_crossfader_control(crossfader) mixer.master_strip().set_volume_control(master_volume_control) mixer.master_strip().set_select_button(master_select_button) mixer.set_prehear_volume_control(prehear_control) mixer.return_strip(0).set_pan_control(returna_pan_control) mixer.return_strip(0).set_volume_control(returna_volume_control) mixer.return_strip(1).set_pan_control(returnb_pan_control) mixer.return_strip(1).set_volume_control(returnb_volume_control)
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 !")