def set_enabled(self, enabled):
     if self.is_enabled and not enabled:
         # disable implicit arm while leaving.
         if (self._parent != None and self._notify_parent):
             if (self._selected_track.can_be_armed):
                 self._selected_track.implicit_arm = False
     MixerComponent.set_enabled(self, enabled)
Beispiel #2
0
 def __init__(self, *a, **k):
     super(MPK261, self).__init__(*a, **k)
     with self.component_guard():
         midimap = MidiMap()
         drum_rack = DrumRackComponent(
             name='Drum_Rack',
             is_enabled=False,
             layer=Layer(pads=midimap['Drum_Pads']))
         drum_rack.set_enabled(True)
         transport = TransportComponent(
             name='Transport',
             is_enabled=False,
             layer=Layer(play_button=midimap['Play'],
                         record_button=midimap['Record'],
                         stop_button=midimap['Stop'],
                         seek_forward_button=midimap['Forward'],
                         seek_backward_button=midimap['Backward'],
                         loop_button=midimap['Loop']))
         transport.set_enabled(True)
         mixer_size = len(midimap['Sliders'])
         mixer = MixerComponent(mixer_size,
                                name='Mixer',
                                is_enabled=False,
                                layer=Layer(
                                    volume_controls=midimap['Sliders'],
                                    pan_controls=midimap['Encoders'],
                                    arm_buttons=midimap['Arm_Buttons']))
         mixer.set_enabled(True)
Beispiel #3
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 set_enabled(self, enabled):
		if self.is_enabled and not enabled:
			# disable implicit arm while leaving.
			if self._implicit_arm:
				if self.selected_track.can_be_armed:
					self.selected_track.implicit_arm = False
		MixerComponent.set_enabled(self, enabled)
Beispiel #5
0
 def set_enabled(self, enabled):
     if self.is_enabled and not enabled:
         # disable implicit arm while leaving.
         if self._implicit_arm:
             if self.selected_track.can_be_armed:
                 self.selected_track.implicit_arm = False
     MixerComponent.set_enabled(self, enabled)
	def set_enabled(self, enabled):
		if self.is_enabled and not enabled:
			# disable implicit arm while leaving.
			if(self._parent != None and self._notify_parent):
				if (self._selected_track.can_be_armed):
					self._selected_track.implicit_arm = False
		MixerComponent.set_enabled(self, enabled)
 def __init__(self, *a, **k):
     super(Alesis_VI, self).__init__(*a, **k)
     with self.component_guard():
         midimap = MidiMap()
         transport = TransportComponent(name='Transport', is_enabled=False, layer=Layer(play_button=midimap['Play'], stop_button=midimap['Stop'], loop_button=midimap['Loop'], record_button=midimap['Record'], seek_forward_button=midimap['Forward'], seek_backward_button=midimap['Backward']))
         mixer_size = len(midimap['Volume_Encoders'])
         mixer = MixerComponent(mixer_size, name='Mixer', is_enabled=False, layer=Layer(volume_controls=midimap['Volume_Encoders']))
         transport.set_enabled(True)
         mixer.set_enabled(True)
Beispiel #8
0
 def __init__(self, *a, **k):
     super(Alesis_VI, self).__init__(*a, **k)
     with self.component_guard():
         midimap = MidiMap()
         transport = TransportComponent(name='Transport', is_enabled=False, layer=Layer(play_button=midimap['Play'], stop_button=midimap['Stop'], loop_button=midimap['Loop'], record_button=midimap['Record'], seek_forward_button=midimap['Forward'], seek_backward_button=midimap['Backward']))
         mixer_size = len(midimap['Volume_Encoders'])
         mixer = MixerComponent(mixer_size, name='Mixer', is_enabled=False, layer=Layer(volume_controls=midimap['Volume_Encoders']))
         transport.set_enabled(True)
         mixer.set_enabled(True)
 def __init__(self, *a, **k):
     super(MPK249, self).__init__(*a, **k)
     with self.component_guard():
         midimap = MidiMap()
         drum_rack = DrumRackComponent(name='Drum_Rack', is_enabled=False, layer=Layer(pads=midimap['Drum_Pads']))
         drum_rack.set_enabled(True)
         transport = TransportComponent(name='Transport', is_enabled=False, layer=Layer(play_button=midimap['Play'], record_button=midimap['Record'], stop_button=midimap['Stop'], seek_forward_button=midimap['Forward'], seek_backward_button=midimap['Backward'], loop_button=midimap['Loop']))
         transport.set_enabled(True)
         mixer_size = len(midimap['Sliders'])
         mixer = MixerComponent(mixer_size, name='Mixer', is_enabled=False, layer=Layer(volume_controls=midimap['Sliders'], pan_controls=midimap['Encoders'], arm_buttons=midimap['Arm_Buttons']))
         mixer.set_enabled(True)
Beispiel #10
0
    def __init__(self, *a, **k):
        super(MPK261Custom, self).__init__(*a, **k)
        with self.component_guard():
            midimap = MidiMap()
            drum_rack = DrumRackComponent(name=u'Drum_Rack', is_enabled=False,
                                          layer=Layer(pads=midimap[u'Drum_Pads']))
            drum_rack.set_enabled(True)
            transport = TransportComponent(name=u'Transport', is_enabled=False, layer=Layer(
                play_button=midimap[u'Play'],
                record_button=midimap[u'Record'],
                stop_button=midimap[u'Stop'],
                seek_forward_button=midimap[u'Forward'],
                seek_backward_button=midimap[u'Backward'],
                loop_button=midimap[u'Loop'],
                metronome_button=midimap[u'Metronome'],
                tap_tempo_button=midimap[u'TapTempoButton'],
                quant_toggle_button=midimap[u'RecQuantButton'],
                overdub_button=midimap[u'OverdubButton']
                ))
            transport.set_enabled(True)
            mixer_size = len(midimap[u'Sliders'])

            # Custom changes: Adds the "mute" buttons. By default, mute = turns light on.
            # invert_mute_feedback flips it around so muting = turns light off.
            mixer = MixerComponent(mixer_size, name=u'Mixer', is_enabled=False,
                                   invert_mute_feedback=True,
                                   layer=Layer(
                                       volume_controls=midimap[u'Sliders'],
                                       pan_controls=midimap[u'Encoders'],
                                       arm_buttons=midimap[u'Arm_Buttons'],
                                       mute_buttons=midimap[u'Mute_Buttons'],
                                   ))
            mixer.set_enabled(True)

            # Adds the blue hand controls.
            device = DeviceComponent(
                name=u'Device', is_enabled=False,
                layer=Layer(parameter_controls=midimap[u'EncodersB1']),
                device_selection_follows_track_selection=True)
            device.set_enabled(True)
            self.set_device_component(device)

            session = SessionComponent(
                SESSION_WIDTH, SESSION_HEIGHT, auto_name=True, enable_skinning=True,
                is_enabled=False, layer=Layer(
                    clip_launch_buttons=midimap[u'Drum_Pads_BankB'],
                    stop_track_clip_buttons=midimap[u'Drum_Pads_BankC_BottomRow'],
                    scene_launch_buttons=midimap[u'Drum_Pads_BankD_RightColumn']))
            session.set_enabled(True)

        self.log_message(u' ***** MPK261 Custom script loaded ****')
