Esempio n. 1
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, MACRO_CONTROLS[index]))
        self._device.set_parameter_controls(device_param_controls)
        # self._device.set_on_off_button(ButtonElement(True, MIDI_CC_TYPE, CHANNEL, DEVICE_ON))
        self._device.set_lock_button(
            ButtonElement(False, MIDI_CC_TYPE, CHANNEL, 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, DEVICE_ON)
        down_bank_button = ButtonElement(True, MIDI_CC_TYPE, CHANNEL,
                                         DEVICE_LOCK)
        # 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, PREVIOUS_DEVICE),
            ButtonElement(True, MIDI_CC_TYPE, CHANNEL, NEXT_DEVICE))
 def __init__(self, c_instance):
     ControlSurface.__init__(self, c_instance)
     with self.component_guard():
         self._suggested_input_port = 'HyperControl'
         self._suggested_output_port = 'HyperControl'
         self._device_selection_follows_track_selection = True
         self.set_pad_translations(PAD_TRANSLATIONS)
         stop_button = make_button(116)
         play_button = make_button(117)
         record_button = make_button(118)
         select_button = make_button(98)
         nav_left_button = make_button(99)
         nav_right_button = make_button(100)
         nav_up_button = make_button(101)
         nav_down_button = make_button(102)
         mixer_modes_toggle = make_button(58)
         mixer_or_device_toggle = make_button(59)
         hypercontrol_mode_toggle = make_button(60)
         encoders = tuple([ make_encoder(33 + index) for index in range(8) ])
         transport = TransportComponent()
         transport.set_stop_button(stop_button)
         transport.set_play_button(play_button)
         transport.set_record_button(record_button)
         session = SessionComponent(0, 0)
         session.set_track_banking_increment(8)
         device = BestBankDeviceComponent()
         self.set_device_component(device)
         device_nav = DeviceNavComponent()
         mixer = SpecialMixerComponent(NUM_TRACKS)
         session.set_mixer(mixer)
         mixer_encoder_modes = EncoderMixerModeSelector(mixer)
         mixer_encoder_modes.set_mode_toggle(mixer_modes_toggle)
         mixer_or_device = MixerOrDeviceModeSelector(encoders, select_button, nav_up_button, nav_down_button, nav_left_button, nav_right_button, mixer, session, device, mixer_encoder_modes, device_nav)
         mixer_or_device.set_mode_buttons((mixer_modes_toggle, mixer_or_device_toggle, hypercontrol_mode_toggle))
 def _setup_device(self):
     self._device_for_encoders = BestBankDeviceComponent()
     self._device_for_encoders.name = 'Device_Component_for_encoders'
     self._device_for_faders = BestBankDeviceComponent()
     self._device_for_faders.name = 'Device_Component_for_faders'
     self.set_device_component(self._device_for_encoders)
     self.set_alt_device_component(self._device_for_faders)
     self._device_nav = DeviceNavComponent()
     self._device_nav.name = 'Device_Nav_Component'
Esempio n. 4
0
 def _setup_device(self):
     self._device_for_encoders = BestBankDeviceComponent(
         device_selection_follows_track_selection=True)
     self._device_for_encoders.name = 'Device_Component_for_encoders'
     self._device_for_faders = BestBankDeviceComponent(
         device_selection_follows_track_selection=True)
     self._device_for_faders.name = 'Device_Component_for_faders'
     self.set_device_component(self._device_for_encoders)
     self.set_alt_device_component(self._device_for_faders)
     self._device_nav = DeviceNavComponent()
     self._device_nav.name = 'Device_Nav_Component'
