def _setup_mixer_control(self):
        is_momentary = True
        mixer = MixerComponent(NUM_TRACKS, 2)
        for track in range(NUM_TRACKS):
            strip = mixer.channel_strip(track)
            strip.set_volume_control(SliderElement(MIDI_CC_TYPE, track, 23))
            strip.set_pan_control(
                EncoderElement(MIDI_CC_TYPE, track, 10,
                               Live.MidiMap.MapMode.absolute))
            strip.set_send_controls(
                (EncoderElement(MIDI_CC_TYPE, track, 19,
                                Live.MidiMap.MapMode.absolute),
                 EncoderElement(MIDI_CC_TYPE, track, 20,
                                Live.MidiMap.MapMode.absolute)))
            strip.set_solo_button(
                ButtonElement(is_momentary, MIDI_NOTE_TYPE, track, 64))
            strip.set_mute_button(
                ButtonElement(is_momentary, MIDI_NOTE_TYPE, track, 63))
            strip.set_crossfade_toggle(
                ButtonElement(is_momentary, MIDI_NOTE_TYPE, track, 65))
            eq = mixer.track_eq(track)
            eq.set_gain_controls(
                tuple([
                    EncoderElement(MIDI_CC_TYPE, track, 18 - index,
                                   Live.MidiMap.MapMode.absolute)
                    for index in range(3)
                ]))
            eq.set_cut_buttons(
                tuple([
                    ButtonElement(is_momentary, MIDI_NOTE_TYPE, track,
                                  62 - index) for index in range(3)
                ]))
            filter = mixer.track_filter(track)
            filter.set_filter_controls(
                EncoderElement(MIDI_CC_TYPE, track, 22,
                               Live.MidiMap.MapMode.absolute),
                EncoderElement(MIDI_CC_TYPE, track, 21,
                               Live.MidiMap.MapMode.absolute))

        for ret_track in range(2):
            strip = mixer.return_strip(ret_track)
            strip.set_volume_control(
                SliderElement(MIDI_CC_TYPE, 12, 22 + ret_track))
            strip.set_pan_control(
                EncoderElement(MIDI_CC_TYPE, 12, 20 + ret_track,
                               Live.MidiMap.MapMode.absolute))
            strip.set_mute_button(
                ButtonElement(is_momentary, MIDI_NOTE_TYPE, 12,
                              78 + ret_track))

        mixer.set_crossfader_control(SliderElement(MIDI_CC_TYPE, 12, 8))
        mixer.set_prehear_volume_control(
            EncoderElement(MIDI_CC_TYPE, 12, 24,
                           Live.MidiMap.MapMode.absolute))
        mixer.master_strip().set_volume_control(
            SliderElement(MIDI_CC_TYPE, 12, 7))
        mixer.master_strip().set_pan_control(
            EncoderElement(MIDI_CC_TYPE, 12, 10,
                           Live.MidiMap.MapMode.absolute))
        return mixer
Пример #2
0
    def _setup_mixer_control(self):
        #set up the mixer
        self.mixer = MixerComponent(
            NUM_TRACKS, 2)  #(num_tracks, num_returns, with_eqs, with_filters)
        self.mixer.set_track_offset(
            0)  #sets start point for mixer strip (offset from left)
        self.mixer.selected_strip().set_arm_button(
            ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL,
                          KEYBOARD_HIGH_C))
        self.mixer.set_select_buttons(
            ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL,
                          KEYBOARD_HIGH_C - 2),
            ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL,
                          KEYBOARD_HIGH_C - 4))
        self.mixer.master_strip().set_volume_control(
            SliderElement(MIDI_CC_TYPE, CHANNEL, KNOBS[3]))
        #self.mixer.master_strip().set_pan_control(SliderElement(MIDI_CC_TYPE, CHANNEL, KNOBS[7]))
        #set the selected strip to the first track, so that we don't assign a button to arm the master track, which would cause an assertion error
        self.song().view.selected_track = self.mixer.channel_strip(0)._track
        self.mixer.selected_strip().set_volume_control(
            SliderElement(MIDI_CC_TYPE, CHANNEL, KNOBS[0]))
        #self.mixer.selected_strip().set_pan_control(SliderElement(MIDI_CC_TYPE, CHANNEL, KNOBS[4]))

        selected_track = self.song().view.selected_track
        all_tracks = ((self.song().tracks + self.song().return_tracks) +
                      (self.song().master_track, ))
        currentTrackIndex = list(all_tracks).index(selected_track)
        if currentTrackIndex < len(all_tracks) - 1:
            self.mixer.channel_strip(currentTrackIndex + 1).set_volume_control(
                SliderElement(MIDI_CC_TYPE, CHANNEL, KNOBS[1]))
            #self.mixer.channel_strip(currentTrackIndex + 1).set_pan_control(SliderElement(MIDI_CC_TYPE, CHANNEL, KNOBS[5]))
        if currentTrackIndex < len(all_tracks) - 2:
            self.mixer.channel_strip(currentTrackIndex + 2).set_volume_control(
                SliderElement(MIDI_CC_TYPE, CHANNEL, KNOBS[2]))
Пример #3
0
 def __init__(self, button_index, monochrome = False, *a, **k):
     super(PadMode, self).__init__(button_index, *a, **a)
     self._note_display_mode = ND_KEYBOARD1
     self.current_scale_index = 0
     self._scale = None
     self._base_note = 0
     self._octave = 0.55
     self.current_scale_index = 0
     self._in_edit_mode = False
     self._editmode = None
     self._is_monochrome = monochrome
     if not monochrome or self.assign_edit_mono:
         pass
     self._color_edit_assign = self.assign_edit_color
     self.assign_transpose(SCALES[self.current_scale_index])
     is_momentary = True
     self.octave_down_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 3, 120)
     self.octave_up_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 3, 121)
     self.base_down_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 3, 124)
     self.base_up_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 3, 125)
     self.scale_down_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 3, 118)
     self.scale_up_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 3, 119)
     self._adjust_scale.subject = SliderElement(MIDI_CC_TYPE, 2, 116)
     self._adjust_octav.subject = SliderElement(MIDI_CC_TYPE, 2, 115)
     self._adjust_basem.subject = SliderElement(MIDI_CC_TYPE, 2, 117)
     self._do_oct_down.subject = self.octave_down_button
     self._do_oct_up.subject = self.octave_up_button
     self._do_base_down.subject = self.base_down_button
     self._do_base_up.subject = self.base_up_button
     self._do_scale_down.subject = self.scale_down_button
     self._do_scale_up.subject = self.scale_up_button
     self._seg_display = None