Beispiel #11
0
class KorgKaossDJ(ControlSurface):
    __module__ = __name__
    __doc__ = " Korg Kaoss DJ controller script "

    def __init__(self, c_instance):
        """everything except the '_on_selected_track_changed' override and 'disconnect' runs from here"""
        ControlSurface.__init__(self, c_instance)

        self._selected_track = None
        self._current_clip = None

        with self.component_guard():
            self._create_controls()
            self._setup_transport_control(
            )  # Run the transport setup part of the script
            self._setup_loop_control()
            self._setup_scrub_control()
            self._setup_fx_control()
            self._setup_mixer_control()  # Setup the mixer object
            self._setup_session_control()  # Setup the session object

    def _create_controls(self):

        # ------ SLIDER
        self._crossfader_slider = SliderElement(MIDI_CC_TYPE, CHANNEL_CENTER,
                                                23)

        self._left_volume_slider = SliderElement(MIDI_CC_TYPE, CHANNEL_LEFT,
                                                 24)
        self._right_volume_slider = SliderElement(MIDI_CC_TYPE, CHANNEL_RIGHT,
                                                  24)

        self._left_tempo_fader = SliderElement(MIDI_CC_TYPE, CHANNEL_LEFT, 25)
        self._right_tempo_fader = SliderElement(MIDI_CC_TYPE, CHANNEL_RIGHT,
                                                25)

        # ------ BUTTONS
        self._left_play_button = ButtonElement(True, MIDI_NOTE_TYPE,
                                               CHANNEL_LEFT, 27)
        self._right_play_button = ButtonElement(True, MIDI_NOTE_TYPE,
                                                CHANNEL_RIGHT, 27)

        self._left_prelisten_button = ButtonElement(True, MIDI_NOTE_TYPE,
                                                    CHANNEL_LEFT, 25)
        self._right_prelisten_button = ButtonElement(True, MIDI_NOTE_TYPE,
                                                     CHANNEL_RIGHT, 25)

        self._left_fx_button = ButtonElement(True, MIDI_NOTE_TYPE,
                                             CHANNEL_LEFT, 24)
        self._right_fx_button = ButtonElement(True, MIDI_NOTE_TYPE,
                                              CHANNEL_RIGHT, 24)

        self._left_A_button = ButtonElement(True, MIDI_NOTE_TYPE, CHANNEL_LEFT,
                                            14)
        self._right_B_button = ButtonElement(True, MIDI_NOTE_TYPE,
                                             CHANNEL_RIGHT, 14)

        self._left_shift_button = ButtonElement(
            True,
            MIDI_NOTE_TYPE,
            CHANNEL_LEFT,
            26,
            name='Shift_Button',
            resource_type=PrioritizedResource)
        self._right_shift_button = ButtonElement(
            True,
            MIDI_NOTE_TYPE,
            CHANNEL_RIGHT,
            26,
            name='Shift_Button',
            resource_type=PrioritizedResource)

        self._left_sync_button = ButtonElement(True, MIDI_NOTE_TYPE,
                                               CHANNEL_LEFT, 29)
        self._right_sync_button = ButtonElement(True, MIDI_NOTE_TYPE,
                                                CHANNEL_RIGHT, 29)

        self._left_cue_button = ButtonElement(True, MIDI_NOTE_TYPE,
                                              CHANNEL_LEFT, 30)
        self._right_cue_button = ButtonElement(True, MIDI_NOTE_TYPE,
                                               CHANNEL_RIGHT, 30)

        self._left_sync_button_shift = ButtonElement(True, MIDI_NOTE_TYPE,
                                                     CHANNEL_LEFT, 47)
        self._right_sync_button_shift = ButtonElement(True, MIDI_NOTE_TYPE,
                                                      CHANNEL_RIGHT, 47)

        self._left_cue_button_shift = ButtonElement(True, MIDI_NOTE_TYPE,
                                                    CHANNEL_LEFT, 48)
        self._right_cue_button_shift = ButtonElement(True, MIDI_NOTE_TYPE,
                                                     CHANNEL_RIGHT, 48)

        for i in range(3):
            for side, channel in zip(['_left', '_right'],
                                     [CHANNEL_LEFT, CHANNEL_RIGHT]):
                setattr(self, side + '_loop_' + str(i + 1),
                        ButtonElement(True, MIDI_NOTE_TYPE, channel, 15 + i))
                setattr(self, side + '_loop_' + str(i + 1) + '_shift',
                        ButtonElement(True, MIDI_NOTE_TYPE, channel, 40 + i))
                setattr(self, side + '_hotcue_' + str(i + 1),
                        ButtonElement(True, MIDI_NOTE_TYPE, channel, 18 + i))
                setattr(self, side + '_hotcue_' + str(i + 1) + '_shift',
                        ButtonElement(True, MIDI_NOTE_TYPE, channel, 43 + i))
                setattr(self, side + '_nolight_' + str(i + 1),
                        ButtonElement(True, MIDI_NOTE_TYPE, channel, 21 + i))

        # ------ ENCODER

        # browser
        self._center_browse_encoder = EncoderElement(
            MIDI_CC_TYPE, CHANNEL_CENTER, 30,
            Live.MidiMap.MapMode.relative_smooth_two_compliment)
        # gain left
        self._left_gain_encoder = EncoderElement(MIDI_CC_TYPE, CHANNEL_LEFT,
                                                 26,
                                                 Live.MidiMap.MapMode.absolute)
        # gain right
        self._right_gain_encoder = EncoderElement(
            MIDI_CC_TYPE, CHANNEL_RIGHT, 26, Live.MidiMap.MapMode.absolute)

        # middle light off -> does not send on-off messages!
        self._left_jogwheel_encoder = EncoderElement(
            MIDI_CC_TYPE, CHANNEL_LEFT, 14,
            Live.MidiMap.MapMode.relative_smooth_two_compliment)
        self._right_jogwheel_encoder = EncoderElement(
            MIDI_CC_TYPE, CHANNEL_RIGHT, 14,
            Live.MidiMap.MapMode.relative_smooth_two_compliment)

        self._left_jogwheel_encoder_shift = EncoderElement(
            MIDI_CC_TYPE, CHANNEL_LEFT, 15,
            Live.MidiMap.MapMode.relative_smooth_two_compliment)
        self._right_jogwheel_encoder_shift = EncoderElement(
            MIDI_CC_TYPE, CHANNEL_RIGHT, 15,
            Live.MidiMap.MapMode.relative_smooth_two_compliment)

        # middle light on  -> sends on-off message on channel 31!
        self._left_jogwheel_encoder_active = EncoderElement(
            MIDI_CC_TYPE, CHANNEL_LEFT, 16,
            Live.MidiMap.MapMode.relative_smooth_two_compliment)
        self._left_jogwheel_encoder_active_button = ButtonElement(
            True, MIDI_NOTE_TYPE, CHANNEL_LEFT, 31)

        self._right_jogwheel_encoder_active = EncoderElement(
            MIDI_CC_TYPE, CHANNEL_RIGHT, 16,
            Live.MidiMap.MapMode.relative_smooth_two_compliment)
        self._right_jogwheel_encoder_active_button = ButtonElement(
            True, MIDI_NOTE_TYPE, CHANNEL_RIGHT, 31)

        # FX touchpad (same for both channels so we need to read only one)
        self._touchpad_x_encoder = EncoderElement(
            MIDI_CC_TYPE, CHANNEL_LEFT, 12, Live.MidiMap.MapMode.absolute)
        self._touchpad_y_encoder = EncoderElement(
            MIDI_CC_TYPE, CHANNEL_LEFT, 13, Live.MidiMap.MapMode.absolute)
        self._touchpad_x_encoder_shift = EncoderElement(
            MIDI_CC_TYPE, CHANNEL_CENTER, 17, Live.MidiMap.MapMode.absolute)
        self._touchpad_y_encoder_shift = EncoderElement(
            MIDI_CC_TYPE, CHANNEL_CENTER, 18, Live.MidiMap.MapMode.absolute)

        # hi-mid-lo encoders
        _device_MSG_IDS = [27, 28, 29]
        self._device_encoders = ButtonMatrixElement(
            rows=[[
                EncoderElement(MIDI_CC_TYPE, CHANNEL_LEFT, MSG_ID,
                               Live.MidiMap.MapMode.absolute)
                for MSG_ID in _device_MSG_IDS
            ],
                  [
                      EncoderElement(MIDI_CC_TYPE, CHANNEL_RIGHT, MSG_ID,
                                     Live.MidiMap.MapMode.absolute)
                      for MSG_ID in _device_MSG_IDS
                  ]])

    def _setup_loop_control(self):
        # set looping function ality to Loop- and HotCue buttons
        self._looper_left = LooperComponent(self,
                                            assign_track=0,
                                            move_increment=4,
                                            increase_factor=(0, 2),
                                            decrease_factor=(0, 2),
                                            start_loop_length=32,
                                            quantize_start=4)
        self._looper_right = LooperComponent(self,
                                             assign_track=1,
                                             move_increment=4,
                                             increase_factor=(0, 2),
                                             decrease_factor=(0, 2),
                                             start_loop_length=32,
                                             quantize_start=1)

        self._looper_left_fine = LooperComponent(self,
                                                 assign_track=0,
                                                 move_increment=1,
                                                 increase_factor=(1, 1),
                                                 decrease_factor=(1, 1),
                                                 start_loop_length=16,
                                                 quantize_start=1)
        self._looper_right_fine = LooperComponent(self,
                                                  assign_track=1,
                                                  move_increment=1,
                                                  increase_factor=(1, 1),
                                                  decrease_factor=(1, 1),
                                                  start_loop_length=16,
                                                  quantize_start=1)

        self._looper_left.set_loop_decrease_button(self._left_loop_1)
        self._looper_left.set_loop_start_button(self._left_loop_2)
        self._looper_left.set_loop_increase_button(self._left_loop_3)
        self._looper_left.set_loop_move_left_button(self._left_loop_1_shift)
        self._looper_left.set_loop_toggle_button(self._left_loop_2_shift)
        self._looper_left.set_loop_move_right_button(self._left_loop_3_shift)

        self._looper_left_fine.set_loop_decrease_button(self._left_hotcue_1)
        self._looper_left_fine.set_loop_start_button(self._left_hotcue_2)
        self._looper_left_fine.set_loop_increase_button(self._left_hotcue_3)
        self._looper_left_fine.set_loop_move_left_button(
            self._left_hotcue_1_shift)
        self._looper_left_fine.set_loop_toggle_button(
            self._left_hotcue_2_shift)
        self._looper_left_fine.set_loop_move_right_button(
            self._left_hotcue_3_shift)

        self._looper_right.set_loop_decrease_button(self._right_loop_1)
        self._looper_right.set_loop_start_button(self._right_loop_2)
        self._looper_right.set_loop_increase_button(self._right_loop_3)
        self._looper_right.set_loop_move_left_button(self._right_loop_1_shift)
        self._looper_right.set_loop_toggle_button(self._right_loop_2_shift)
        self._looper_right.set_loop_move_right_button(self._right_loop_3_shift)

        self._looper_right_fine.set_loop_decrease_button(self._right_hotcue_1)
        self._looper_right_fine.set_loop_start_button(self._right_hotcue_2)
        self._looper_right_fine.set_loop_increase_button(self._right_hotcue_3)
        self._looper_right_fine.set_loop_move_left_button(
            self._right_hotcue_1_shift)
        self._looper_right_fine.set_loop_toggle_button(
            self._right_hotcue_2_shift)
        self._looper_right_fine.set_loop_move_right_button(
            self._right_hotcue_3_shift)

    def _setup_scrub_control(self):
        self._scrub_left = ScrubComponent(self,
                                          assign_track=LEFT_STRIP_ID,
                                          increment_scrub=1,
                                          increment_fine=0.1)
        self._scrub_right = ScrubComponent(self,
                                           assign_track=RIGHT_STRIP_ID,
                                           increment_scrub=1,
                                           increment_fine=0.1)

        self._scrub_left.set_move_position_button(self._left_jogwheel_encoder)
        self._scrub_left.set_move_position_coarse_button(
            self._left_jogwheel_encoder_shift)
        self._scrub_left.set_scrub_position_button(
            self._left_jogwheel_encoder_active)
        self._scrub_left.set_scrub_on_off_button(
            self._left_jogwheel_encoder_active_button)

        self._scrub_right.set_move_position_button(
            self._right_jogwheel_encoder)
        self._scrub_right.set_move_position_coarse_button(
            self._right_jogwheel_encoder_shift)
        self._scrub_right.set_scrub_position_button(
            self._right_jogwheel_encoder_active)
        self._scrub_right.set_scrub_on_off_button(
            self._right_jogwheel_encoder_active_button)

    def _setup_fx_control(self):
        self._fx_left = FXComponent(self, assign_track=LEFT_STRIP_ID)
        self._fx_left.set_touchpad_x_button(self._touchpad_x_encoder)
        self._fx_left.set_touchpad_y_button(self._touchpad_y_encoder)
        self._fx_left.set_touchpad_x_shift_button(
            self._touchpad_x_encoder_shift)
        self._fx_left.set_touchpad_y_shift_button(
            self._touchpad_y_encoder_shift)
        self._fx_left.set_fx_on_off_button(self._left_fx_button)
        self._fx_left.set_gain_encoder_button(self._left_gain_encoder)

        self._fx_left.set_warping_button(self._left_sync_button_shift)
        self._fx_left.set_warp_mode_button(self._left_sync_button)

        self._fx_left.set_pitch_down_button(self._left_nolight_1)
        self._fx_left.set_pitch_up_button(self._left_nolight_3)

        self._fx_right = FXComponent(self, assign_track=RIGHT_STRIP_ID)
        self._fx_right.set_touchpad_x_button(self._touchpad_x_encoder)
        self._fx_right.set_touchpad_y_button(self._touchpad_y_encoder)
        self._fx_right.set_touchpad_x_shift_button(
            self._touchpad_x_encoder_shift)
        self._fx_right.set_touchpad_y_shift_button(
            self._touchpad_y_encoder_shift)
        self._fx_right.set_fx_on_off_button(self._right_fx_button)
        self._fx_right.set_gain_encoder_button(self._right_gain_encoder)

        self._fx_right.set_warping_button(self._right_sync_button_shift)
        self._fx_right.set_warp_mode_button(self._right_sync_button)

    def _setup_transport_control(self):
        """set up the sliders"""

        self._transport = TransportComponent(self,
                                             name=u'Transport',
                                             is_enabled=False)

        #set tempo-fader
        self._transport.set_tempo_control(
            self._left_tempo_fader,
            fine_control=self._right_tempo_fader)  #(control, fine_control)

        self._transport.set_enabled(True)

    def _setup_mixer_control(self):
        self._mixer = MixerComponent(num_tracks=2,
                                     num_returns=0,
                                     name=u'Mixer',
                                     is_enabled=False)

        self._mixer.set_crossfader_control(self._crossfader_slider)

        # set volume sliders
        self._mixer.channel_strip(LEFT_STRIP_ID).set_volume_control(
            self._left_volume_slider)
        self._mixer.channel_strip(RIGHT_STRIP_ID).set_volume_control(
            self._right_volume_slider)

        # set prelisten buttons
        self._mixer.channel_strip(LEFT_STRIP_ID).set_solo_button(
            self._left_prelisten_button)
        self._mixer.channel_strip(RIGHT_STRIP_ID).set_solo_button(
            self._right_prelisten_button)

        # use fx buttons to select a track
        self._mixer.channel_strip(LEFT_STRIP_ID).set_select_button(
            self._left_A_button)
        self._mixer.channel_strip(RIGHT_STRIP_ID).set_select_button(
            self._right_B_button)

        self._mixer.set_enabled(True)

    def _setup_session_control(self):
        self._session = SessionComponent(num_tracks=2,
                                         num_scenes=1,
                                         name=u'Session',
                                         is_enabled=False)

        # set horizontal scene selector (this is why we import SessionComponent from _Arturia!)
        self._session.set_scene_select_control(self._center_browse_encoder)

        # set launch-buttons for scene
        self._session.selected_scene().clip_slot(0).set_launch_button(
            self._left_play_button)
        self._session.selected_scene().clip_slot(1).set_launch_button(
            self._right_play_button)

        # hightlite the current selection
        self.set_highlighting_session_component(self._session)
        self._session.set_enabled(True)

        # ----------- add functionality to turn playing-light on-off
        def update_lights(track, button):
            playing_clip_idx = track.playing_slot_index
            if playing_clip_idx >= 0:
                button.turn_on()
            else:
                button.turn_off()

        def update_playlight_left():
            track = self.song().tracks[LEFT_STRIP_ID]
            update_lights(track, self._left_play_button)

        def update_playlight_right():
            track = self.song().tracks[RIGHT_STRIP_ID]
            update_lights(track, self._right_play_button)

        self.song().tracks[LEFT_STRIP_ID].add_playing_slot_index_listener(
            update_playlight_left)
        self.song().tracks[RIGHT_STRIP_ID].add_playing_slot_index_listener(
            update_playlight_right)
        # override the selected scene change behaviour of the playing light
        self.song().view.add_selected_scene_listener(update_playlight_left)
        self.song().view.add_selected_scene_listener(update_playlight_right)
