コード例 #1
0
 def OnUpdatePattern(self, delta):
     index = self.clip(1, patterns.patternCount(),
                       patterns.patternNumber() + delta)
     if (config.ENABLE_PATTERN_NAV_WHEEL_CREATE_NEW_PATTERN and
             patterns.patternNumber() + delta > patterns.patternCount()):
         self._new_empty_pattern(linked=False)
     else:
         arturia_playlist.select_playlist_track_from_pattern(index)
コード例 #2
0
def next_pattern_name():
    """Returns the next suggested pattern name."""
    pattern_names = _all_pattern_names()
    # If there are N patterns, then at most, N+1 instruments
    selected = channels.selectedChannel()
    name = strip_pattern_name(channels.getChannelName(selected))
    if name not in pattern_names:
        return name

    for i in range(1, patterns.patternCount() + 1):
        suggested = '%s [%d]' % (name, i)
        if suggested not in pattern_names:
            return suggested
    return '%s [%d]' % (name, patterns.patternCount() + 1)
コード例 #3
0
def _select_pattern_named(name):
    for i in range(1, patterns.patternCount() + 1):
        if strip_pattern_name(patterns.getPatternName(i)) == name:
            patterns.jumpToPattern(i)
            return
    # No pattern found
    patterns.deselectAll()
コード例 #4
0
 def OnTrackWrite(self, event):
     debug.log('OnTrackWrite', 'Dispatched', event=event)
     # Move to next pattern (move down pattern list)
     next = patterns.patternNumber() + 1
     if next > patterns.patternCount():
         return
     patterns.jumpToPattern(next)
コード例 #5
0
 def _new_empty_pattern(self, linked=True):
     pattern_id = patterns.patternCount() + 1
     if linked:
         pattern_name = arturia_playlist.next_pattern_name()
         color = channels.getChannelColor(channels.selectedChannel())
         patterns.setPatternName(pattern_id, pattern_name)
         patterns.setPatternColor(pattern_id, color)
     patterns.jumpToPattern(pattern_id)
     patterns.selectPattern(pattern_id, 1)
     return pattern_id
コード例 #6
0
 def OnTrackWrite(self, event):
     debug.log('OnTrackWrite', 'Dispatched', event=event)
     # Move to next pattern (move down pattern list)
     if self._button_mode == arturia_macros.SAVE_BUTTON:
         # Adjust track number.
         self._change_playlist_track(1)
     else:
         next = patterns.patternNumber() + 1
         if next > patterns.patternCount():
             return
         arturia_playlist.select_playlist_track_from_pattern(next)
コード例 #7
0
 def OnEncoderTempoIncreased(self, control, event):
     if self.controls.isButtonShiftPressed:
         transport.globalTransport(midi.FPT_TempoJog, 10)
     elif ui.getFocused(midi.widChannelRack):
         idx = channels.channelNumber(1)
         print(idx)
         if idx == -1:
             channels.selectChannel(0, 1)
         elif idx < channels.channelCount() - 1:
             channels.deselectAll()
             channels.selectChannel(idx + 1, 1)
     elif ui.getFocused(midi.widPlaylist):
         idx = patterns.patternNumber()
         if idx < patterns.patternCount(
         ):  # TODO figure out why patternNumber starts at one instead of zero!
             patterns.jumpToPattern(idx + 1)
     elif ui.getFocused(midi.widMixer):
         idx = mixer.trackNumber()
         if idx < mixer.trackCount():
             mixer.setTrackNumber(idx + 1)
コード例 #8
0
def _all_pattern_names():
    return (strip_pattern_name(patterns.getPatternName(i))
            for i in range(1,
                           patterns.patternCount() + 1))