Esempio n. 5
0
class nocturn_CZ(ControlSurface):
    def __init__(self, c_instance):
        ControlSurface.__init__(self, c_instance)
        self._device_selection_follows_track_selection = True
        with self.component_guard():
            self._suppress_send_midi = True
            self._suppress_session_highlight = True
            self._control_is_with_automap = False
            is_momentary = True
            self._suggested_input_port = 'Akai MPK26'
            self._suggested_output_port = 'Akai MPK26'
            self.log("BEFORE mixer")
            self._setup_mixer_control()
            self._setup_device_control()


            # self.clipcontrol(8)

            self.log("AFTER MIXER")
            """SESSION ViEW"""
            global session
            session = SessionComponent(GRIDSIZE[0],GRIDSIZE[1])
            session.name = 'Session_Control'
            matrix = ButtonMatrixElement()
            matrix.name = 'Button_Matrix'
            up_button = ButtonElement(True, MIDI_CC_TYPE, CHANNEL_MIXER, UP_BUTTON)
            down_button = ButtonElement(True, MIDI_CC_TYPE, CHANNEL_MIXER, DOWN_BUTTON)
            left_button = ButtonElement(True, MIDI_CC_TYPE, CHANNEL_MIXER, LEFT_BUTTON)
            right_button = ButtonElement(True, MIDI_CC_TYPE, CHANNEL_MIXER, RIGHT_BUTTON)

            session.set_scene_bank_buttons(down_button, up_button)
            session.set_track_bank_buttons(right_button, left_button)

            # session_zoom = SessionZoomingComponent(session)
            # session_zoom.set_nav_buttons(up_button,down_button,left_button,right_button)
            session_stop_buttons = []
            self.log("SETTING UP GRID")
            for row in xrange(GRIDSIZE[1]):
                button_row = []
                self.log("CZ ROW")
                self.log(str(row))
                scene = session.scene(row)
                scene.name = 'Scene_' + str(row)
                scene.set_launch_button(ButtonElement(True, MIDI_NOTE_TYPE, CHANNEL, SCENE_BUTTONS[row]))
                scene.set_triggered_value(2)

                for column in xrange(GRIDSIZE[0]):
                    self.log("CZ COLUMN")
                    self.log(str(column))
                    button = ConfigurableButtonElement(True, MIDI_NOTE_TYPE, CHANNEL_MIXER, LAUNCH_BUTTONS[row][column])
                    button.name = str(column) + '_Clip_' + str(row) + '_Button'
                    button_row.append(button)
                    clip_slot = scene.clip_slot(column)
                    clip_slot.name = str(column) + '_Clip_Slot_' + str(row)
                    clip_slot.set_launch_button(button)

                matrix.add_row(tuple(button_row))

            for column in xrange(GRIDSIZE[0]):
                session_stop_buttons.append((ButtonElement(True, MIDI_NOTE_TYPE, CHANNEL_MIXER, TRACK_STOPS[column])))

            self._suppress_session_highlight = False
            self._suppress_send_midi = False
            self.set_highlighting_session_component(session)
            session.set_stop_track_clip_buttons(tuple(session_stop_buttons))
            session.set_mixer(mixer)


    def log(self, message):
        sys.stderr.write("LOG: " + message.encode("utf-8"))


    def _setup_mixer_control(self):
        num_tracks = GRIDSIZE[0] # 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) #(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
        master = mixer.master_strip()
        master.set_volume_control(SliderElement(MIDI_CC_TYPE, CHANNEL_USER, MASTER_VOLUME))
        mixer.set_prehear_volume_control(SliderElement(MIDI_CC_TYPE, CHANNEL_USER, PREHEAR))

        for index in xrange(GRIDSIZE[0]):
            mixer.channel_strip(index).set_volume_control(SliderElement(MIDI_CC_TYPE, CHANNEL_MIXER, MIX_FADERS[index]))
            # mixer.channel_strip(index).set_volume_control(SliderElement(MIDI_CC_TYPE, CHANNEL_INST, MIX_FADERS[index]))
            mixer.channel_strip(index).set_pan_control(SliderElement(MIDI_CC_TYPE, CHANNEL_MIXER, PAN_CONTROLS[index]))
            mixer.channel_strip(index).set_arm_button(ButtonElement(True, MIDI_CC_TYPE, CHANNEL_INST, ARM_BUTTONS[index])) #sets the record arm button
            mixer.channel_strip(index).set_solo_button(ButtonElement(True, MIDI_CC_TYPE, CHANNEL_INST, SOLO_BUTTONS[index]))
            mixer.channel_strip(index).set_mute_button(ButtonElement(True, MIDI_CC_TYPE, CHANNEL_INST, MUTE_BUTTONS[index]))
            mixer.channel_strip(index).set_select_button(ButtonElement(True, MIDI_CC_TYPE, CHANNEL_INST, TRACK_SELECTS[index]))
            mixer.channel_strip(index).set_send_controls([SliderElement(MIDI_CC_TYPE, CHANNEL_MIXER, SEND_CONTROLS[index][0]),
                                                              SliderElement(MIDI_CC_TYPE, CHANNEL_MIXER, SEND_CONTROLS[index][1]),
                                                              SliderElement(MIDI_CC_TYPE, CHANNEL_MIXER, SEND_CONTROLS[index][2]),
                                                              SliderElement(MIDI_CC_TYPE, CHANNEL_MIXER, SEND_CONTROLS[index][3])])




        """TRANSPORT CONTROLS"""
        stop_button = ButtonElement(False, MIDI_CC_TYPE, CHANNEL_MIXER, STOP_BUTTON)
        play_button = ButtonElement(False, MIDI_CC_TYPE, CHANNEL_MIXER, PLAY_BUTTON)
        record_button = ButtonElement(False,MIDI_CC_TYPE,CHANNEL_MIXER,RECORD_BUTTON)
        overdub_button = ButtonElement(False,MIDI_CC_TYPE,CHANNEL_MIXER,OVERDUB_BUTTON)
        transport = TransportComponent()
        transport.TEMPO_TOP = 188
        transport.set_stop_button(stop_button)
        transport.set_play_button(play_button)
        transport.set_overdub_button(overdub_button)
        transport.set_record_button(record_button)
        transport.set_seek_buttons(ButtonElement(False,MIDI_CC_TYPE,0,SEEK_LEFT),ButtonElement(False,MIDI_CC_TYPE,0,SEEK_RIGHT))
        transport.set_tempo_control(SliderElement(MIDI_CC_TYPE, CHANNEL_USER, TEMPO))
        transport.set_metronome_button(ButtonElement(False,MIDI_CC_TYPE,CHANNEL_USER, METRONOME))
        transport.set_tap_tempo_button(ButtonElement(False,MIDI_CC_TYPE,CHANNEL_USER,TAP_TEMPO))


    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)


        # self._track_controller = self.register_component(TrackControllerComponent(control_surface = ControlSurface, implicit_arm = False))
        # self.set_next_track_button(ButtonElement()) 
        # self.set_next_track_button(ButtonElement())
        



    def _set_session_highlight(self, track_offset, scene_offset, width, height, include_return_tracks):
        if not self._suppress_session_highlight:
            ControlSurface._set_session_highlight(self, track_offset, scene_offset, width, height, include_return_tracks)

    def disconnect(self):
        """clean things up on disconnect"""
        ControlSurface.disconnect(self)
        return None