Beispiel #12
0
class KeyPad(ControlSurface):
    """
    Reloop KeyPad controller script.
    """
    _encoder_range = range(73, 81)
    _product_model_id = 101

    def __init__(self, c_instance):
        super(KeyPad, self).__init__(c_instance)
        with self.component_guard():
            self._create_controls()
            self._setup_mixer()
            self._setup_transport()
            self._setup_session()
            self._setup_cue_control()
            self.set_pad_translations(PAD_TRANSLATIONS)

    def _preset_message(self, send_byte):
        """ Sysex message for setting the preset to #2. """
        return (240, 38, self._product_model_id, send_byte, 17, 2, 247)

    def refresh_state(self):
        super(KeyPad, self).refresh_state()
        self.schedule_message(2, self._send_midi, self._preset_message(1))

    def handle_sysex(self, midi_bytes):
        if midi_bytes != self._preset_message(2):
            super(KeyPad, self).handle_sysex(midi_bytes)
        else:
            map(lambda x: x.set_enabled(True),
                (self._mixer, self._session, self._transport,
                 self._cue_control))

    def _create_controls(self):
        def make_controls_range(maker, label, cc_range):
            ccs = [(index + 1, cc) for index, cc in enumerate(cc_range)]
            return [maker(1, cc, label % index) for index, cc in ccs] + [
                maker(2, cc, label % (index + len(ccs))) for index, cc in ccs
            ]

        def make_controls(maker, label, cc_offset):
            return make_controls_range(maker, label,
                                       xrange(cc_offset, cc_offset + 8))

        make_non_momentary_button = partial(make_button, is_momentary=False)
        self._encoders = make_controls(make_encoder, 'Encoder_%d', 57)
        self._rotaries_a = make_controls(make_slider, 'Rotary_A%d', 89)
        self._rotaries_b = make_controls(make_slider, 'Rotary_B%d', 97)
        self._faders = make_controls(make_slider, 'Fader_%d', 0)
        self._mute_buttons = make_controls(make_non_momentary_button,
                                           'Mute_%d_Button', 8)
        self._solo_buttons = make_controls(make_button, 'Solo_%d_Button', 24)
        self._arm_buttons = make_controls(make_button, 'Arm_%d_Button', 40)
        self._play_button = make_button(1, 105, 'Play_Button')
        self._stop_button = make_button(1, 106, 'Stop_Button')
        self._record_button = make_button(1, 107, 'Record_Button')
        self._encoder_pushes = make_controls_range(
            partial(make_button, is_momentary=False), 'Encoder_%d_Button',
            self._encoder_range)
        self._shifted_mute_buttons = make_controls(make_non_momentary_button,
                                                   'Shifted_Mute_%d_Button',
                                                   16)
        self._shifted_solo_buttons = make_controls(make_button,
                                                   'Shifted_Solo_%d_Button',
                                                   32)
        self._all_shifted_arm_buttons = make_controls(make_button,
                                                      'Shifted_Arm_%d_Button',
                                                      49)
        self._shifted_arm_buttons = [
            CombinedButtonsElement(
                buttons=(self._all_shifted_arm_buttons[index],
                         self._all_shifted_arm_buttons[index + 8]))
            for index in xrange(8)
        ]
        self._shifted_play_button = make_button(1, 108, 'Shifted_Play_Button')
        self._shifted_stop_button = make_button(1, 109, 'Shifted_Stop_Button')
        self._shifted_record_button = make_button(1, 110,
                                                  'Shifted_Record_Button')
        self._shifted_octave_down_button = make_button(
            1, 111, 'Shifted_Octave_Down_Button')
        self._shifted_octave_up_button = make_button(
            1, 112, 'Shifted_Octave_Up_Button')

    def _setup_mixer(self):
        self._mixer = MixerComponent(NUM_CHANNEL_STRIPS)
        self._mixer.name = 'Mixer'
        self._mixer.set_enabled(False)
        for index in xrange(NUM_CHANNEL_STRIPS):
            strip = self._mixer.channel_strip(index)
            strip.set_invert_mute_feedback(True)
            sends = ButtonMatrixElement(name='%d_Send_Controls' % (index + 1),
                                        rows=[(self._rotaries_a[index],
                                               self._rotaries_b[index])])
            strip.layer = Layer(volume_control=self._faders[index],
                                pan_control=self._encoders[index],
                                send_controls=sends,
                                mute_button=self._mute_buttons[index],
                                solo_button=self._solo_buttons[index],
                                arm_button=self._arm_buttons[index],
                                select_button=self._encoder_pushes[index])

    def _setup_transport(self):
        self._transport = TransportComponent(name='Transport')
        self._transport.set_enabled(False)
        self._transport.layer = Layer(
            play_button=self._play_button,
            stop_button=self._stop_button,
            record_button=self._record_button,
            overdub_button=self._shifted_record_button,
            loop_button=self._shifted_arm_buttons[3],
            tap_tempo_button=self._shifted_arm_buttons[4],
            metronome_button=self._shifted_arm_buttons[5],
            nudge_down_button=self._shifted_arm_buttons[6],
            nudge_up_button=self._shifted_arm_buttons[7])

    def _setup_session(self):
        self._session = SessionComponent(NUM_CHANNEL_STRIPS,
                                         name='Session_Control')
        self._session.set_enabled(False)
        stop_buttons = ButtonMatrixElement(name='Track_Stop_Buttons',
                                           rows=[self._shifted_solo_buttons])
        self._session.layer = Layer(
            stop_all_clips_button=self._shifted_stop_button,
            stop_track_clip_buttons=stop_buttons,
            select_prev_button=self._shifted_octave_down_button,
            select_next_button=self._shifted_octave_up_button)
        self._session.selected_scene().name = 'Selected_Scene_Control'
        self._session.selected_scene().layer = Layer(
            launch_button=self._shifted_play_button)
        for index in xrange(NUM_CHANNEL_STRIPS):
            slot = self._session.selected_scene().clip_slot(index)
            slot.layer = Layer(launch_button=self._shifted_mute_buttons[index])

    def _setup_cue_control(self):
        self._cue_control = CuePointControlComponent(name='Cue_Point_Control')
        self._cue_control.set_enabled(False)
        self._cue_control.layer = Layer(
            toggle_cue_button=self._shifted_arm_buttons[0],
            prev_cue_button=self._shifted_arm_buttons[1],
            next_cue_button=self._shifted_arm_buttons[2])
