def SetFirstTrack(self, Value): self.FirstTrackT[self.FirstTrack] = (Value + mixer.trackCount()) % mixer.trackCount() s = utils.Zeros(self.FirstTrackT[self.FirstTrack], 2, ' ') self.UpdateColT() self.SendAssignmentMsg(s) device.hardwareRefreshMixerTrack(-1)
def _find_data(self): prefix = self._get_pattern_name() name = mixer.getTrackName(mixer.trackCount() - 1) if name.startswith(prefix): line = name[len(prefix):] self._last_state = line return line return ''
def UpdateLEDs(self): if device.isAssigned(): r = transport.isRecording() b = 0 for m in range(0, mixer.trackCount()): if mixer.isTrackArmed(m): b = 1 + int(r) break device.midiOutNewMsg((0x73 << 8) + midi.TranzPort_OffOnBlinkT[b], 16)
def set_mixer_track_route(n): if type(n) is str and n.isdigit(): n = int(n) currTrack = mixer.trackNumber() for dest in range(mixer.trackCount()): active = mixer.getRouteSendActive(currTrack, dest) if active: mixer.setRouteTo(currTrack, dest, 0) mixer.setRouteTo(currTrack, n, 1) mixer.getRouteSendActive(currTrack, n) print("set_mixer_track_route:", n)
def OnUpdateTargetMixerTrack(self, delta): max_track_idx = mixer.trackCount() - 2 # One of the track is a control track prev_track = channels.getTargetFxTrack(channels.selectedChannel()) target_track = self.circular(0, max_track_idx, prev_track + delta) # Remember to unset the name of the previous pointed to track. mixer.setTrackNumber(target_track, midi.curfxMinimalLatencyUpdate) mixer.linkTrackToChannel(midi.ROUTE_ToThis) channel_idx = self._channel_with_route_to_mixer_track(prev_track) if channel_idx < 0: mixer.setTrackName(prev_track, '') elif mixer.getTrackName(prev_track) == mixer.getTrackName(target_track): mixer.setTrackName(prev_track, channels.getChannelName(channel_idx)) if target_track == 0: mixer.setTrackName(target_track, '')
def UpdateColT(self): f = self.FirstTrackT[self.FirstTrack] CurID = mixer.getTrackPluginId(mixer.trackNumber(), 0) for m in range(0, len(self.ColT)): self.ColT[m].KnobPressEventID = -1 # mixer if m == 8: self.ColT[m].TrackNum = -2 self.ColT[m].BaseEventID = midi.REC_MainVol self.ColT[m].SliderEventID = self.ColT[m].BaseEventID self.ColT[m].SliderName = 'Master Vol' else: self.ColT[m].TrackNum = midi.TrackNum_Master + ((f + m) % mixer.trackCount()) self.ColT[m].BaseEventID = mixer.getTrackPluginId(self.ColT[m].TrackNum, 0) self.ColT[m].SliderEventID = self.ColT[m].BaseEventID + midi.REC_Mixer_Vol s = mixer.getTrackName(self.ColT[m].TrackNum) self.ColT[m].SliderName = s + ' - Vol' self.ColT[m].KnobEventID = -1 self.ColT[m].KnobResetEventID = -1 self.ColT[m].KnobResetValue = midi.FromMIDI_Max >> 1 self.ColT[m].KnobName = '' self.ColT[m].KnobMode = 1 # parameter, pan, volume, off self.ColT[m].KnobCenter = -1 self.ColT[m].KnobEventID = self.ColT[m].BaseEventID + midi.REC_Mixer_Pan self.ColT[m].KnobResetEventID = self.ColT[m].KnobEventID self.ColT[m].KnobName = mixer.getTrackName( self.ColT[m].TrackNum) + ' - ' + 'Pan' # self.Flip knob & slider if self.Flip: self.ColT[m].KnobEventID, self.ColT[m].SliderEventID = utils.SwapInt(self.ColT[m].KnobEventID, self.ColT[m].SliderEventID) s = self.ColT[m].SliderName self.ColT[m].SliderName = self.ColT[m].KnobName self.ColT[m].KnobName = s self.ColT[m].KnobMode = 2 self.ColT[m].KnobCenter = -1 self.ColT[m].KnobResetValue = round(12800 * midi.FromMIDI_Max / 16000) self.ColT[m].KnobResetEventID = self.ColT[m].KnobEventID self.ColT[m].LastValueIndex = 48 + m * 6 self.ColT[m].Peak = 0 self.ColT[m].ZPeak = False self.UpdateCol(m)
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)
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)))
def _set_data(self, line): mixer.setTrackName(mixer.trackCount() - 1, self._get_pattern_name() + line)
def moveSelectedMixerTrack(self, offset): selected_track = (mixer.trackNumber() + offset) % mixer.trackCount() mixer.setTrackNumber(selected_track) return selected_track
def mixer_track_right(unused_param_value): """Next mixer track""" select = (mixer.trackNumber() + 1) % (mixer.trackCount() - 1) mixer.setTrackNumber(select, midi.curfxScrollToMakeVisible)
mixerTreshold = 0.15 selectedTrack = mixer.getTrackInfo(3) LEDmode = 2 # set to 0 to disable this if the very slight input lag bothers you selectFeedbackDuration = 0 # when disabled, the solo buttons can be mapped to 'Link to controller' functions in FL Studio useNormalSolo = True # CONSTANTS potInput = 176 buttonPress = midi.MIDI_NOTEON buttonRelease = midi.MIDI_NOTEOFF minimumAPIVersion = 7 realTrackCount = mixer.trackCount() - 2 # Environment variables trackOffset = 1 soloStates = [0, 0, 0, 0, 0, 0, 0, 0] def constrain(number, max, trueMax): return number * max / trueMax def constrainPan(number): if number >= panDeadZoneLow and number <= panDeadZoneHigh: return 0 else: return constrain(number, 2, 127) - 1.0