Пример #4
0
	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, with_eqs=False, 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
		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 = [3, 2, 1, 0, 5, 4, 6, 7]
		#pan_select_notes = [21, 20, 13, 12, 3, 1, 0, 2]
		master_volume_control = SliderElement(MIDI_CC_TYPE, 0, 7)
		#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)
Пример #5
0
    def __init__(self, c_instance):
        ControlSurface.__init__(self, c_instance)
        with self.component_guard():
            is_momentary = True
            self._suggested_input_port = 'Oxygen'
            self._suggested_output_port = 'Oxygen'
            self._has_slider_section = True
            self._device_selection_follows_track_selection = True
            self._shift_button = ButtonElement(is_momentary, MIDI_CC_TYPE, GLOBAL_CHANNEL, 57)
            self._shift_button.add_value_listener(self._shift_value)
            self._mixer = SpecialMixerComponent(NUM_TRACKS)
            self._mute_solo_buttons = []
            self._track_up_button = ButtonElement(is_momentary, MIDI_CC_TYPE, GLOBAL_CHANNEL, 111)
            self._track_down_button = ButtonElement(is_momentary, MIDI_CC_TYPE, GLOBAL_CHANNEL, 110)
            self._master_slider = SliderElement(MIDI_CC_TYPE, GLOBAL_CHANNEL, 41)
            for index in range(NUM_TRACKS):
                self._mute_solo_buttons.append(ButtonElement(is_momentary, MIDI_CC_TYPE, GLOBAL_CHANNEL, 49 + index))
                self._mixer.channel_strip(index).set_volume_control(SliderElement(MIDI_CC_TYPE, GLOBAL_CHANNEL, 33 + index))

            self._shift_value(0)
            self._mixer.master_strip().set_volume_control(self._master_slider)
            self._mixer.selected_strip().set_volume_control(None)
            device = DeviceComponent()
            device.set_parameter_controls(tuple([ EncoderElement(MIDI_CC_TYPE, GLOBAL_CHANNEL, 17 + index, Live.MidiMap.MapMode.absolute) for index in range(8) ]))
            self.set_device_component(device)
            ffwd_button = ButtonElement(is_momentary, MIDI_CC_TYPE, GLOBAL_CHANNEL, 115)
            rwd_button = ButtonElement(is_momentary, MIDI_CC_TYPE, GLOBAL_CHANNEL, 114)
            loop_button = ButtonElement(is_momentary, MIDI_CC_TYPE, GLOBAL_CHANNEL, 113)
            transport = TransportComponent()
            transport.set_stop_button(ButtonElement(is_momentary, MIDI_CC_TYPE, GLOBAL_CHANNEL, 116))
            transport.set_play_button(ButtonElement(is_momentary, MIDI_CC_TYPE, GLOBAL_CHANNEL, 117))
            transport.set_record_button(ButtonElement(is_momentary, MIDI_CC_TYPE, GLOBAL_CHANNEL, 118))
            session = SessionComponent(0, 0)
            transport_view_modes = TransportViewModeSelector(transport, session, ffwd_button, rwd_button, loop_button)
Пример #6
0
    def _setup_mixer_control(self):
        is_momentary = True
        num_tracks = 8
        num_returns = 7
        mixer = MixerComponent(num_tracks, num_returns)
        for track in range(num_tracks):
            strip = mixer.channel_strip(track)
            strip.set_volume_control(
                SliderElement(MIDI_CC_TYPE, 15, 54 - track))
            strip.set_pan_control(SliderElement(MIDI_CC_TYPE, 15, 80 - track))
            strip.set_mute_button(
                ButtonElement(is_momentary, MIDI_CC_TYPE, 15, 117 - track))
            strip.set_invert_mute_feedback(True)

        for track in range(num_returns):
            strip = mixer.return_strip(track)
            strip.set_volume_control(
                SliderElement(MIDI_CC_TYPE, 15, 10 + track))

        mixer.set_bank_buttons(
            ButtonElement(is_momentary, MIDI_CC_TYPE, 15, 108),
            ButtonElement(is_momentary, MIDI_CC_TYPE, 15, 109))
        mixer.set_crossfader_control(SliderElement(MIDI_CC_TYPE, 15, 9))
        mixer.master_strip().set_volume_control(
            SliderElement(MIDI_CC_TYPE, 15, 46))
        session = SessionComponent(0, 0)
        session.set_select_buttons(
            ButtonElement(is_momentary, MIDI_CC_TYPE, 15, 95),
            ButtonElement(is_momentary, MIDI_CC_TYPE, 15, 92))
        session.selected_scene().set_launch_button(
            ButtonElement(is_momentary, MIDI_CC_TYPE, 15, 91))
    def __init__(self, note_repeat=None, *a, **k):
        super(NoteRepeatComponent, self).__init__(*a, **a)
        self._note_repeat = note_repeat
        self._adjust_cfg_value.subject = SliderElement(MIDI_CC_TYPE, 2, 105)
        self._note_repeat_button = ButtonElement(True, MIDI_CC_TYPE, 0, 102)
        self._do_note_repeat.subject = self._note_repeat_button
        self._cfg_adjust_button = ButtonElement(True, MIDI_CC_TYPE, 2, 106)
        self._cfg_adjust_button.add_value_listener(self._do_cfg_button)
        self._cfg_down = False
        self._hold_mode = False
        self.nr_down = False
        self._current_nr_button = None
        self._do_change_nr_1.subject = SliderElement(MIDI_CC_TYPE, 1, 76)
        self._do_change_nr_2.subject = SliderElement(MIDI_CC_TYPE, 1, 77)
        self._do_change_nr_3.subject = SliderElement(MIDI_CC_TYPE, 1, 78)
        self._do_change_nr_4.subject = SliderElement(MIDI_CC_TYPE, 1, 79)

        def createButton(ccindenfier, nr_freq):
            button = ButtonElement(True, MIDI_CC_TYPE, 1, ccindenfier)
            button.add_value_listener(self._select_value, True)
            button.active = False
            button.freq = nr_freq
            button.cfg = False
            button.hold = False
            return button

        def createCfgButton(ccindenfier, nr_freq_idx):
            button = ButtonElement(True, MIDI_CC_TYPE, 2, ccindenfier)
            button.add_value_listener(self._select_value, True)
            button.active = False
            button.fr_idx = nr_freq_idx
            button.freq = CFG_REPEAT_FREQUENCIES[nr_freq_idx]
            button.cfg = True
            button.hold = False
            return button

        continue
        self._cfg_buttons = [
            createCfgButton(assign[0], assign[1])
            for assign in CTRL_CFG_TO_FREQ
        ]
        for button in self._cfg_buttons:
            if not button.active or 1:
                pass
            button.send_value(0, True)

        self.nr_frq = CTRL_TO_FREQ[4][1]
        self._note_repeat.repeat_rate = (1 / self.nr_frq) * 4
        continue
        self.buttons = [
            createButton(assign[0], assign[1]) for assign in CTRL_TO_FREQ
        ]
        self.buttons[4].active = True
        self._previous_button = self.buttons[4]
        self._last_active_button = self.buttons[4]
        for button in self.buttons:
            if not button.active or 1:
                pass
            button.send_value(0, True)