Beispiel #13
0
class KeyPad(ControlSurface):
    """
    Reloop KeyPad controller script.
    """
    _encoder_range = range(73, 81)
    _product_model_id = 101

    def __init__(self, c_instance):
        super(KeyPad, self).__init__(c_instance)
        with self.component_guard():
            self._create_controls()
            self._setup_mixer()
            self._setup_transport()
            self._setup_session()
            self._setup_cue_control()
            self.set_pad_translations(PAD_TRANSLATIONS)

    def _preset_message(self, send_byte):
        """ Sysex message for setting the preset to #2. """
        return (240,
         38,
         self._product_model_id,
         send_byte,
         17,
         2,
         247)

    def refresh_state(self):
        super(KeyPad, self).refresh_state()
        self.schedule_message(2, self._send_midi, self._preset_message(1))

    def handle_sysex(self, midi_bytes):
        if midi_bytes != self._preset_message(2):
            super(KeyPad, self).handle_sysex(midi_bytes)
        else:
            map(lambda x: x.set_enabled(True), (self._mixer,
             self._session,
             self._transport,
             self._cue_control))

    def _create_controls(self):

        def make_controls_range(maker, label, cc_range):
            ccs = [ (index + 1, cc) for index, cc in enumerate(cc_range) ]
            return [ maker(1, cc, label % index) for index, cc in ccs ] + [ maker(2, cc, label % (index + len(ccs))) for index, cc in ccs ]

        def make_controls(maker, label, cc_offset):
            return make_controls_range(maker, label, xrange(cc_offset, cc_offset + 8))

        make_non_momentary_button = partial(make_button, is_momentary=False)
        self._encoders = make_controls(make_encoder, 'Encoder_%d', 57)
        self._rotaries_a = make_controls(make_slider, 'Rotary_A%d', 89)
        self._rotaries_b = make_controls(make_slider, 'Rotary_B%d', 97)
        self._faders = make_controls(make_slider, 'Fader_%d', 0)
        self._mute_buttons = make_controls(make_non_momentary_button, 'Mute_%d_Button', 8)
        self._solo_buttons = make_controls(make_button, 'Solo_%d_Button', 24)
        self._arm_buttons = make_controls(make_button, 'Arm_%d_Button', 40)
        self._play_button = make_button(1, 105, 'Play_Button')
        self._stop_button = make_button(1, 106, 'Stop_Button')
        self._record_button = make_button(1, 107, 'Record_Button')
        self._encoder_pushes = make_controls_range(partial(make_button, is_momentary=False), 'Encoder_%d_Button', self._encoder_range)
        self._shifted_mute_buttons = make_controls(make_non_momentary_button, 'Shifted_Mute_%d_Button', 16)
        self._shifted_solo_buttons = make_controls(make_button, 'Shifted_Solo_%d_Button', 32)
        self._all_shifted_arm_buttons = make_controls(make_button, 'Shifted_Arm_%d_Button', 49)
        self._shifted_arm_buttons = [ CombinedButtonsElement(buttons=(self._all_shifted_arm_buttons[index], self._all_shifted_arm_buttons[index + 8])) for index in xrange(8) ]
        self._shifted_play_button = make_button(1, 108, 'Shifted_Play_Button')
        self._shifted_stop_button = make_button(1, 109, 'Shifted_Stop_Button')
        self._shifted_record_button = make_button(1, 110, 'Shifted_Record_Button')
        self._shifted_octave_down_button = make_button(1, 111, 'Shifted_Octave_Down_Button')
        self._shifted_octave_up_button = make_button(1, 112, 'Shifted_Octave_Up_Button')

    def _setup_mixer(self):
        self._mixer = MixerComponent(NUM_CHANNEL_STRIPS)
        self._mixer.name = 'Mixer'
        self._mixer.set_enabled(False)
        for index in xrange(NUM_CHANNEL_STRIPS):
            strip = self._mixer.channel_strip(index)
            strip.set_invert_mute_feedback(True)
            sends = ButtonMatrixElement(name='%d_Send_Controls' % (index + 1), rows=[(self._rotaries_a[index], self._rotaries_b[index])])
            strip.layer = Layer(volume_control=self._faders[index], pan_control=self._encoders[index], send_controls=sends, mute_button=self._mute_buttons[index], solo_button=self._solo_buttons[index], arm_button=self._arm_buttons[index], select_button=self._encoder_pushes[index])

    def _setup_transport(self):
        self._transport = TransportComponent(name='Transport')
        self._transport.set_enabled(False)
        self._transport.layer = Layer(play_button=self._play_button, stop_button=self._stop_button, record_button=self._record_button, overdub_button=self._shifted_record_button, loop_button=self._shifted_arm_buttons[3], tap_tempo_button=self._shifted_arm_buttons[4], metronome_button=self._shifted_arm_buttons[5], nudge_down_button=self._shifted_arm_buttons[6], nudge_up_button=self._shifted_arm_buttons[7])

    def _setup_session(self):
        self._session = SessionComponent(NUM_CHANNEL_STRIPS, name='Session_Control')
        self._session.set_enabled(False)
        stop_buttons = ButtonMatrixElement(name='Track_Stop_Buttons', rows=[self._shifted_solo_buttons])
        self._session.layer = Layer(stop_all_clips_button=self._shifted_stop_button, stop_track_clip_buttons=stop_buttons, select_prev_button=self._shifted_octave_down_button, select_next_button=self._shifted_octave_up_button)
        self._session.selected_scene().name = 'Selected_Scene_Control'
        self._session.selected_scene().layer = Layer(launch_button=self._shifted_play_button)
        for index in xrange(NUM_CHANNEL_STRIPS):
            slot = self._session.selected_scene().clip_slot(index)
            slot.layer = Layer(launch_button=self._shifted_mute_buttons[index])

    def _setup_cue_control(self):
        self._cue_control = CuePointControlComponent(name='Cue_Point_Control')
        self._cue_control.set_enabled(False)
        self._cue_control.layer = Layer(toggle_cue_button=self._shifted_arm_buttons[0], prev_cue_button=self._shifted_arm_buttons[1], next_cue_button=self._shifted_arm_buttons[2])
