Ejemplo n.º 1
0
    def lower_panel_shift(self):

        # Initialize the rows
        top_row = [None] * 8
        lower_row = [None] * 8

        # Enter
        top_row[0] = 'green_low'
        top_row[2] = 'green_low'

        # Highlight arrows
        top_row[1] = 'yellow_low'
        lower_row[0] = 'yellow_low'
        lower_row[1] = 'yellow_low'
        lower_row[2] = 'yellow_low'

        # Transport
        lower_row[3] = 'yellow_low'
        lower_row[4] = 'yellow_low'
        lower_row[5] = 'red_low'
        lower_row[6] = 'green_low'
        lower_row[7] = 'red_low'

        if state.play_status:
            lower_row[5] = 'red'

        if state.play_status:
            lower_row[6] = 'green'

        if state.play_status:
            lower_row[7] = 'red'

        # Knob mode
        top_row[3] = 'yellow_low'
        top_row[4] = 'yellow_low'
        top_row[5] = 'yellow_low'
        top_row[6] = 'yellow_low'
        top_row[7] = 'yellow_low'

        if state.knob_mode == 'pan':
            top_row[3] = 'yellow'

        elif state.knob_mode == 'stereo':
            top_row[3] = 'yellow'

        if state.knob_mode == 'sends':
            top_row[3] = 'yellow'

        if state.knob_mode == 'effect':
            top_row[3] = 'yellow'

        if state.knob_mode == 'eq':
            top_row[3] = 'yellow'

        # Send the panel
        for value, index in zip(top_row, range(24, 32)):
            d_translator.light_on(self.midiout_launchcontrol, index, value)

        for value, index in zip(lower_row, range(32, 40)):
            d_translator.light_on(self.midiout_launchcontrol, index, value)
Ejemplo n.º 2
0
    def hold_cursor_right(self):

        d_translator.light_on(self.midiout_launchcontrol, 34, 'amber')

        while self.keep_running:

            # Get the message
            message = self.midiin_launchcontrol.poll()

            if message:

                # Organize the values
                data = message.dict()

                if data['note'] == 75 and data['velocity'] == 0:
                    d_translator.light_on(self.midiout_launchcontrol, 34,
                                          'amber_low')
                    return

            translator.cursor_right(self.midiout_external)

            time.sleep(0.1)
Ejemplo n.º 3
0
    def light_next_knob(self):
        translator.light_on(self.midiout_launchcontrol, 16 + state.knob_leds,
                            'amber')

        if state.knob_leds == 0:
            translator.light_on(self.midiout_launchcontrol, 16 + 7, 'off')
        else:
            translator.light_on(self.midiout_launchcontrol,
                                16 + state.knob_leds - 1, 'off')

        state.knob_leds += 1

        if state.knob_leds == 8:
            state.knob_leds = 0
Ejemplo n.º 4
0
 def reset_knob_panel(self):
     d_translator.light_on(self.midiout_launchcontrol, 27, 'yellow_low')
     d_translator.light_on(self.midiout_launchcontrol, 28, 'yellow_low')
     d_translator.light_on(self.midiout_launchcontrol, 29, 'yellow_low')
     d_translator.light_on(self.midiout_launchcontrol, 30, 'yellow_low')
     d_translator.light_on(self.midiout_launchcontrol, 31, 'yellow_low')
Ejemplo n.º 5
0
    def upper_panel(self):

        for value, index in zip(state.channel_focus, range(24, 32)):
            d_translator.light_on(self.midiout_launchcontrol, index, value)