Пример #8
0
 def _setup_transport(self):
     is_momentary = True
     transport = TransportComponent()
     studiotransport = MaschineTransport()
     playButton = StateButton(is_momentary, MIDI_CC_TYPE, 0, 108)
     stopButton = StateButton(not is_momentary, MIDI_CC_TYPE, 0, 110)
     recordButton = StateButton(is_momentary, MIDI_CC_TYPE, 0, 109)
     overdubButton = StateButton(is_momentary, MIDI_CC_TYPE, 0, 107)
     metrononmeButton = StateButton(is_momentary, MIDI_CC_TYPE, 0, 104)
     eventRecButton = StateButton(is_momentary, MIDI_CC_TYPE, 0, 98)
     playButton.name = 'Play'
     stopButton.name = 'Stop'
     recordButton.name = 'Record'
     overdubButton.name = 'Overdub'
     metrononmeButton.name = 'Metronome'
     transport.set_play_button(playButton)
     transport.set_stop_button(stopButton)
     transport.set_record_button(recordButton)
     transport.set_overdub_button(overdubButton)
     transport.set_metronome_button(metrononmeButton)
     studiotransport.set_session_auto_button(eventRecButton)
     studiotransport.set_arrangement_overdub_button(
         StateButton(is_momentary, MIDI_CC_TYPE, 0, 106))
     studiotransport.set_back_arrange_button(
         StateButton(is_momentary, MIDI_CC_TYPE, 0, 105))
     transport.set_nudge_buttons(
         StateButton(is_momentary, MIDI_CC_TYPE, 1, 51),
         StateButton(is_momentary, MIDI_CC_TYPE, 1, 50))
     punchinbutton = ToggleButton(MIDI_CC_TYPE, 1, 52)
     punchoutbutton = ToggleButton(MIDI_CC_TYPE, 1, 53)
     punchinbutton.name = 'Punch In'
     punchoutbutton.name = 'Punch Out'
     transport.set_punch_buttons(punchinbutton, punchoutbutton)
     transport.set_loop_button(
         StateButton(is_momentary, MIDI_CC_TYPE, 1, 54))
     self.song_follow_button = ButtonElement(True, MIDI_CC_TYPE, 2, 98)
     self._do_song_follow.subject = self.song_follow_button
     self._song_follow_changed.subject = self.song().view
     self._song_follow_changed()
     self.transp_ff_button = ButtonElement(True, MIDI_CC_TYPE, 1, 59)
     self.transp_rw_button = ButtonElement(True, MIDI_CC_TYPE, 1, 58)
     transport.set_seek_buttons(self.transp_ff_button,
                                self.transp_rw_button)
     self.xfadeKnob = SliderElement(MIDI_CC_TYPE, 1, 105)
     self.xfadeKnob.connect_to(
         self.song().master_track.mixer_device.crossfader)
     self.master_knob = SliderElement(MIDI_CC_TYPE, 0, 99)
     self.master_knob.connect_to(
         self.song().master_track.mixer_device.volume)
     self.tap_button = StateButton(is_momentary, MIDI_CC_TYPE, 0, 88)
     self._do_tap_tempo.subject = self.tap_button
     self.cue_add_delete_button = StateButton(is_momentary, MIDI_CC_TYPE, 1,
                                              55)
     self.cue_prev_button = StateButton(is_momentary, MIDI_CC_TYPE, 1, 56)
     self.cue_next_button = StateButton(is_momentary, MIDI_CC_TYPE, 1, 57)
     self._do_toggle_cue.subject = self.cue_add_delete_button
     self._do_toggle_prev_cue.subject = self.cue_prev_button
     self._do_toggle_next_cue.subject = self.cue_next_button
Пример #9
0
 def _setup_transport_control(self):
     is_momentary = True
     transport = TransportComponent()
     transport.set_play_button(ButtonElement(is_momentary, MIDI_NOTE_TYPE, 12, 80))
     transport.set_record_button(ButtonElement(is_momentary, MIDI_NOTE_TYPE, 12, 81))
     transport.set_nudge_buttons(ButtonElement(is_momentary, MIDI_NOTE_TYPE, 12, 86), ButtonElement(is_momentary, MIDI_NOTE_TYPE, 12, 85))
     transport.set_loop_button(ButtonElement(is_momentary, MIDI_NOTE_TYPE, 12, 84))
     transport.set_punch_buttons(ButtonElement(is_momentary, MIDI_NOTE_TYPE, 12, 82), ButtonElement(is_momentary, MIDI_NOTE_TYPE, 12, 83))
     transport.set_tempo_control(SliderElement(MIDI_CC_TYPE, 12, 26), SliderElement(MIDI_CC_TYPE, 12, 25))