Beispiel #14
0
class MPK261MX(ControlSurface):
    def __init__(self, *a, **k):
        super(MPK261MX, self).__init__(*a, **k)
        self.show_message(
            "-----------------------= MPK261MX LOADING - maxcloutier13 says hi =----------------------------------------------------------"
        )
        self.log_message(
            "-----------------------= MPK261MX LOADING - maxcloutier13 says hi =----------------------------------------------------------"
        )
        with self.component_guard():
            midimap = MidiMap()
            #Super crude manual init for the custom buttons and faders
            #Bank A - Channel 1 -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
            self._Encoder0 = EncoderElement(
                MIDI_CC_TYPE,
                1,
                22,
                Live.MidiMap.MapMode.relative_two_compliment,
                name='Encoder0')
            self._Encoder1 = EncoderElement(
                MIDI_CC_TYPE,
                1,
                23,
                Live.MidiMap.MapMode.relative_two_compliment,
                name='Encoder1')
            self._Encoder2 = EncoderElement(
                MIDI_CC_TYPE,
                1,
                24,
                Live.MidiMap.MapMode.relative_two_compliment,
                name='Encoder2')
            self._Encoder3 = EncoderElement(
                MIDI_CC_TYPE,
                1,
                25,
                Live.MidiMap.MapMode.relative_two_compliment,
                name='Encoder3')
            self._Encoder4 = EncoderElement(
                MIDI_CC_TYPE,
                1,
                26,
                Live.MidiMap.MapMode.relative_two_compliment,
                name='Encoder4')
            self._Encoder5 = EncoderElement(
                MIDI_CC_TYPE,
                1,
                27,
                Live.MidiMap.MapMode.relative_two_compliment,
                name='Encoder5')
            self._Encoder6 = EncoderElement(
                MIDI_CC_TYPE,
                1,
                28,
                Live.MidiMap.MapMode.relative_two_compliment,
                name='Encoder6')
            self._Encoder7 = EncoderElement(
                MIDI_CC_TYPE,
                1,
                29,
                Live.MidiMap.MapMode.relative_two_compliment,
                name='Encoder7')
            self._ArmButton0 = ButtonElement(False,
                                             MIDI_CC_TYPE,
                                             0,
                                             32,
                                             name='ArmButton0')
            self._ArmButton1 = ButtonElement(False,
                                             MIDI_CC_TYPE,
                                             0,
                                             33,
                                             name='ArmButton1')
            self._ArmButton2 = ButtonElement(False,
                                             MIDI_CC_TYPE,
                                             0,
                                             34,
                                             name='ArmButton2')
            self._ArmButton3 = ButtonElement(False,
                                             MIDI_CC_TYPE,
                                             0,
                                             35,
                                             name='ArmButton3')
            self._ArmButton4 = ButtonElement(False,
                                             MIDI_CC_TYPE,
                                             0,
                                             36,
                                             name='ArmButton4')
            self._ArmButton5 = ButtonElement(False,
                                             MIDI_CC_TYPE,
                                             0,
                                             37,
                                             name='ArmButton5')
            self._ArmButton6 = ButtonElement(False,
                                             MIDI_CC_TYPE,
                                             0,
                                             38,
                                             name='ArmButton6')
            self._ArmButton7 = ButtonElement(False,
                                             MIDI_CC_TYPE,
                                             0,
                                             39,
                                             name='ArmButton7')
            self._VolumeSlider0 = SliderElement(MIDI_CC_TYPE,
                                                0,
                                                12,
                                                name='VolumeSlider0')
            self._VolumeSlider1 = SliderElement(MIDI_CC_TYPE,
                                                0,
                                                13,
                                                name='VolumeSlider1')
            self._VolumeSlider2 = SliderElement(MIDI_CC_TYPE,
                                                0,
                                                14,
                                                name='VolumeSlider2')
            self._VolumeSlider3 = SliderElement(MIDI_CC_TYPE,
                                                0,
                                                15,
                                                name='VolumeSlider3')
            self._VolumeSlider4 = SliderElement(MIDI_CC_TYPE,
                                                0,
                                                16,
                                                name='VolumeSlider4')
            self._VolumeSlider5 = SliderElement(MIDI_CC_TYPE,
                                                0,
                                                17,
                                                name='VolumeSlider5')
            self._VolumeSlider6 = SliderElement(MIDI_CC_TYPE,
                                                0,
                                                18,
                                                name='VolumeSlider6')
            self._VolumeSlider7 = SliderElement(MIDI_CC_TYPE,
                                                0,
                                                19,
                                                name='VolumeSlider7')
            #Bank B - Channel 2 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
            self._Encoder8 = EncoderElement(
                MIDI_CC_TYPE,
                2,
                22,
                Live.MidiMap.MapMode.relative_two_compliment,
                name='Encoder8')
            self._Encoder9 = EncoderElement(
                MIDI_CC_TYPE,
                2,
                23,
                Live.MidiMap.MapMode.relative_two_compliment,
                name='Encoder9')
            self._Encoder10 = EncoderElement(
                MIDI_CC_TYPE,
                2,
                24,
                Live.MidiMap.MapMode.relative_two_compliment,
                name='Encoder10')
            self._Encoder11 = EncoderElement(
                MIDI_CC_TYPE,
                2,
                25,
                Live.MidiMap.MapMode.relative_two_compliment,
                name='Encoder11')
            self._Encoder12 = EncoderElement(
                MIDI_CC_TYPE,
                2,
                26,
                Live.MidiMap.MapMode.relative_two_compliment,
                name='Encoder12')
            self._Encoder13 = EncoderElement(
                MIDI_CC_TYPE,
                2,
                27,
                Live.MidiMap.MapMode.relative_two_compliment,
                name='Encoder13')
            self._Encoder14 = EncoderElement(
                MIDI_CC_TYPE,
                2,
                28,
                Live.MidiMap.MapMode.relative_two_compliment,
                name='Encoder14')
            self._Encoder15 = EncoderElement(
                MIDI_CC_TYPE,
                2,
                29,
                Live.MidiMap.MapMode.relative_two_compliment,
                name='Encoder15')
            self._ArmButton8 = ButtonElement(False,
                                             MIDI_CC_TYPE,
                                             1,
                                             32,
                                             name='ArmButton8')
            self._ArmButton9 = ButtonElement(False,
                                             MIDI_CC_TYPE,
                                             1,
                                             33,
                                             name='ArmButton9')
            self._ArmButton10 = ButtonElement(False,
                                              MIDI_CC_TYPE,
                                              1,
                                              34,
                                              name='ArmButton10')
            self._ArmButton11 = ButtonElement(False,
                                              MIDI_CC_TYPE,
                                              1,
                                              35,
                                              name='ArmButton11')
            self._ArmButton12 = ButtonElement(False,
                                              MIDI_CC_TYPE,
                                              1,
                                              36,
                                              name='ArmButton12')
            self._ArmButton13 = ButtonElement(False,
                                              MIDI_CC_TYPE,
                                              1,
                                              37,
                                              name='ArmButton13')
            self._ArmButton14 = ButtonElement(False,
                                              MIDI_CC_TYPE,
                                              1,
                                              38,
                                              name='ArmButton14')
            self._ArmButton15 = ButtonElement(False,
                                              MIDI_CC_TYPE,
                                              1,
                                              39,
                                              name='ArmButton15')
            self._VolumeSlider8 = SliderElement(MIDI_CC_TYPE,
                                                1,
                                                12,
                                                name='VolumeSlider8')
            self._VolumeSlider9 = SliderElement(MIDI_CC_TYPE,
                                                1,
                                                13,
                                                name='VolumeSlider9')
            self._VolumeSlider10 = SliderElement(MIDI_CC_TYPE,
                                                 1,
                                                 14,
                                                 name='VolumeSlider10')
            self._VolumeSlider11 = SliderElement(MIDI_CC_TYPE,
                                                 1,
                                                 15,
                                                 name='VolumeSlider11')
            self._VolumeSlider12 = SliderElement(MIDI_CC_TYPE,
                                                 1,
                                                 16,
                                                 name='VolumeSlider12')
            self._VolumeSlider13 = SliderElement(MIDI_CC_TYPE,
                                                 1,
                                                 17,
                                                 name='VolumeSlider13')
            self._VolumeSlider14 = SliderElement(MIDI_CC_TYPE,
                                                 1,
                                                 18,
                                                 name='VolumeSlider14')
            self._VolumeSlider15 = SliderElement(MIDI_CC_TYPE,
                                                 1,
                                                 19,
                                                 name='VolumeSlider15')
            #Bank C - Channel 3 -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
            self._Encoder16 = EncoderElement(
                MIDI_CC_TYPE,
                3,
                22,
                Live.MidiMap.MapMode.relative_two_compliment,
                name='Encoder16')
            self._Encoder17 = EncoderElement(
                MIDI_CC_TYPE,
                3,
                23,
                Live.MidiMap.MapMode.relative_two_compliment,
                name='Encoder17')
            self._Encoder18 = EncoderElement(
                MIDI_CC_TYPE,
                3,
                24,
                Live.MidiMap.MapMode.relative_two_compliment,
                name='Encoder18')
            self._Encoder19 = EncoderElement(
                MIDI_CC_TYPE,
                3,
                25,
                Live.MidiMap.MapMode.relative_two_compliment,
                name='Encoder19')
            self._Encoder20 = EncoderElement(
                MIDI_CC_TYPE,
                3,
                26,
                Live.MidiMap.MapMode.relative_two_compliment,
                name='Encoder20')
            self._Encoder21 = EncoderElement(
                MIDI_CC_TYPE,
                3,
                27,
                Live.MidiMap.MapMode.relative_two_compliment,
                name='Encoder21')
            self._Encoder22 = EncoderElement(
                MIDI_CC_TYPE,
                3,
                28,
                Live.MidiMap.MapMode.relative_two_compliment,
                name='Encoder22')
            self._Encoder23 = EncoderElement(
                MIDI_CC_TYPE,
                3,
                29,
                Live.MidiMap.MapMode.relative_two_compliment,
                name='Encoder23')
            self._ArmButton16 = ButtonElement(False,
                                              MIDI_CC_TYPE,
                                              2,
                                              32,
                                              name='ArmButton16')
            self._ArmButton17 = ButtonElement(False,
                                              MIDI_CC_TYPE,
                                              2,
                                              33,
                                              name='ArmButton17')
            self._ArmButton18 = ButtonElement(False,
                                              MIDI_CC_TYPE,
                                              2,
                                              34,
                                              name='ArmButton18')
            self._ArmButton19 = ButtonElement(False,
                                              MIDI_CC_TYPE,
                                              2,
                                              35,
                                              name='ArmButton19')
            self._ArmButton20 = ButtonElement(False,
                                              MIDI_CC_TYPE,
                                              2,
                                              36,
                                              name='ArmButton20')
            self._ArmButton21 = ButtonElement(False,
                                              MIDI_CC_TYPE,
                                              2,
                                              37,
                                              name='ArmButton21')
            self._ArmButton22 = ButtonElement(False,
                                              MIDI_CC_TYPE,
                                              2,
                                              38,
                                              name='ArmButton22')
            self._ArmButton23 = ButtonElement(False,
                                              MIDI_CC_TYPE,
                                              2,
                                              39,
                                              name='ArmButton23')
            self._VolumeSlider16 = SliderElement(MIDI_CC_TYPE,
                                                 2,
                                                 12,
                                                 name='VolumeSlider16')
            self._VolumeSlider17 = SliderElement(MIDI_CC_TYPE,
                                                 2,
                                                 13,
                                                 name='VolumeSlider17')
            self._VolumeSlider18 = SliderElement(MIDI_CC_TYPE,
                                                 2,
                                                 14,
                                                 name='VolumeSlider18')
            self._VolumeSlider19 = SliderElement(MIDI_CC_TYPE,
                                                 2,
                                                 15,
                                                 name='VolumeSlider19')
            self._VolumeSlider20 = SliderElement(MIDI_CC_TYPE,
                                                 2,
                                                 16,
                                                 name='VolumeSlider20')
            self._VolumeSlider21 = SliderElement(MIDI_CC_TYPE,
                                                 2,
                                                 17,
                                                 name='VolumeSlider21')
            self._VolumeSlider22 = SliderElement(MIDI_CC_TYPE,
                                                 2,
                                                 18,
                                                 name='VolumeSlider22')
            self._VolumeSlider23 = SliderElement(MIDI_CC_TYPE,
                                                 2,
                                                 19,
                                                 name='VolumeSlider23')
            #Drum rack -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
            drum_rack = DrumRackComponent(
                name='Drum_Rack',
                is_enabled=False,
                layer=Layer(pads=midimap['Drum_Pads']))
            drum_rack.set_enabled(True)
            #Transport -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
            transport = TransportComponent(name='Transport',
                                           is_enabled=False,
                                           layer=Layer(
                                               play_button=midimap['Play'],
                                               record_button=midimap['Record'],
                                               stop_button=midimap['Stop'],
                                               loop_button=midimap['Loop']))
            #, seek_forward_button=midimap['Forward'], seek_backward_button=midimap['Backward']
            transport.set_enabled(True)
            #Make the Back/Fwd button just normal mapable CC senders
            self._BackButton = ButtonElement(False,
                                             MIDI_CC_TYPE,
                                             0,
                                             116,
                                             name='BackButton')
            self._FwdButton = ButtonElement(False,
                                            MIDI_CC_TYPE,
                                            0,
                                            115,
                                            name='FwdButton')
            #Device -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
            self._device = DeviceComponent(
                name='Device',
                is_enabled=False,
                layer=Layer(parameter_controls=midimap['Encoders']),
                device_selection_follows_track_selection=True)
            self._device.set_enabled(True)
            self.set_device_component(self._device)
            #Mixer -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
            mixer_size = 24
            self._mixer = MixerComponent(mixer_size,
                                         name='Mixer',
                                         is_enabled=False)
            #Super crude and repetitive mapping because after all this shit I'm not spending time learning how to loop this crap hehe
            #Bank A
            self._mixer.channel_strip(0).layer = Layer(
                volume_control=self._VolumeSlider0,
                arm_button=self._ArmButton0,
                pan_control=self._Encoder0)
            self._mixer.channel_strip(1).layer = Layer(
                volume_control=self._VolumeSlider1,
                arm_button=self._ArmButton1,
                pan_control=self._Encoder1)
            self._mixer.channel_strip(2).layer = Layer(
                volume_control=self._VolumeSlider2,
                arm_button=self._ArmButton2,
                pan_control=self._Encoder2)
            self._mixer.channel_strip(3).layer = Layer(
                volume_control=self._VolumeSlider3,
                arm_button=self._ArmButton3,
                pan_control=self._Encoder3)
            self._mixer.channel_strip(4).layer = Layer(
                volume_control=self._VolumeSlider4,
                arm_button=self._ArmButton4,
                pan_control=self._Encoder4)
            self._mixer.channel_strip(5).layer = Layer(
                volume_control=self._VolumeSlider5,
                arm_button=self._ArmButton5,
                pan_control=self._Encoder5)
            self._mixer.channel_strip(6).layer = Layer(
                volume_control=self._VolumeSlider6,
                arm_button=self._ArmButton6,
                pan_control=self._Encoder6)
            self._mixer.channel_strip(7).layer = Layer(
                volume_control=self._VolumeSlider7,
                arm_button=self._ArmButton7,
                pan_control=self._Encoder7)
            #Bank B
            self._mixer.channel_strip(8).layer = Layer(
                volume_control=self._VolumeSlider8,
                arm_button=self._ArmButton8,
                pan_control=self._Encoder8)
            self._mixer.channel_strip(9).layer = Layer(
                volume_control=self._VolumeSlider9,
                arm_button=self._ArmButton9,
                pan_control=self._Encoder9)
            self._mixer.channel_strip(10).layer = Layer(
                volume_control=self._VolumeSlider10,
                arm_button=self._ArmButton10,
                pan_control=self._Encoder10)
            self._mixer.channel_strip(11).layer = Layer(
                volume_control=self._VolumeSlider11,
                arm_button=self._ArmButton11,
                pan_control=self._Encoder11)
            self._mixer.channel_strip(12).layer = Layer(
                volume_control=self._VolumeSlider12,
                arm_button=self._ArmButton12,
                pan_control=self._Encoder12)
            self._mixer.channel_strip(13).layer = Layer(
                volume_control=self._VolumeSlider13,
                arm_button=self._ArmButton13,
                pan_control=self._Encoder13)
            self._mixer.channel_strip(14).layer = Layer(
                volume_control=self._VolumeSlider14,
                arm_button=self._ArmButton14,
                pan_control=self._Encoder14)
            self._mixer.channel_strip(15).layer = Layer(
                volume_control=self._VolumeSlider15,
                arm_button=self._ArmButton15,
                pan_control=self._Encoder15)
            #Bank C
            self._mixer.channel_strip(16).layer = Layer(
                volume_control=self._VolumeSlider16,
                arm_button=self._ArmButton16,
                pan_control=self._Encoder16)
            self._mixer.channel_strip(17).layer = Layer(
                volume_control=self._VolumeSlider17,
                arm_button=self._ArmButton17,
                pan_control=self._Encoder17)
            self._mixer.channel_strip(18).layer = Layer(
                volume_control=self._VolumeSlider18,
                arm_button=self._ArmButton18,
                pan_control=self._Encoder18)
            self._mixer.channel_strip(19).layer = Layer(
                volume_control=self._VolumeSlider19,
                arm_button=self._ArmButton19,
                pan_control=self._Encoder19)
            self._mixer.channel_strip(20).layer = Layer(
                volume_control=self._VolumeSlider20,
                arm_button=self._ArmButton20,
                pan_control=self._Encoder20)
            self._mixer.channel_strip(21).layer = Layer(
                volume_control=self._VolumeSlider21,
                arm_button=self._ArmButton21,
                pan_control=self._Encoder21)
            self._mixer.channel_strip(22).layer = Layer(
                volume_control=self._VolumeSlider22,
                arm_button=self._ArmButton22,
                pan_control=self._Encoder22)
            self._mixer.channel_strip(23).layer = Layer(
                volume_control=self._VolumeSlider23,
                arm_button=self._ArmButton23,
                pan_control=self._Encoder23)
            self._mixer.set_enabled(True)