Esempio n. 6
0
class MPD_CZ(ControlSurface):
    def __init__(self, c_instance):
        ControlSurface.__init__(self, c_instance)
        self._device_selection_follows_track_selection = True
        with self.component_guard():
            self._suppress_send_midi = True
            self._suppress_session_highlight = True
            self._control_is_with_automap = False
            is_momentary = True
            self._suggested_input_port = 'Akai MPD26'
            self._suggested_output_port = 'Akai MPD26'
            self.log("BEFORE mixer")
            self._setup_mixer_control()
            self._setup_device_control()

            # self.clipcontrol(8)

            self.log("AFTER MIXER")
            """SESSION ViEW"""
            global session
            session = SessionComponent(GRIDSIZE[0], GRIDSIZE[1])
            session.name = 'Session_Control'
            matrix = ButtonMatrixElement()
            matrix.name = 'Button_Matrix'
            up_button = ButtonElement(True, MIDI_NOTE_TYPE, CHANNEL, UP_BUTTON)
            down_button = ButtonElement(True, MIDI_NOTE_TYPE, CHANNEL,
                                        DOWN_BUTTON)
            left_button = ButtonElement(True, MIDI_NOTE_TYPE, CHANNEL,
                                        LEFT_BUTTON)
            right_button = ButtonElement(True, MIDI_NOTE_TYPE, CHANNEL,
                                         RIGHT_BUTTON)

            # session.set_scene_bank_buttons(down_button, up_button) #enabling these and disabling the below zoom buttons will move one scene/track per button press
            # session.set_track_bank_buttons(right_button, left_button) #

            session_zoom = SessionZoomingComponent(session)
            session_zoom.set_nav_buttons(
                up_button, down_button, left_button, right_button
            )  #these make it so you move the maximum number of scenes/tracks per button press. much more useful than moving by single scenes/tracks

            session_stop_buttons = []
            for row in range(GRIDSIZE[0]):
                button_row = []
                scene = session.scene(row)
                scene.name = 'Scene_' + str(row)
                scene.set_launch_button(
                    ButtonElement(True, MIDI_NOTE_TYPE, CHANNEL,
                                  SCENE_BUTTONS[row]))
                scene.set_triggered_value(2)
                session_stop_buttons.append(
                    (ButtonElement(True, MIDI_NOTE_TYPE, CHANNEL,
                                   TRACK_STOPS[row])))

                for column in range(GRIDSIZE[1]):
                    button = ConfigurableButtonElement(
                        True, MIDI_NOTE_TYPE, CHANNEL,
                        LAUNCH_BUTTONS[row][column])
                    button.name = str(column) + '_Clip_' + str(row) + '_Button'
                    button_row.append(button)
                    clip_slot = scene.clip_slot(column)
                    clip_slot.name = str(column) + '_Clip_Slot_' + str(row)
                    clip_slot.set_launch_button(button)

                matrix.add_row(tuple(button_row))

            self._suppress_session_highlight = False
            self._suppress_send_midi = False
            self.set_highlighting_session_component(session)
            session.set_mixer(mixer)
            session.set_stop_track_clip_buttons(tuple(session_stop_buttons))

    def log(self, message):
        sys.stderr.write("LOG: " + message.encode("utf-8"))

    def _setup_mixer_control(self):
        num_tracks = GRIDSIZE[
            1]  # 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)  #(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
        #master_volume_control = SliderElement(MIDI_CC_TYPE, 1, 17)
        for index in range(GRIDSIZE[1]):
            mixer.channel_strip(index).set_volume_control(
                SliderElement(MIDI_CC_TYPE, CHANNEL, MIX_FADERS[index]))

            mixer.channel_strip(index).set_arm_button(
                ButtonElement(True, MIDI_NOTE_TYPE, CHANNEL,
                              ARM_BUTTONS[index]))  #sets the record arm button
            mixer.channel_strip(index).set_solo_button(
                ButtonElement(True, MIDI_NOTE_TYPE, CHANNEL,
                              SOLO_BUTTONS[index]))
            mixer.channel_strip(index).set_mute_button(
                ButtonElement(True, MIDI_NOTE_TYPE, CHANNEL,
                              MUTE_BUTTONS[index]))
            mixer.channel_strip(index).set_select_button(
                ButtonElement(True, MIDI_NOTE_TYPE, CHANNEL,
                              TRACK_SELECTS[index]))
        """TRANSPORT CONTROLS"""
        stop_button = ButtonElement(False, MIDI_CC_TYPE, 0, STOP_BUTTON)
        play_button = ButtonElement(False, MIDI_CC_TYPE, 0, PLAY_BUTTON)
        record_button = ButtonElement(False, MIDI_CC_TYPE, 0, RECORD_BUTTON)
        transport = TransportComponent()
        transport.set_stop_button(stop_button)
        transport.set_play_button(play_button)
        transport.set_overdub_button(record_button)
        transport.set_overdub_button(record_button)
        transport.set_seek_buttons(
            ButtonElement(False, MIDI_CC_TYPE, 0, SEEK_LEFT),
            ButtonElement(False, MIDI_CC_TYPE, 0, SEEK_RIGHT))

    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, MACRO_CONTROLS[index]))
        self._device.set_parameter_controls(device_param_controls)
        self._device.set_on_off_button(
            ButtonElement(True, MIDI_NOTE_TYPE, CHANNEL, DEVICE_ON))
        self._device.set_lock_button(
            ButtonElement(True, MIDI_NOTE_TYPE, CHANNEL, DEVICE_LOCK))
        self.set_device_component(self._device)

        self._device_nav = DeviceNavComponent()
        self._device_nav.set_device_nav_buttons(
            ButtonElement(True, MIDI_NOTE_TYPE, CHANNEL, PREVIOUS_DEVICE),
            ButtonElement(True, MIDI_NOTE_TYPE, CHANNEL, NEXT_DEVICE))

    def _set_session_highlight(self, track_offset, scene_offset, width, height,
                               include_return_tracks):
        if not self._suppress_session_highlight:
            ControlSurface._set_session_highlight(self, track_offset,
                                                  scene_offset, width, height,
                                                  include_return_tracks)

    def disconnect(self):
        """clean things up on disconnect"""
        ControlSurface.disconnect(self)
        return None