Ejemplo n.º 6
0
    def shift(self):

        # Light the panel
        self.light_right_panel_shift()
        self.light_on_device()
        self.lower_panel_shift()

        while self.keep_running:

            # Get the message
            message = self.midiin_launchcontrol.poll()

            if message:

                # Organize the values
                data = message.dict()

                print("output", data)

                if data['type'] in ['note_on', 'note_off']:

                    # Release shift key
                    if data['note'] == 105 and data['velocity'] == 127:
                        return

                    # Enter
                    elif data['note'] == 41:
                        if data['velocity'] == 127:
                            d_translator.light_on(self.midiout_launchcontrol,
                                                  24, 'green')
                            translator.enter(self.midiout_external)
                        else:
                            d_translator.light_on(self.midiout_launchcontrol,
                                                  24, 'green_low')

                    # Tab
                    elif data['note'] == 43:
                        if data['velocity'] == 127:
                            d_translator.light_on(self.midiout_launchcontrol,
                                                  26, 'green')
                            translator.tab(self.midiout_external)
                        else:
                            d_translator.light_on(self.midiout_launchcontrol,
                                                  26, 'green_low')

                    # Mute
                    elif data['note'] == 106 and data['velocity'] == 127:
                        state.current_window = 'mixer'
                        self.light_right_panel_shift()

                    # Solo
                    elif data['note'] == 107 and data['velocity'] == 127:
                        state.current_window = 'pattern'
                        translator.activate_pattern_window(
                            self.midiout_external)
                        self.light_right_panel_shift()

                    # Record Arm
                    elif data['note'] == 108 and data['velocity'] == 127:
                        state.current_window = 'browser'
                        translator.activate_browser_window(
                            self.midiout_external)
                        self.light_right_panel_shift()

                    # Up
                    elif data['note'] == 42 and data['velocity'] == 127:
                        self.hold_cursor_up()

                    # Pan
                    elif data['note'] == 44 and data['velocity'] == 127:
                        self.reset_knob_panel()
                        d_translator.light_on(self.midiout_launchcontrol, 27,
                                              'yellow')
                        translator.pan(self.midiout_external)

                    # Stereo
                    elif data['note'] == 57 and data['velocity'] == 127:
                        self.reset_knob_panel()
                        d_translator.light_on(self.midiout_launchcontrol, 28,
                                              'yellow')
                        translator.stereo(self.midiout_external)

                    # Sends
                    elif data['note'] == 58 and data['velocity'] == 127:
                        self.reset_knob_panel()
                        d_translator.light_on(self.midiout_launchcontrol, 29,
                                              'yellow')
                        translator.sends(self.midiout_external)

                    # Effect
                    elif data['note'] == 59 and data['velocity'] == 127:
                        self.reset_knob_panel()
                        d_translator.light_on(self.midiout_launchcontrol, 30,
                                              'yellow')
                        translator.effect(self.midiout_external)

                    # EQ
                    elif data['note'] == 60 and data['velocity'] == 127:
                        self.reset_knob_panel()
                        d_translator.light_on(self.midiout_launchcontrol, 31,
                                              'yellow')
                        translator.eq(self.midiout_external)

                    # Down
                    elif data['note'] == 74 and data['velocity'] == 127:
                        self.hold_cursor_down()

                    # Left
                    elif data['note'] == 73 and data['velocity'] == 127:
                        self.hold_cursor_left()

                    # Right
                    elif data['note'] == 75 and data['velocity'] == 127:
                        self.hold_cursor_right()

                    # <<
                    elif data['note'] == 76:
                        if data['velocity'] == 127:
                            d_translator.light_on(self.midiout_launchcontrol,
                                                  35, 'amber')
                            translator.rewind(self.midiout_external)
                        else:
                            d_translator.light_on(self.midiout_launchcontrol,
                                                  35, 'amber_low')
                            translator.rewind_off(self.midiout_external)

                    # >>
                    elif data['note'] == 89:
                        if data['velocity'] == 127:
                            d_translator.light_on(self.midiout_launchcontrol,
                                                  36, 'amber')
                            translator.forward(self.midiout_external)
                        else:
                            d_translator.light_on(self.midiout_launchcontrol,
                                                  36, 'amber_low')
                            translator.forward_off(self.midiout_external)

                    # Stop
                    elif data['note'] == 90:
                        if data['velocity'] == 127:
                            translator.stop(self.midiout_external)
                            d_translator.light_on(self.midiout_launchcontrol,
                                                  37, 'red')
                            d_translator.light_on(self.midiout_launchcontrol,
                                                  38, 'green_low')

                        else:
                            d_translator.light_on(self.midiout_launchcontrol,
                                                  37, 'red_low')

                    # Play
                    elif data['note'] == 91:
                        if data['velocity'] == 127:
                            translator.play(self.midiout_external)
                            d_translator.light_on(self.midiout_launchcontrol,
                                                  38, 'green')
                            d_translator.light_on(self.midiout_launchcontrol,
                                                  37, 'red_low')

                    # Record
                    elif data['note'] == 92:
                        if data['velocity'] == 127:
                            translator.record(self.midiout_external)

                            if state.rec_status:
                                d_translator.light_on(
                                    self.midiout_launchcontrol, 39, 'red_low')
                            else:
                                d_translator.light_on(
                                    self.midiout_launchcontrol, 39, 'red')

                            state.rec_status = not state.rec_status
                            print(state.rec_status)

                # Control change
                elif data['type'] == 'control_change':

                    # Preserve fader movement
                    if data['control'] in self.faders:
                        # Send the fader movement
                        translator.move_fader(self.midiout_external,
                                              data['value'], data['control'])

                    elif data['control'] in self.knobs:
                        translator.move_knob(self.midiout_external,
                                             data['value'], data['control'])

                    # Check arrow keys
                    self.arrow_keys(data)

            time.sleep(self.default_timeout)
Ejemplo n.º 7
0
    def knob_leds_off(self):

        for i in range(16, 24):
            translator.light_on(self.midiout_launchcontrol, i, 'off')

        state.knob_leds = 0