#-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	def set_enabled(self, enabled):
		MixerComponent.set_enabled(self, enabled)
		if enabled:
			self._update_OSD()
Beispiel #16
0
class MPK261MXLOOP(ControlSurface):

    def __init__(self, *a, **k):
        super(MPK261MXLOOP, self).__init__(*a, **k)
        self.show_message("-----------------------= MPK261MXLOOP LOADING - maxcloutier13 says hi =----------------------------------------------------------")
        self.log_message("-----------------------= MPK261MXLOOP LOADING - maxcloutier13 says hi =----------------------------------------------------------")
        with self.component_guard():
            midimap = MidiMap()
            #Sustain pedal 1 = Play/Record/Overdub switch for live looping
            self._LoopRecordButton = ButtonElement(True, MIDI_CC_TYPE, 0, 64)
            self._LoopRecordButton.add_value_listener(self._launch_clip, False)
            #Sustain pedal 2 = Sustain pour l'instant ;o)
            #self._LoopRecordButton = ButtonElement(True, MIDI_CC_TYPE, 0, 65)            
            #Control up/down/left/right using the daw controls            
            self._UpButton = ButtonElement(False, MIDI_CC_TYPE, 0, 88, name='UpButton')
            self._DownButton = ButtonElement(False, MIDI_CC_TYPE, 0, 89, name='DownButton')
            self._LeftButton = ButtonElement(False, MIDI_CC_TYPE, 0, 20, name='LeftButton')
            self._RightButton = ButtonElement(False, MIDI_CC_TYPE, 0, 21, name='RightButton')
            #Listeners for the functions
            self._UpButton.add_value_listener(self._move_up, False)
            self._DownButton.add_value_listener(self._move_down, False)
            self._LeftButton.add_value_listener(self._move_left, False)
            self._RightButton.add_value_listener(self._move_right, False)
            #Super crude manual init for the custom buttons and faders 
            #Control Bank A - Channel 1 -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
            self._Encoder0 = EncoderElement(MIDI_CC_TYPE,1,22, Live.MidiMap.MapMode.relative_two_compliment, name='Encoder0')
            self._Encoder1 = EncoderElement(MIDI_CC_TYPE,1,23, Live.MidiMap.MapMode.relative_two_compliment, name='Encoder1')
            self._Encoder2 = EncoderElement(MIDI_CC_TYPE,1,24, Live.MidiMap.MapMode.relative_two_compliment, name='Encoder2')
            self._Encoder3 = EncoderElement(MIDI_CC_TYPE,1,25, Live.MidiMap.MapMode.relative_two_compliment, name='Encoder3')
            self._Encoder4 = EncoderElement(MIDI_CC_TYPE,1,26, Live.MidiMap.MapMode.relative_two_compliment, name='Encoder4')
            self._Encoder5 = EncoderElement(MIDI_CC_TYPE,1,27, Live.MidiMap.MapMode.relative_two_compliment, name='Encoder5')
            self._Encoder6 = EncoderElement(MIDI_CC_TYPE,1,28, Live.MidiMap.MapMode.relative_two_compliment, name='Encoder6')
            self._Encoder7 = EncoderElement(MIDI_CC_TYPE,1,29, Live.MidiMap.MapMode.relative_two_compliment, name='Encoder7')
            self._ArmButton0 = ButtonElement(False, MIDI_CC_TYPE, 0, 32, name='ArmButton0')
            self._ArmButton1 = ButtonElement(False, MIDI_CC_TYPE, 0, 33, name='ArmButton1')
            self._ArmButton2 = ButtonElement(False, MIDI_CC_TYPE, 0, 34, name='ArmButton2')
            self._ArmButton3 = ButtonElement(False, MIDI_CC_TYPE, 0, 35, name='ArmButton3')
            self._ArmButton4 = ButtonElement(False, MIDI_CC_TYPE, 0, 36, name='ArmButton4')
            self._ArmButton5 = ButtonElement(False, MIDI_CC_TYPE, 0, 37, name='ArmButton5')
            self._ArmButton6 = ButtonElement(False, MIDI_CC_TYPE, 0, 38, name='ArmButton6')
            self._ArmButton7 = ButtonElement(False, MIDI_CC_TYPE, 0, 39, name='ArmButton7')
            self._VolumeSlider0 = SliderElement(MIDI_CC_TYPE, 0, 12, name='VolumeSlider0')
            self._VolumeSlider1 = SliderElement(MIDI_CC_TYPE, 0, 13, name='VolumeSlider1')
            self._VolumeSlider2 = SliderElement(MIDI_CC_TYPE, 0, 14, name='VolumeSlider2')
            self._VolumeSlider3 = SliderElement(MIDI_CC_TYPE, 0, 15, name='VolumeSlider3')
            self._VolumeSlider4 = SliderElement(MIDI_CC_TYPE, 0, 16, name='VolumeSlider4')
            self._VolumeSlider5 = SliderElement(MIDI_CC_TYPE, 0, 17, name='VolumeSlider5')
            self._VolumeSlider6 = SliderElement(MIDI_CC_TYPE, 0, 18, name='VolumeSlider6')
            self._VolumeSlider7 = SliderElement(MIDI_CC_TYPE, 0, 19, name='VolumeSlider7')
            #Control Bank B - Channel 2 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
            self._Encoder8 = EncoderElement(MIDI_CC_TYPE,2,22, Live.MidiMap.MapMode.relative_two_compliment, name='Encoder8')
            self._Encoder9 = EncoderElement(MIDI_CC_TYPE,2,23, Live.MidiMap.MapMode.relative_two_compliment, name='Encoder9')
            self._Encoder10 = EncoderElement(MIDI_CC_TYPE,2,24, Live.MidiMap.MapMode.relative_two_compliment, name='Encoder10')
            self._Encoder11 = EncoderElement(MIDI_CC_TYPE,2,25, Live.MidiMap.MapMode.relative_two_compliment, name='Encoder11')
            self._Encoder12 = EncoderElement(MIDI_CC_TYPE,2,26, Live.MidiMap.MapMode.relative_two_compliment, name='Encoder12')
            self._Encoder13 = EncoderElement(MIDI_CC_TYPE,2,27, Live.MidiMap.MapMode.relative_two_compliment, name='Encoder13')
            self._Encoder14 = EncoderElement(MIDI_CC_TYPE,2,28, Live.MidiMap.MapMode.relative_two_compliment, name='Encoder14')
            self._Encoder15 = EncoderElement(MIDI_CC_TYPE,2,29, Live.MidiMap.MapMode.relative_two_compliment, name='Encoder15')
            self._ArmButton8 = ButtonElement(False, MIDI_CC_TYPE, 1, 32, name='ArmButton8')
            self._ArmButton9 = ButtonElement(False, MIDI_CC_TYPE, 1, 33, name='ArmButton9')
            self._ArmButton10 = ButtonElement(False, MIDI_CC_TYPE, 1, 34, name='ArmButton10')
            self._ArmButton11 = ButtonElement(False, MIDI_CC_TYPE, 1, 35, name='ArmButton11')
            self._ArmButton12 = ButtonElement(False, MIDI_CC_TYPE, 1, 36, name='ArmButton12')
            self._ArmButton13 = ButtonElement(False, MIDI_CC_TYPE, 1, 37, name='ArmButton13')
            self._ArmButton14 = ButtonElement(False, MIDI_CC_TYPE, 1, 38, name='ArmButton14')
            self._ArmButton15 = ButtonElement(False, MIDI_CC_TYPE, 1, 39, name='ArmButton15')
            self._VolumeSlider8 = SliderElement(MIDI_CC_TYPE, 1, 12, name='VolumeSlider8')
            self._VolumeSlider9 = SliderElement(MIDI_CC_TYPE, 1, 13, name='VolumeSlider9')
            self._VolumeSlider10 = SliderElement(MIDI_CC_TYPE, 1, 14, name='VolumeSlider10')
            self._VolumeSlider11 = SliderElement(MIDI_CC_TYPE, 1, 15, name='VolumeSlider11')
            self._VolumeSlider12 = SliderElement(MIDI_CC_TYPE, 1, 16, name='VolumeSlider12')
            self._VolumeSlider13 = SliderElement(MIDI_CC_TYPE, 1, 17, name='VolumeSlider13')
            self._VolumeSlider14 = SliderElement(MIDI_CC_TYPE, 1, 18, name='VolumeSlider14')
            self._VolumeSlider15 = SliderElement(MIDI_CC_TYPE, 1, 19, name='VolumeSlider15')
            #Control Bank C - Channel 3 -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
            self._Encoder16 = EncoderElement(MIDI_CC_TYPE,3,22, Live.MidiMap.MapMode.relative_two_compliment, name='Encoder16')
            self._Encoder17 = EncoderElement(MIDI_CC_TYPE,3,23, Live.MidiMap.MapMode.relative_two_compliment, name='Encoder17')
            self._Encoder18 = EncoderElement(MIDI_CC_TYPE,3,24, Live.MidiMap.MapMode.relative_two_compliment, name='Encoder18')
            self._Encoder19 = EncoderElement(MIDI_CC_TYPE,3,25, Live.MidiMap.MapMode.relative_two_compliment, name='Encoder19')
            self._Encoder20 = EncoderElement(MIDI_CC_TYPE,3,26, Live.MidiMap.MapMode.relative_two_compliment, name='Encoder20')
            self._Encoder21 = EncoderElement(MIDI_CC_TYPE,3,27, Live.MidiMap.MapMode.relative_two_compliment, name='Encoder21')
            self._Encoder22 = EncoderElement(MIDI_CC_TYPE,3,28, Live.MidiMap.MapMode.relative_two_compliment, name='Encoder22')
            self._Encoder23 = EncoderElement(MIDI_CC_TYPE,3,29, Live.MidiMap.MapMode.relative_two_compliment, name='Encoder23')
            self._ArmButton16 = ButtonElement(False, MIDI_CC_TYPE, 2, 32, name='ArmButton16')
            self._ArmButton17 = ButtonElement(False, MIDI_CC_TYPE, 2, 33, name='ArmButton17')
            self._ArmButton18 = ButtonElement(False, MIDI_CC_TYPE, 2, 34, name='ArmButton18')
            self._ArmButton19 = ButtonElement(False, MIDI_CC_TYPE, 2, 35, name='ArmButton19')
            self._ArmButton20 = ButtonElement(False, MIDI_CC_TYPE, 2, 36, name='ArmButton20')
            self._ArmButton21 = ButtonElement(False, MIDI_CC_TYPE, 2, 37, name='ArmButton21')
            self._ArmButton22 = ButtonElement(False, MIDI_CC_TYPE, 2, 38, name='ArmButton22')
            self._ArmButton23 = ButtonElement(False, MIDI_CC_TYPE, 2, 39, name='ArmButton23')
            self._VolumeSlider16 = SliderElement(MIDI_CC_TYPE, 2, 12, name='VolumeSlider16')
            self._VolumeSlider17 = SliderElement(MIDI_CC_TYPE, 2, 13, name='VolumeSlider17')
            self._VolumeSlider18 = SliderElement(MIDI_CC_TYPE, 2, 14, name='VolumeSlider18')
            self._VolumeSlider19 = SliderElement(MIDI_CC_TYPE, 2, 15, name='VolumeSlider19')
            self._VolumeSlider20 = SliderElement(MIDI_CC_TYPE, 2, 16, name='VolumeSlider20')
            self._VolumeSlider21 = SliderElement(MIDI_CC_TYPE, 2, 17, name='VolumeSlider21')
            self._VolumeSlider22 = SliderElement(MIDI_CC_TYPE, 2, 18, name='VolumeSlider22')
            self._VolumeSlider23 = SliderElement(MIDI_CC_TYPE, 2, 19, name='VolumeSlider23')
            #Drum Bank A - Channel 4--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
            self._Pad0 = ButtonElement(True, MIDI_NOTE_TYPE, 3, 81, name='Pad0')
            self._Pad1 = ButtonElement(True, MIDI_NOTE_TYPE, 3, 83, name='Pad1')
            self._Pad2 = ButtonElement(True, MIDI_NOTE_TYPE, 3, 84, name='Pad2')
            self._Pad3 = ButtonElement(True, MIDI_NOTE_TYPE, 3, 86, name='Pad3')
            self._Pad4 = ButtonElement(True, MIDI_NOTE_TYPE, 3, 74, name='Pad4')
            self._Pad5 = ButtonElement(True, MIDI_NOTE_TYPE, 3, 76, name='Pad5')
            self._Pad6 = ButtonElement(True, MIDI_NOTE_TYPE, 3, 77, name='Pad6')
            self._Pad7 = ButtonElement(True, MIDI_NOTE_TYPE, 3, 79, name='Pad7')
            self._Pad8 = ButtonElement(True, MIDI_NOTE_TYPE, 3, 67, name='Pad8')
            self._Pad9 = ButtonElement(True, MIDI_NOTE_TYPE, 3, 69, name='Pad9')
            self._Pad10 = ButtonElement(True, MIDI_NOTE_TYPE, 3, 71, name='Pad10')
            self._Pad11 = ButtonElement(True, MIDI_NOTE_TYPE, 3, 72, name='Pad11')
            self._Pad12 = ButtonElement(True, MIDI_NOTE_TYPE, 3, 60, name='Pad12')
            self._Pad13 = ButtonElement(True, MIDI_NOTE_TYPE, 3, 62, name='Pad13')
            self._Pad14 = ButtonElement(True, MIDI_NOTE_TYPE, 3, 64, name='Pad14')
            self._Pad15 = ButtonElement(True, MIDI_NOTE_TYPE, 3, 65, name='Pad15')
            self._Pads = ButtonMatrixElement(rows=[[self._Pad0, self._Pad1, self._Pad2, self._Pad3],
                                                   [self._Pad4, self._Pad5, self._Pad6, self._Pad7], 
                                                   [self._Pad8, self._Pad9, self._Pad10, self._Pad11],
                                                   [self._Pad12, self._Pad13, self._Pad14, self._Pad15]])
            #Drum Bank B -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
            #Drum Bank C -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
            #Drum Bank D -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
            #
            #Drum rack -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
            drum_rack = DrumRackComponent(name='Drum_Rack', is_enabled=False, layer=Layer(pads=self._Pads))
            drum_rack.set_enabled(True)
            #Transport -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
            transport = TransportComponent(name='Transport', is_enabled=False, layer=Layer(play_button=midimap['Play'], record_button=midimap['Record'], stop_button=midimap['Stop'], loop_button=midimap['Loop']))
            #, seek_forward_button=midimap['Forward'], seek_backward_button=midimap['Backward']
            transport.set_enabled(True)
            #Make the Back/Fwd button just normal mapable CC senders
            self._BackButton = ButtonElement(False, MIDI_CC_TYPE, 0, 116, name='BackButton')
            self._FwdButton = ButtonElement(False, MIDI_CC_TYPE, 0, 115, name='FwdButton')
            #Device -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
            self._device = DeviceComponent(name='Device', is_enabled=False, layer=Layer(parameter_controls=midimap['Encoders']), device_selection_follows_track_selection=True)
            self._device.set_enabled(True)
            self.set_device_component(self._device)
            #Mixer -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
            mixer_size = 24
            self._mixer = MixerComponent(mixer_size, name='Mixer', is_enabled=False)
            #Super crude and repetitive mapping because after all this shit I'm not spending time learning how to loop this crap hehe
            #Bank A
            self._mixer.channel_strip(0).layer = Layer(volume_control = self._VolumeSlider0, arm_button=self._ArmButton0, pan_control=self._Encoder0)
            self._mixer.channel_strip(1).layer = Layer(volume_control = self._VolumeSlider1, arm_button=self._ArmButton1, pan_control=self._Encoder1)
            self._mixer.channel_strip(2).layer = Layer(volume_control = self._VolumeSlider2, arm_button=self._ArmButton2, pan_control=self._Encoder2)
            self._mixer.channel_strip(3).layer = Layer(volume_control = self._VolumeSlider3, arm_button=self._ArmButton3, pan_control=self._Encoder3)
            self._mixer.channel_strip(4).layer = Layer(volume_control = self._VolumeSlider4, arm_button=self._ArmButton4, pan_control=self._Encoder4)
            self._mixer.channel_strip(5).layer = Layer(volume_control = self._VolumeSlider5, arm_button=self._ArmButton5, pan_control=self._Encoder5)
            self._mixer.channel_strip(6).layer = Layer(volume_control = self._VolumeSlider6, arm_button=self._ArmButton6, pan_control=self._Encoder6)
            self._mixer.channel_strip(7).layer = Layer(volume_control = self._VolumeSlider7, arm_button=self._ArmButton7, pan_control=self._Encoder7)
            #Bank B
            self._mixer.channel_strip(8).layer = Layer(volume_control = self._VolumeSlider8, arm_button=self._ArmButton8, pan_control=self._Encoder8)
            self._mixer.channel_strip(9).layer = Layer(volume_control = self._VolumeSlider9, arm_button=self._ArmButton9, pan_control=self._Encoder9)
            self._mixer.channel_strip(10).layer = Layer(volume_control = self._VolumeSlider10, arm_button=self._ArmButton10, pan_control=self._Encoder10)
            self._mixer.channel_strip(11).layer = Layer(volume_control = self._VolumeSlider11, arm_button=self._ArmButton11, pan_control=self._Encoder11)
            self._mixer.channel_strip(12).layer = Layer(volume_control = self._VolumeSlider12, arm_button=self._ArmButton12, pan_control=self._Encoder12)
            self._mixer.channel_strip(13).layer = Layer(volume_control = self._VolumeSlider13, arm_button=self._ArmButton13, pan_control=self._Encoder13)
            self._mixer.channel_strip(14).layer = Layer(volume_control = self._VolumeSlider14, arm_button=self._ArmButton14, pan_control=self._Encoder14)
            self._mixer.channel_strip(15).layer = Layer(volume_control = self._VolumeSlider15, arm_button=self._ArmButton15, pan_control=self._Encoder15)
            #Bank C     
            self._mixer.channel_strip(16).layer = Layer(volume_control = self._VolumeSlider16, arm_button=self._ArmButton16, pan_control=self._Encoder16)
            self._mixer.channel_strip(17).layer = Layer(volume_control = self._VolumeSlider17, arm_button=self._ArmButton17, pan_control=self._Encoder17)
            self._mixer.channel_strip(18).layer = Layer(volume_control = self._VolumeSlider18, arm_button=self._ArmButton18, pan_control=self._Encoder18)
            self._mixer.channel_strip(19).layer = Layer(volume_control = self._VolumeSlider19, arm_button=self._ArmButton19, pan_control=self._Encoder19)
            self._mixer.channel_strip(20).layer = Layer(volume_control = self._VolumeSlider20, arm_button=self._ArmButton20, pan_control=self._Encoder20)
            self._mixer.channel_strip(21).layer = Layer(volume_control = self._VolumeSlider21, arm_button=self._ArmButton21, pan_control=self._Encoder21)
            self._mixer.channel_strip(22).layer = Layer(volume_control = self._VolumeSlider22, arm_button=self._ArmButton22, pan_control=self._Encoder22)
            self._mixer.channel_strip(23).layer = Layer(volume_control = self._VolumeSlider23, arm_button=self._ArmButton23, pan_control=self._Encoder23)
            self._mixer.set_enabled(True)
            #Track change listener
            self.song().view.add_selected_track_listener(self._update_selected_device)
    
    #Track changed    
    def _update_selected_device(self):
        track = self.song().view.selected_track
        #self.show_message("----- Track changed! -----")
    
    #Launch/Record/Overdub    
    def _launch_clip(self, value):
        global _overdub_flag
        #self.log_message("--> Track launch! -----")
        #self.song().view.highlighted_clip_slot.set_fire_button_state(True)
        _current_slot = self.song().view.highlighted_clip_slot 
        if _current_slot.is_playing == 0 and _current_slot.is_recording == 0:            
            self.song().view.highlighted_clip_slot.set_fire_button_state(True)
        elif _current_slot.is_playing == 1 and _current_slot.is_recording == 0:
            self.song().overdub = 1
            _overdub_flag = 1
        elif _current_slot.is_playing == 1 and _current_slot.is_recording == 1 and _overdub_flag == 1:
            self.song().overdub = 0
            _overdub_flag = 0
        else:
            self.song().view.highlighted_clip_slot.set_fire_button_state(True)
    
    #Move up/down
    def _move_clipslot(self, up):
        scene = self.song().view.selected_scene
        scenes = self.song().scenes
        max_scenes = len(scenes)
        for i in range(max_scenes):
            if scene == scenes[i]:
                #Found our guy
                if up == 1:
                    self.song().view.selected_scene = scenes[i-1]
                    self.show_message("TFMX Debug: Up!")
                else:
                    if scene == scenes[max_scenes-1]:
                        self.song().view.selected_scene = scenes[0]
                    else:
                        self.song().view.selected_scene = scenes[i+1]
                    self.show_message("TFMX Debug: Down!")
    
    #Move left/right
    def _move_track(self, left):
        #Get track and tracks
        track = self.song().view.selected_track
        tracks = self.get_all_tracks(only_visible = True)
        max_tracks = len(tracks)
        #Iterate to find current track's index.
        for i in range(max_tracks):
            if track == tracks[i]:
                #Found our track
                if left == 1:
                    self.song().view.selected_track = tracks[i-1]
                else:
                    if track == tracks[max_tracks-1]:
                        self.song().view.selected_track = tracks[0]
                    else:
                        self.song().view.selected_track = tracks[i+1]
                        
    def get_all_tracks(self, only_visible = False):
        tracks = []
        for track in self.song().tracks:
            if not only_visible or track.is_visible:
                tracks.append(track)
        #Include the master track?
        #NOPE tracks.append(self.song().master_track)
        return tracks
        
    def _move_up(self, value):
        if value > 0:
            self._move_clipslot(1)
            
    def _move_down(self, value):
        if value > 0:
            self._move_clipslot(0)
            
    def _move_left(self, value):
        if value > 0:
            self._move_track(1)
    
    def _move_right(self, value):
        if value > 0:
            self._move_track(0)
#-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	def set_enabled(self,enabled):
			MixerComponent.set_enabled(self,enabled)
			if enabled:
				self._update_OSD()