def Sync(self, flags): """ Syncs up all visual indicators on keyboard with changes from FL Studio. """ # Update buttons if flags & midi.HW_Dirty_LEDs: led_map = { ArturiaLights.ID_TRANSPORTS_RECORD: ArturiaLights.AsOnOffByte(transport.isRecording()), ArturiaLights.ID_TRANSPORTS_LOOP: ArturiaLights.AsOnOffByte(ui.isLoopRecEnabled()), ArturiaLights.ID_GLOBAL_METRO: ArturiaLights.AsOnOffByte(ui.isMetronomeEnabled()), ArturiaLights.ID_GLOBAL_SAVE: ArturiaLights.AsOnOffByte(transport.getLoopMode() == 1), ArturiaLights.ID_GLOBAL_UNDO: ArturiaLights.AsOnOffByte(general.getUndoHistoryLast() == 0), ArturiaLights.ID_TRACK_SOLO: ArturiaLights.AsOnOffByte( channels.isChannelSolo(channels.selectedChannel())), ArturiaLights.ID_TRACK_MUTE: ArturiaLights.AsOnOffByte( channels.isChannelMuted(channels.selectedChannel())), ArturiaLights.ID_TRANSPORTS_STOP: ArturiaLights.AsOnOffByte(not transport.isPlaying()), ArturiaLights.ID_TRANSPORTS_PLAY: ArturiaLights.AsOnOffByte(transport.getSongPos() > 0), ArturiaLights.ID_GLOBAL_OUT: ArturiaLights.AsOnOffByte( arrangement.selectionEnd() > arrangement.selectionStart()), ArturiaLights.ID_NAVIGATION_LEFT: ArturiaLights.AsOnOffByte(ui.getVisible(midi.widChannelRack)), ArturiaLights.ID_NAVIGATION_RIGHT: ArturiaLights.AsOnOffByte(ui.getVisible(midi.widMixer)), ArturiaLights.ID_OCTAVE_PLUS: ArturiaLights.LED_OFF, ArturiaLights.ID_OCTAVE_MINUS: ArturiaLights.LED_OFF, } self._lights.SetLights(led_map) self._encoders.Refresh() # Update display channel_name = channels.getChannelName(channels.selectedChannel()) pattern_number = patterns.patternNumber() pattern_name = patterns.getPatternName(pattern_number) update = ( flags & ( 1024 # HW_Dirty_Patterns | 2048 # HW_Dirty_Tracks | 16384 # HW_Dirty_Names | 32 # HW_Dirty_FocusedWindow (channel selection) )) > 0 self._paged_display.SetPageLines( 'main', line1='[%d:%d] %s' % (channels.selectedChannel() + 1, pattern_number, channel_name), line2='%s' % pattern_name, update=update)
def OnTrackRecordShortPress(self, event): debug.log('OnTrackRecord Short', 'Dispatched', event=event) # Piano roll needs to be in focus to determine if a new pattern is needed piano_roll_visible = ui.getVisible(midi.widPianoRoll) self._show_and_focus(midi.widPianoRoll) if arrangement.selectionEnd() > arrangement.selectionStart(): self._new_pattern_from_selected() else: self._new_empty_pattern() if not piano_roll_visible: ui.hideWindow(midi.widPianoRoll)
def _adjust_selection_range(start_delta=0, end_delta=0, factor=1.0): start_time = arrangement.selectionStart() end_time = arrangement.selectionEnd() if start_time < 0: start_time = arrangement.currentTime(False) start_time += int(start_delta * factor) start_time = max(0, start_time) if end_time < 0: end_time = start_time + 1 end_time += int(end_delta * factor) end_time = max(0, end_time) arrangement.liveSelection(start_time, False) arrangement.liveSelection(end_time, True)
def Sync(self): """ Syncs up all visual indicators on keyboard with changes from FL Studio. """ # Update buttons active_index = channels.selectedChannel() led_map = { ArturiaLights.ID_TRANSPORTS_RECORD: ArturiaLights.AsOnOffByte(transport.isRecording()), ArturiaLights.ID_TRANSPORTS_LOOP: ArturiaLights.AsOnOffByte(ui.isLoopRecEnabled()), ArturiaLights.ID_GLOBAL_METRO: ArturiaLights.AsOnOffByte(ui.isMetronomeEnabled()), ArturiaLights.ID_GLOBAL_SAVE: ArturiaLights.AsOnOffByte(transport.getLoopMode() == 1), ArturiaLights.ID_GLOBAL_UNDO: ArturiaLights.AsOnOffByte(general.getUndoHistoryLast() == 0), ArturiaLights.ID_TRACK_SOLO: ArturiaLights.AsOnOffByte(channels.isChannelSolo(active_index)), ArturiaLights.ID_TRACK_MUTE: ArturiaLights.AsOnOffByte(channels.isChannelMuted(active_index)), ArturiaLights.ID_TRANSPORTS_STOP: ArturiaLights.AsOnOffByte(not transport.isPlaying()), ArturiaLights.ID_TRANSPORTS_PLAY: ArturiaLights.AsOnOffByte(transport.getSongPos() > 0), ArturiaLights.ID_GLOBAL_OUT: ArturiaLights.AsOnOffByte( arrangement.selectionEnd() > arrangement.selectionStart()), } self._lights.SetLights(led_map) # Update selected channel bank_lights = [ArturiaLights.LED_OFF] * 9 if active_index < len(bank_lights): bank_lights[active_index] = ArturiaLights.LED_ON self._lights.SetBankLights(bank_lights) # Update display channel_name = channels.getChannelName(active_index) pattern_number = patterns.patternNumber() pattern_name = patterns.getPatternName(pattern_number) # Update knob mode if self._encoders.GetCurrentMode() == ArturiaInputControls.INPUT_MODE_CHANNEL_PLUGINS: plugin_name = plugins.getPluginName(active_index) if plugins.isValid(active_index) else '' self._encoders.SetKnobMode(plugin_name) self._encoders.SetSliderMode(plugin_name) if channel_name.startswith('Analog Lab'): channel_name='Analog Lab' self._paged_display.SetPageLines( 'main', line1='[%d:%d] %s' % (active_index + 1, pattern_number, channel_name), line2='%s' % pattern_name) self._encoders.Refresh()
def OnTrackRecordShortPress(self, event): debug.log('OnTrackRecord Short', 'Dispatched', event=event) if arrangement.selectionEnd() > arrangement.selectionStart(): self._new_pattern_from_selected() else: self._new_empty_pattern()