Пример #10
0
    def _setup_mixer_control(self):
        is_momentary = True
        self._mixer = SpecialMixerComponent(self, 8) #added self for parent
        self._mixer.name = 'Mixer'
        self._mixer.master_strip().name = 'Master_Channel_Strip'
        master_select_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 80)
        master_select_button.name = 'Master_Select_Button'
        self._mixer.master_strip().set_select_button(master_select_button) #set in ShiftableSelectorComponent instead if used for Note Mode
        self._mixer.selected_strip().name = 'Selected_Channel_Strip'
        select_buttons = [] #added
        arm_buttons = [] #added
        sliders = [] #added     
        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) #set in ShiftableSelectorComponent instead
            #arm_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, track, 48) #see below
            solo_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, track, 49)
            solo_button.name = str(track) + '_Solo_Button'
            strip.set_solo_button(solo_button)

            if track < 4:
              mute_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, track, 50)
              mute_button.name = str(track) + '_Mute_Button'
              strip.set_mute_button(mute_button)
              strip.set_invert_mute_feedback(True)

            strip.set_shift_button(self._shift_button)
            select_buttons.append(ButtonElement(is_momentary, MIDI_NOTE_TYPE, track, 51)) #added
            select_buttons[-1].name = str(track) + '_Select_Button' #added            
            #strip.set_select_button(select_buttons[-1]) #added 
            arm_buttons.append(ButtonElement(is_momentary, MIDI_NOTE_TYPE, track, 48)) #added
            arm_buttons[-1].name = str(track) + '_Arm_Button' #added
            sliders.append(SliderElement(MIDI_CC_TYPE, track, 7)) #added
            sliders[-1].name = str(track) + '_Volume_Control' #added

        self._crossfader = SliderElement(MIDI_CC_TYPE, 0, 15)
        master_volume_control = SliderElement(MIDI_CC_TYPE, 0, 14)
        self._prehear_control = EncoderElement(MIDI_CC_TYPE, 0, 47, Live.MidiMap.MapMode.relative_two_compliment)
        self._crossfader.name = 'Crossfader' #not used in APC20
        master_volume_control.name = 'Master_Volume_Control'
        self._prehear_control.name = 'Prehear_Volume_Control'
        self._mixer.set_shift_button(self._shift_button) #added for shifting prehear
        self._mixer.set_crossfader_control(self._crossfader) #not used in APC20
        self._mixer.set_prehear_volume_control(self._prehear_control) #functionality overridden in SpecialMixerComponent
        self._mixer.master_strip().set_volume_control(master_volume_control)
        self._slider_modes = SliderModesComponent(self._mixer, tuple(sliders)) #added from APC20 script
        self._slider_modes.name = 'Slider_Modes' #added from APC20 script
        matrix_modes = MatrixModesComponent(self._matrix, self._session, self._session_zoom, tuple(self._track_stop_buttons), self) #added new
        matrix_modes.name = 'Matrix_Modes' #added new
        # Original method args for ShiftableSelectorComponent: (self, select_buttons, master_button, arm_buttons, matrix, session, zooming, mixer, transport, slider_modes, mode_callback)
        #self._shift_modes = ShiftableSelectorComponent(tuple(select_buttons), master_select_button, tuple(arm_buttons), self._matrix, self._session, self._session_zoom, self._mixer, transport, slider_modes, self._send_introduction_message)
        self._shift_modes = ShiftableSelectorComponent(self, tuple(select_buttons), master_select_button, tuple(arm_buttons), self._matrix, self._session, self._session_zoom, self._mixer, self._slider_modes, matrix_modes) #, self._send_introduction_message) #also added self for _parent
        self._shift_modes.name = 'Shift_Modes'
        self._shift_modes.set_mode_toggle(self._shift_button)
Пример #11
0
 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)
Пример #12
0
    def _MG_setup(self):
        mixer = MixerComponent(8)
        mixer.set_track_offset(
            0)  #Sets start point for mixer strip (offset from left)
        transport = TransportComponent()
        mixer.set_track_offset(0)

        for i in xrange(len(KNOBS)):  #set the functions of the knobs
            volume_knob = SliderElement(MIDI_CC_TYPE, 0, KNOBS[i])
            pan_knob = SliderElement(MIDI_CC_TYPE, 1, KNOBS[i])

            send_a = SliderElement(MIDI_CC_TYPE, 2, KNOBS[i])
            send_b = SliderElement(MIDI_CC_TYPE, 3, KNOBS[i])
            send_c = SliderElement(MIDI_CC_TYPE, 4, KNOBS[i])
            send_d = SliderElement(MIDI_CC_TYPE, 5, KNOBS[i])
            send_e = SliderElement(MIDI_CC_TYPE, 6, KNOBS[i])
            send_f = SliderElement(MIDI_CC_TYPE, 7, KNOBS[i])

            mixer.channel_strip(i).set_volume_control(volume_knob)
            mixer.channel_strip(i).set_pan_control(pan_knob)
            mixer.channel_strip(i).set_send_controls(
                [send_a, send_b, send_c, send_d, send_e, send_f])

        # scenes are locked to channel 14
        transport.set_overdub_button(
            ButtonElement(False, MIDI_CC_TYPE, 0, SCENES[0]))
        transport.set_stop_button(
            ButtonElement(False, MIDI_CC_TYPE, 0, SCENES[1]))
Пример #13
0
    def _create_controls(self):
        self._device_encoders = ButtonMatrixElement(rows=[[
            EncoderElement(MIDI_CC_TYPE,
                           ENCODER_CHANNEL,
                           identifier,
                           Live.MidiMap.MapMode.relative_smooth_binary_offset,
                           name=b'Device_Encoder_%d_%d' %
                           (col_index, row_index))
            for col_index, identifier in enumerate(row)
        ] for row_index, row in enumerate((ENCODER_MSG_IDS[:4],
                                           ENCODER_MSG_IDS[4:8]))])
        self._horizontal_scroll_encoder = EncoderElement(
            MIDI_CC_TYPE,
            ENCODER_CHANNEL,
            ENCODER_MSG_IDS[(-2)],
            Live.MidiMap.MapMode.relative_smooth_binary_offset,
            name=b'Horizontal_Scroll_Encoder')
        self._vertical_scroll_encoder = EncoderElement(
            MIDI_CC_TYPE,
            ENCODER_CHANNEL,
            ENCODER_MSG_IDS[(-1)],
            Live.MidiMap.MapMode.relative_smooth_binary_offset,
            name=b'Vertical_Scroll_Encoder')
        self._volume_sliders = ButtonMatrixElement(rows=[[
            SliderElement(MIDI_CC_TYPE, ENCODER_CHANNEL, identifier)
            for identifier in SLIDER_MSG_IDS[:-1]
        ]])
        self._master_slider = SliderElement(MIDI_CC_TYPE, ENCODER_CHANNEL,
                                            SLIDER_MSG_IDS[(-1)])

        def make_keylab_button(name):
            button = ButtonElement(True,
                                   MIDI_CC_TYPE,
                                   0,
                                   get_button_identifier_by_name(name),
                                   name=name.title())
            return button

        for button_name in BUTTON_HARDWARE_AND_MESSAGE_IDS.keys():
            setattr(self, b'_' + button_name, make_keylab_button(button_name))

        self._pads = ButtonMatrixElement(rows=[[
            ButtonElement(True,
                          MIDI_CC_TYPE,
                          PAD_CHANNEL,
                          col_index + row_offset,
                          name=b'Pad_%d_%d' % (col_index, row_index))
            for col_index in xrange(4)
        ] for row_index, row_offset in enumerate(xrange(48, 35, -4))])