Esempio n. 7
0
class skym(ControlSurface):
    def __init__(self, c_instance):
        ControlSurface.__init__(self, c_instance)
        self._device_selection_follows_track_selection = True
        with self.component_guard():
            self._suppress_send_midi = True
            self._suppress_session_highlight = True
            self._control_is_with_automap = False
            is_momentary = True
            self._suggested_input_port = 'iPhone'
            self._suggested_output_port = 'iPhone'
            self.log("BEFORE mixer")
            self._setup_mixer_control()
            self._setup_device_control()

    def log(self, message):
        sys.stderr.write("LOG: " + message.encode("utf-8"))

    def _setup_mixer_control(self):
        """TRANSPORT CONTROLS"""
        stop_button = ButtonElement(False, MIDI_CC_TYPE, 0, STOP_BUTTON)
        play_button = ButtonElement(False, MIDI_CC_TYPE, 0, PLAY_BUTTON)
        record_button = ButtonElement(False, MIDI_CC_TYPE, 0, RECORD_BUTTON)
        transport = TransportComponent()
        transport.set_stop_button(stop_button)
        transport.set_play_button(play_button)
        transport.set_overdub_button(record_button)
        transport.set_overdub_button(record_button)
        transport.set_seek_buttons(
            ButtonElement(False, MIDI_CC_TYPE, 0, SEEK_LEFT),
            ButtonElement(False, MIDI_CC_TYPE, 0, SEEK_RIGHT))

    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, MACRO_CONTROLS[index]))
        self._device.set_parameter_controls(device_param_controls)
        # self._device.set_on_off_button(ButtonElement(True, MIDI_CC_TYPE, CHANNEL, DEVICE_ON))
        self._device.set_lock_button(
            ButtonElement(False, MIDI_CC_TYPE, CHANNEL, 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, DEVICE_ON)
        down_bank_button = ButtonElement(True, MIDI_CC_TYPE, CHANNEL,
                                         DEVICE_LOCK)
        # 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, PREVIOUS_DEVICE),
            ButtonElement(True, MIDI_CC_TYPE, CHANNEL, NEXT_DEVICE))
        # self._device.set_bank_prev_button(down_bank_button)
        # self._device.set_bank_next_button(up_bank_button)

    def disconnect(self):
        """clean things up on disconnect"""
        ControlSurface.disconnect(self)
        return None