コード例 #9
0
    def updateLEDs(self):
        if device.isAssigned():
            # play button
            if transport.isPlaying() and transport.getLoopMode():
                self.updateLED(CONTROLS.BUTTONS.PLAY, COLORS.RGB.GREEN,
                               ANIMATIONS.BLINKING.QUARTER)
            elif transport.isPlaying():
                self.updateLED(CONTROLS.BUTTONS.PLAY, COLORS.RGB.ORANGE,
                               ANIMATIONS.BLINKING.QUARTER)
            else:
                self.updateLED(CONTROLS.BUTTONS.PLAY)

            # record button
            if transport.isRecording():
                self.updateLED(CONTROLS.BUTTONS.RECORD, COLORS.RGB.RED)
            else:
                self.updateLED(CONTROLS.BUTTONS.RECORD)

            # double loop [song/pattern] button
            if transport.getLoopMode():
                self.updateLED(CONTROLS.BUTTONS.DOUBLE_LOOP)
            else:
                self.updateLED(CONTROLS.BUTTONS.DOUBLE_LOOP, COLORS.BW.WHITE)

            # metronome button
            if ui.isMetronomeEnabled():
                self.updateLED(CONTROLS.BUTTONS.METRONOME, COLORS.BW.WHITE)
            else:
                self.updateLED(CONTROLS.BUTTONS.METRONOME)

            # device [channel rack] button
            if ui.getFocused(midi.widChannelRack):
                self.updateLED(CONTROLS.BUTTONS.DEVICE, COLORS.BW.WHITE)
            else:
                self.updateLED(CONTROLS.BUTTONS.DEVICE)

            # mix [mixer] button
            if ui.getFocused(midi.widMixer):
                self.updateLED(CONTROLS.BUTTONS.MIX, COLORS.BW.WHITE)
            else:
                self.updateLED(CONTROLS.BUTTONS.MIX)

            # clip [playlist] button
            if ui.getFocused(midi.widPlaylist):
                self.updateLED(CONTROLS.BUTTONS.CLIP, COLORS.BW.WHITE)
            else:
                self.updateLED(CONTROLS.BUTTONS.CLIP)

            # browse [browser] button
            # if ui.getFocused(midi.widBrowser):
            #     self.updateLED(CONTROLS.BUTTONS.BROWSE, COLORS.BW.WHITE)
            # else:
            #     self.updateLED(CONTROLS.BUTTONS.BROWSE)

            # layout button
            if ui.getFocused(midi.widPlaylist):
                if self.playlist.layout == LAYOUTS.PLAYLIST.PATTERNS:
                    self.updateLED(CONTROLS.BUTTONS.LAYOUT, COLORS.BW.WHITE)
            else:
                self.updateLED(CONTROLS.BUTTONS.LAYOUT)

            # quantize/snap button
            if ui.getSnapMode() != 3:
                self.updateLED(CONTROLS.BUTTONS.QUANTIZE, COLORS.BW.WHITE)
            else:
                self.updateLED(CONTROLS.BUTTONS.QUANTIZE)

            # numbered upper buttons
            for idx, button in enumerate(CONTROLS.BUTTONS_UPPER, 1):
                if ui.getFocused(midi.widMixer):
                    if (idx == self.mixer.encodersTarget):
                        self.updateLED(button, COLORS.RGB.WHITE)
                    else:
                        self.updateLED(button)
                elif ui.getFocused(midi.widChannelRack):
                    if (idx == self.channels.encodersTarget):
                        self.updateLED(button, COLORS.RGB.ORANGE)
                    else:
                        self.updateLED(button)
                elif ui.getFocused(midi.widPlaylist):
                    if (idx == self.playlist.encodersTarget):
                        self.updateLED(button, COLORS.RGB.GREEN)
                    else:
                        self.updateLED(button)
                else:
                    self.updateLED(button)

            # pads
            for idx, pad in enumerate(CONTROLS.PADS_64):
                self.updateLED(pad, 0)
                if ui.getFocused(midi.widMixer):
                    idx += 1  # do not include the master track (0)
                    if idx < mixer.trackCount():
                        self.updateLED(
                            pad, getClosestColor(mixer.getTrackColor(idx)))
                        if mixer.isTrackSelected(
                                idx) and not mixer.isTrackEnabled(idx):
                            self.updateLED(pad, COLORS.RGB.GREEN)
                            self.updateLED(pad, COLORS.RGB.RED,
                                           ANIMATIONS.BLINKING.HALF)
                        elif mixer.isTrackSelected(idx):
                            self.updateLED(pad, COLORS.RGB.GREEN)
                            self.updateLED(
                                pad, getClosestColor(mixer.getTrackColor(idx)),
                                ANIMATIONS.PULSING.HALF)
                        elif not mixer.isTrackEnabled(idx):
                            self.updateLED(pad, COLORS.RGB.RED,
                                           ANIMATIONS.PULSING.HALF)
                elif ui.getFocused(midi.widChannelRack):
                    if idx < channels.channelCount():
                        self.updateLED(
                            pad,
                            getClosestColor(channels.getChannelColor(idx)))
                        if channels.isChannelSelected(
                                idx) and not channels.isChannelMuted(
                                    idx):  # NOTE asked this bug to be fixed!
                            self.updateLED(pad, COLORS.RGB.GREEN)
                            self.updateLED(pad, COLORS.RGB.RED,
                                           ANIMATIONS.BLINKING.HALF)
                        elif channels.isChannelSelected(idx):
                            self.updateLED(pad, COLORS.RGB.GREEN)
                            self.updateLED(
                                pad,
                                getClosestColor(channels.getChannelColor(idx)),
                                ANIMATIONS.PULSING.HALF)
                        elif not channels.isChannelMuted(
                                idx):  # NOTE asked this bug to be fixed!
                            self.updateLED(pad, COLORS.RGB.RED,
                                           ANIMATIONS.PULSING.HALF)
                elif ui.getFocused(midi.widPlaylist):
                    idx += 1  # NOTE asked this bug to be fixed!
                    if idx <= patterns.patternCount():
                        # self.updateLED(pad, getClosestColor(patterns.getPatternColor(idx)))
                        # if patterns.isPatternSelected(idx) and not patterns.isPatternEnabled(idx):
                        #     self.updateLED(pad, COLORS.RGB.GREEN)
                        #     self.updateLED(pad, COLORS.RGB.RED, ANIMATIONS.BLINKING.HALF)
                        # elif patterns.isPatternSelected(idx):
                        #     self.updateLED(pad, COLORS.RGB.GREEN)
                        #     self.updateLED(pad, getClosestColor(patterns.getPatternColor(idx)), ANIMATIONS.PULSING.HALF)
                        # elif not patterns.isPatternEnabled(idx):
                        #     self.updateLED(pad, COLORS.RGB.RED, ANIMATIONS.PULSING.HALF)
                        if (idx == patterns.patternNumber()):
                            # self.updateLED(pad, getClosestColor(patterns.getPatternColor(idx)))
                            self.updateLED(pad, COLORS.RGB.GREEN)
                            self.updateLED(pad, COLORS.RGB.RED,
                                           ANIMATIONS.PULSING.HALF)
                        else:
                            self.updateLED(
                                pad,
                                getClosestColor(patterns.getPatternColor(idx)))
コード例 #10
0
 def _new_empty_pattern(self):
     pattern_id = patterns.patternCount() + 1
     patterns.setPatternName(pattern_id, 'Pattern %d' % pattern_id)
     patterns.jumpToPattern(pattern_id)
     patterns.selectPattern(pattern_id, 1)
     return pattern_id
コード例 #11
0
 def OnUpdatePattern(self, delta):
     index = self.clip(1, patterns.patternCount(), patterns.patternNumber() + delta)
     patterns.jumpToPattern(index)