Пример #14
0
    def _setup_mixer(self):
        self._selected_mute_solo_button = ButtonElement(IS_MOMENTARY, MIDI_CC_TYPE, 15, 12)
        mute_solo_flip_button = ButtonElement(IS_MOMENTARY, MIDI_CC_TYPE, 15, 57)
        self._strip_buttons = []
        self._selected_mute_solo_button.name = b'Selected_Mute_Button'
        mute_solo_flip_button.name = b'Mute_Solo_Flip_Button'
        self._selected_mute_solo_button.add_value_listener(self._mixer_button_value, identify_sender=True)
        self._mixer = ShiftableMixerComponent(8)
        self._mixer.name = b'Mixer'
        self._mixer.set_shift_button(self._shift_button)
        self._mixer.set_selected_mute_solo_button(self._selected_mute_solo_button)
        self._mixer.set_select_buttons(self._next_nav_button, self._prev_nav_button)
        self._mixer.selected_strip().name = b'Selected_Channel_Strip'
        self._mixer.master_strip().name = b'Master_Channel_Strip'
        self._mixer.master_strip().set_volume_control(self._master_slider)
        self._sliders = []
        for index in range(8):
            strip = self._mixer.channel_strip(index)
            strip.name = b'Channel_Strip_' + str(index)
            strip.set_invert_mute_feedback(True)
            self._sliders.append(SliderElement(MIDI_CC_TYPE, 15, 33 + index))
            self._sliders[(-1)].name = str(index) + b'_Volume_Control'
            self._sliders[(-1)].set_feedback_delay(-1)
            self._sliders[(-1)].add_value_listener(self._slider_value, identify_sender=True)
            strip.set_volume_control(self._sliders[(-1)])
            self._strip_buttons.append(ButtonElement(IS_MOMENTARY, MIDI_CC_TYPE, 15, 49 + index))
            self._strip_buttons[(-1)].name = str(index) + b'_Mute_Button'
            self._strip_buttons[(-1)].add_value_listener(self._mixer_button_value, identify_sender=True)

        self._mixer.set_strip_mute_solo_buttons(tuple(self._strip_buttons), mute_solo_flip_button)
Пример #15
0
 def _setup_mixer_control(self):
     is_momentary = True
     num_tracks = 7  #A mixer is one-dimensional; here we define the width in tracks - seven columns, which we will map to seven "white" notes
     """Here we set up the global mixer"""  #Note that it is possible to have more than one mixer...
     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=True
     )  #(num_tracks, num_returns, with_eqs, with_filters)
     mixer.set_track_offset(
         0)  #Sets start point for mixer strip (offset from left)
     self.song().view.selected_track = mixer.channel_strip(
         0
     )._track  #set the selected strip to the first track, so that we don't, for example, try to assign a button to arm the master track, which would cause an assertion error
     """set up the mixer buttons"""
     mixer.set_select_buttons(
         ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, 56),
         ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL,
                       54))  #left, right track select
     mixer.master_strip().set_select_button(
         ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL,
                       94))  #jump to the master track
     mixer.selected_strip().set_mute_button(
         ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL,
                       42))  #sets the mute ("activate") button
     mixer.selected_strip().set_solo_button(
         ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL,
                       44))  #sets the solo button
     mixer.selected_strip().set_arm_button(
         ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL,
                       46))  #sets the record arm button
     """set up the mixer sliders"""
     mixer.selected_strip().set_volume_control(
         SliderElement(MIDI_CC_TYPE, CHANNEL,
                       14))  #sets the continuous controller for volume
     """note that we have split the mixer functions across two scripts, in order to have two session highlight boxes (one red, one yellow), so there are a few things which we are not doing here..."""
Пример #16
0
    def _setup_device_control(self):
        self._device = DeviceComponent(None, True)
        self._channel_strip = ChannelStripComponent()
        self._device.name = 'Device_Component'
        lock_button = ButtonElement(True, MIDI_NOTE_TYPE, CHANNEL,
                                    DEVICE_LOCK_BUTTON)
        self._device.set_lock_button(lock_button)

        device_parameters = []
        for index in range(8):
            macro_knobs = SliderElement(MIDI_CC_TYPE, CHANNEL,
                                        KNOBS_BANK_ONE[index])
            device_parameters.append(macro_knobs)

        self._device.set_parameter_controls(device_parameters)
        self.set_device_component(
            self._device)  #Why not self._device.set_device_component()

        #device_nav_button = [ButtonElement(True, MIDI_NOTE_TYPE, CHANNEL, DEVICE_NAV_BUTTONS[index]) for index in range(2)]
        #self._device.set_device_nav_buttons(self, device_nav_button[0], device_nav_button[1])

        bank_button = [
            ButtonElement(True, MIDI_NOTE_TYPE, CHANNEL,
                          DEVICE_BANK_BUTTONS[index]) for index in range(2)
        ]
        self._device.set_bank_prev_button(bank_button[0])
        self._device.set_bank_next_button(bank_button[1])
Пример #17
0
 def __init__(self, c_instance):
     ControlSurface.__init__(self, c_instance)
     with self.component_guard():
         self.set_pad_translations(PAD_TRANSLATIONS)
         self._device_selection_follows_track_selection = True
         self._suggested_input_port = 'DirectLink'
         self._suggested_output_port = 'DirectLink'
         self._waiting_for_first_response = True
         self._has_sliders = True
         self._current_midi_map = None
         self._display_reset_delay = -1
         self._shift_pressed = False
         self._shift_button = ButtonElement(IS_MOMENTARY, MIDI_CC_TYPE, 15,
                                            13)
         self._master_slider = SliderElement(MIDI_CC_TYPE, 15, 41)
         self._next_nav_button = ButtonElement(IS_MOMENTARY, MIDI_CC_TYPE,
                                               15, 111)
         self._prev_nav_button = ButtonElement(IS_MOMENTARY, MIDI_CC_TYPE,
                                               15, 110)
         self._device_bank_buttons = None
         self._device_navigation = None
         self._shift_button.name = 'Shift_Button'
         self._master_slider.name = 'Master_Volume_Control'
         self._next_nav_button.name = 'Next_Track_Button'
         self._prev_nav_button.name = 'Prev_Track_Button'
         self._master_slider.add_value_listener(self._slider_value,
                                                identify_sender=True)
         self._shift_button.add_value_listener(self._shift_value)
         self._setup_mixer()
         self._setup_transport_and_session()
         self._setup_device()
         self._setup_display()
         for component in self.components:
             component.set_enabled(False)
Пример #18
0
 def _load_MIDI_map(self):
     is_momentary = True
     for note in range(128):
         button = ButtonElement(is_momentary, MESSAGETYPE, BUTTONCHANNEL,
                                note)
         button.name = 'Note_' + str(note)
         self._note_map.append(button)  # CC Hold, CC Toggle
         shift_bank_button = ButtonElement(is_momentary, MESSAGETYPE,
                                           SHIFTBANKCHANNEL, note)
         shift_bank_button.name = 'Note_' + str(note)
         self._shift_bank_map.append(shift_bank_button)  # Shift Bank
         shift_encoder = ButtonElement(is_momentary, 1, ENCODERSHIFTCHANNEL,
                                       note)
         shift_encoder.name = 'Note_' + str(note)
         self._shift_encoder_map.append(shift_encoder)  # Shift Encoder Hold
     self._note_map.append(
         None)  #add None to the end of the list, selectable with [-1]
     self._shift_encoder_map.append(None)
     self._shift_bank_map.append(None)
     if MESSAGETYPE == MIDI_CC_TYPE and BUTTONCHANNEL == SLIDERCHANNEL:
         for ctrl in range(128):
             self._ctrl_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)  # Standard Encoder
         self._ctrl_map.append(None)
Пример #19
0
    def _setup_mixer(self):
        mute_solo_flip_button = ButtonElement(not IS_MOMENTARY, MIDI_CC_TYPE, 0, 34)
        self._next_nav_button = ButtonElement(IS_MOMENTARY, MIDI_CC_TYPE, 0, 37)
        self._prev_nav_button = ButtonElement(IS_MOMENTARY, MIDI_CC_TYPE, 0, 38)
        self._strip_buttons = []
        mute_solo_flip_button.name = 'Mute_Solo_Flip_Button'
        self._next_nav_button.name = 'Next_Track_Button'
        self._prev_nav_button.name = 'Prev_Track_Button'
        self._mixer = SpecialMixerComponent(8)
        self._mixer.name = 'Mixer'
        self._mixer.set_select_buttons(self._next_nav_button, self._prev_nav_button)
        self._mixer.selected_strip().name = 'Selected_Channel_Strip'
        self._mixer.master_strip().name = 'Master_Channel_Strip'
        self._mixer.master_strip().set_volume_control(self._master_slider)
        self._sliders = []
        for index in range(8):
            strip = self._mixer.channel_strip(index)
            strip.name = 'Channel_Strip_' + str(index)
            strip.set_invert_mute_feedback(True)
            self._sliders.append(SliderElement(MIDI_CC_TYPE, 0, index))
            self._sliders[-1].name = str(index) + '_Volume_Control'
            self._sliders[-1].set_feedback_delay(-1)
            self._sliders[-1].add_value_listener(self._slider_value, identify_sender=True)
            strip.set_volume_control(self._sliders[-1])
            self._strip_buttons.append(ButtonElement(IS_MOMENTARY, MIDI_CC_TYPE, 0, 9 + index))
            self._strip_buttons[-1].name = str(index) + '_Mute_Button'
            self._strip_buttons[-1].add_value_listener(self._mixer_button_value, identify_sender=True)

        self._mixer.master_strip().set_mute_button(ButtonElement(IS_MOMENTARY, MIDI_CC_TYPE, 1, 17))
        self._mixer.set_strip_mute_solo_buttons(tuple(self._strip_buttons), mute_solo_flip_button)
Пример #20
0
    def _setup_controls(self):
        faders = [
            SliderElement(msg_type=MIDI_CC_TYPE,
                          channel=FADER_CHANNEL,
                          identifier=FADER_CC_START + idx)
            for idx in range(FADER_COUNT)
        ]
        buttons = [
            ButtonElement(is_momentary=False,
                          msg_type=MIDI_CC_TYPE,
                          channel=BUTTON_CHANNEL,
                          identifier=BUTTON_CC_START + idx)
            for idx in range(BUTTON_COUNT)
        ]
        self._faders = ButtonMatrixElement([faders])
        self._buttons = ButtonMatrixElement([buttons])

        self._backward_button = ButtonElement(True, MIDI_CC_TYPE,
                                              TRANSPORT_CHANNEL,
                                              TRANSPORT_BACKWARD)
        self._forward_button = ButtonElement(True, MIDI_CC_TYPE,
                                             TRANSPORT_CHANNEL,
                                             TRANSPORT_FORWARD)
        self._stop_button = ButtonElement(True, MIDI_CC_TYPE,
                                          TRANSPORT_CHANNEL, TRANSPORT_STOP)
        self._play_button = ButtonElement(True, MIDI_CC_TYPE,
                                          TRANSPORT_CHANNEL, TRANSPORT_PLAY)
        self._record_button = ButtonElement(True, MIDI_CC_TYPE,
                                            TRANSPORT_CHANNEL,
                                            TRANSPORT_RECORD)
        self._loop_button = ButtonElement(True, MIDI_CC_TYPE,
                                          TRANSPORT_CHANNEL, TRANSPORT_LOOP)
Пример #21
0
    def _set_up_device_control(self):
        is_momentary = True
        device = MaschineDeviceComponent()
        param_controls = []
        for index in range(8):
            param_controls.append(
                SliderElement(MIDI_CC_TYPE, BASIC_CHANNEL,
                              DEVICE_CC_OFF + index))

        device.set_parameter_controls(tuple(param_controls))
        self.device_control = param_controls
        device.set_on_off_button(
            StateButton(is_momentary, MIDI_CC_TYPE, BASIC_CHANNEL,
                        DEVICE_BUTTON_CC_OFF))
        device.set_bank_nav_buttons(
            StateButton(is_momentary, MIDI_CC_TYPE, 3, 104),
            ButtonElement(is_momentary, MIDI_CC_TYPE, 3, 105))
        self._device_nav_button_left = StateButton(is_momentary, MIDI_CC_TYPE,
                                                   3, 106)
        self._device_nav_button_right = StateButton(is_momentary, MIDI_CC_TYPE,
                                                    3, 107)
        self._navigate_button = StateButton(is_momentary, MIDI_CC_TYPE, 0, 127)
        self._nav_value_left.subject = self._device_nav_button_left
        self._nav_value_right.subject = self._device_nav_button_right
        self._do_focus_navigate.subject = self._navigate_button
        self.set_device_component(device)
        return device
Пример #22
0
    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)
Пример #23
0
    def _create_mixer_control(self):
        is_momentary = True
        num_tracks = 7
        """Here we set up the global mixer"""
        global mixer
        mixer = MixerComponent(name='Mixer',
                               num_tracks=num_tracks,
                               is_enabled=False,
                               num_returns=2)
        mixer.set_enabled(True)
        mixer.set_track_offset(0)
        self.song().view.selected_track = mixer.channel_strip(0)._track
        mixer.channel_strip(0)
        """set up the mixer buttons"""
        mixer.set_select_buttons(
            ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, 56),
            ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, 54))
        mixer.master_strip().set_select_button(
            ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, 94))
        mixer.selected_strip().set_mute_button(
            ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, 42))
        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, 46))
        """set up the mixer sliders"""
        mixer.selected_strip().set_volume_control(
            SliderElement(MIDI_CC_TYPE, CHANNEL, 14))
        """note that we have split the mixer functions across two scripts, in order to have two session highlight 
        boxes (one red, one yellow), so there are a few things which we are not doing here... """

        self.log_message("Captain's log stardate 2")
    def _load_MIDI_map(self):
        is_momentary = True
        for note in range(128):
            button = ButtonElement(is_momentary, MESSAGETYPE, BUTTONCHANNEL,
                                   note)
            button.name = 'Note_' + str(note)
            self._note_map.append(button)

        # add side buttons as channel 4
        # button = ButtonElement(is_momentary, MESSAGETYPE, SIDE_BUTTONS_CHANNEL, TOP_LEFT_SIDE_BTN_VAL)
        # self._side_buttons.append(button)
        # button = ButtonElement(is_momentary, MESSAGETYPE, SIDE_BUTTONS_CHANNEL, BTM_LEFT_SIDE_BTN_VAL)
        # self._side_buttons.append(button)
        # button = ButtonElement(is_momentary, MESSAGETYPE, SIDE_BUTTONS_CHANNEL, TOP_RITE_SIDE_BTN_VAL)
        # self._side_buttons.append(button)
        # button = ButtonElement(is_momentary, MESSAGETYPE, SIDE_BUTTONS_CHANNEL, BTM_RITE_SIDE_BTN_VAL)
        # self._side_buttons.append(button)

        self._note_map.append(
            None)  #add None to the end of the list, selectable with [-1]
        if MESSAGETYPE == MIDI_CC_TYPE and BUTTONCHANNEL == SLIDERCHANNEL:
            for ctrl in range(128):
                self._ctrl_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)
Пример #25
0
    def _setup_custom_components(self):
        is_momentary = True
        master_select_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0,
                                             80)
        master_select_button.name = 'Master_Select_Button'
        select_buttons = []
        arm_buttons = []
        sliders = []
        for track in range(8):
            select_buttons.append(
                ButtonElement(is_momentary, MIDI_NOTE_TYPE, track, 51))
            arm_buttons.append(
                ButtonElement(is_momentary, MIDI_NOTE_TYPE, track, 48))
            sliders.append(SliderElement(MIDI_CC_TYPE, track, 7))
            select_buttons[-1].name = str(track) + '_Select_Button'
            arm_buttons[-1].name = str(track) + '_Arm_Button'
            sliders[-1].name = str(track) + '_Volume_Control'

        transport = TransportComponent()
        transport.name = 'Transport'
        slider_modes = SliderModesComponent(self._mixer, tuple(sliders))
        slider_modes.name = 'Slider_Modes'
        self._shift_modes = ShiftableSelectorComponent(
            tuple(select_buttons), master_select_button, tuple(arm_buttons),
            self._matrix, self._session, self._session_zoom, self._mixer,
            transport, slider_modes, self._send_introduction_message)
        self._shift_modes.name = 'Shift_Modes'
        self._shift_modes.set_mode_toggle(self._shift_button)
Пример #26
0
    def __init__(self, c_instance):
        ControlSurface.__init__(self, c_instance)
        with self.component_guard():
            self.set_pad_translations(PAD_TRANSLATIONS)
            self._device_selection_follows_track_selection = True
            self._suggested_input_port = 'Impulse'
            self._suggested_output_port = 'Impulse'
            self._has_sliders = True
            self._current_midi_map = None
            self._display_reset_delay = -1
            self._shift_button = ButtonElement(IS_MOMENTARY, MIDI_CC_TYPE, 0, 39)
            self._preview_button = ButtonElement(IS_MOMENTARY, MIDI_CC_TYPE, 0, 41)
            self._master_slider = SliderElement(MIDI_CC_TYPE, 0, 8)
            self._shift_button.name = 'Shift_Button'
            self._master_slider.name = 'Master_Volume_Control'
            self._master_slider.add_value_listener(self._slider_value, identify_sender=True)
            self._preview_button.add_value_listener(self._preview_value)
            self._setup_mixer()
            self._setup_session()
            self._setup_transport()
            self._setup_device()
            self._setup_name_display()
            device_button = ButtonElement(not IS_MOMENTARY, MIDI_CC_TYPE, 1, 10)
            mixer_button = ButtonElement(not IS_MOMENTARY, MIDI_CC_TYPE, 1, 9)
            device_button.name = 'Encoder_Device_Mode'
            mixer_button.name = 'Encoder_Mixer_Mode'
            self._encoder_modes = EncoderModeSelector(self._device_component, self._mixer, self._next_bank_button, self._prev_bank_button, self._encoders)
            self._encoder_modes.set_device_mixer_buttons(device_button, mixer_button)
            self._string_to_display = None
            for component in self.components:
                component.set_enabled(False)

        return
Пример #27
0
    def _setup_device_control(self):
        is_momentary = True
        self._device = DeviceComponent()
        self._channelstrip = ChannelStripComponent()
        self._device.name = 'Device_Component'

        device_param_controls = []
        for index in range(8):
            device_param_controls.append(
                SliderElement(MIDI_CC_TYPE, CHANNEL_FX, MACRO_CONTROLS[index]))
        self._device.set_parameter_controls(device_param_controls)
        self._device.set_on_off_button(
            ButtonElement(True, MIDI_CC_TYPE, CHANNEL_FX, DEVICE_ON))
        self._device.set_lock_button(
            ButtonElement(True, MIDI_CC_TYPE, CHANNEL_FX, DEVICE_LOCK))
        # self._device.set_bank_down_value(ButtonElement(True, MIDI_CC_TYPE, CHANNEL, DEVICE_LOCK))
        # self._device.set_bank_up_value(ButtonElement(True, MIDI_CC_TYPE, CHANNEL, DEVICE_ON))
        up_bank_button = ButtonElement(True, MIDI_CC_TYPE, CHANNEL_FX,
                                       DEVICE_BANK_UP)
        down_bank_button = ButtonElement(True, MIDI_CC_TYPE, CHANNEL_FX,
                                         DEVICE_BANK_DOWN)
        # self._device.set_bank_buttons(down_bank_button, up_bank_button)
        self.set_device_component(self._device)
        self._device_nav = DeviceNavComponent()
        self._device_nav.set_device_nav_buttons(
            ButtonElement(True, MIDI_CC_TYPE, CHANNEL_FX, PREVIOUS_DEVICE),
            ButtonElement(True, MIDI_CC_TYPE, CHANNEL_FX, NEXT_DEVICE))
        self._device.set_bank_prev_button(down_bank_button)
        self._device.set_bank_next_button(up_bank_button)
Пример #28
0
    def doStuff(self, x):

        try:
            data, addr = self.sock.recvfrom(64)  # buffer size is 1024 byte

            addressPattern = data[:data.find("\0")]

            #data = data.split(',i')
            #v = struct.unpack('>i',data[1][2:(2+4)])[0]
            data = data.split(',ii')
            v = struct.unpack('>ii', data[1][1:])

            track_number = v[0]
            midi_cc = v[1]

            b = SliderElement(1, 0, midi_cc)
            song = self.song()

            if (addressPattern == "/pan"):
                b.connect_to(song.tracks[track_number].mixer_device.panning)
            elif (addressPattern == "/volume"):
                b.connect_to(song.tracks[track_number].mixer_device.volume)
            self.show_message(addressPattern)
        except socket.error:
            pass
    def _load_MIDI_map(self):
        # Midi messages can be either "Toggle" or "Momentary".
        #
        # A toggle message consists of a single message with value 127, while a
        # momentary message first sends 127, followed by 0.
        #
        # Set this flag according to which kind of messages you're using.
        is_momentary = True

        for note in range(128):
            button = ButtonElement(is_momentary, MESSAGETYPE, BUTTONCHANNEL,
                                   note)
            button.name = 'Note_' + str(note)
            self._note_map.append(button)
        self._note_map.append(
            None)  #add None to the end of the list, selectable with [-1]
        if MESSAGETYPE == MIDI_CC_TYPE and BUTTONCHANNEL == SLIDERCHANNEL:
            for ctrl in range(128):
                self._ctrl_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)
Пример #30
0
 def __init__(self, modeselector, editsection, *a, **k):
     super(KnobSection, self).__init__(*a, **k)
     self._modesel = modeselector
     self._editsection = editsection
     self._modesel.connect_main_knob(self)
     is_momentary = True
     self.main_knob = SliderElement(MIDI_CC_TYPE, 1, 85)
     self.push_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 1, 87)
     self.volume_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 3, 110)
     self.swing_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 3, 111)
     self.tempo_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 3, 112)
     self.xfade_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 3, 116)
     self._mode_button = self.canonical_parent.create_gated_button(
         80, KSM_HUES[0])
     self._color_edit_button = ButtonElement(is_momentary, MIDI_CC_TYPE, 3,
                                             113)
     self._set_inicliplen_button = ButtonElement(is_momentary, MIDI_CC_TYPE,
                                                 3, 122)
     self._set_quantize_button = ButtonElement(is_momentary, MIDI_CC_TYPE,
                                               3, 126)
     self.do_main.subject = self.main_knob
     self.do_main_push.subject = self.push_button
     self._do_volume.subject = self.volume_button
     self._do_swing.subject = self.swing_button
     self._do_tempo.subject = self.tempo_button
     self._do_xfade.subject = self.xfade_button
     self._do_toggle_mode.subject = self._mode_button
     self._do_color_button.subject = self._color_edit_button
     self._do_mikr_cliplen.subject = self._set_inicliplen_button
     self._do_mikr_quantize.subject = self._set_quantize_button
     self._do_dedicated_rec_quantize.subject = SliderElement(
         MIDI_CC_TYPE, 2, 112)
     self._do_dedicated_clip_quantize.subject = SliderElement(
         MIDI_CC_TYPE, 2, 113)
     self._radio_buttons = (self.volume_button, self.swing_button,
                            self.tempo_button, self.xfade_button,
                            self._color_edit_button)
     self._do_button_left.subject = ButtonElement(is_momentary,
                                                  MIDI_CC_TYPE, 2, 120)
     self._do_button_right.subject = ButtonElement(is_momentary,
                                                   MIDI_CC_TYPE, 2, 121)
     self.volume_button.send_value(0, True)
     self._mode_button.set_color(KSM_HUES[0])
     self.knob_action = self._scroll_action
     self._prev_mode = None
     self._prev_action = None
     return