Exemplo n.º 1
0
    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)
Exemplo n.º 2
0
 def add_time_marker(unused_param_value):
     """Add time marker"""
     window_active = ui.getVisible(midi.widPianoRoll) and ui.getFocused(
         midi.widPianoRoll)
     window_active |= ui.getVisible(midi.widPlaylist) and ui.getFocused(
         midi.widPlaylist)
     if not window_active:
         window = midi.widPlaylist if transport.getLoopMode(
         ) else midi.widPianoRoll
         ui.showWindow(window)
         ui.setFocused(window)
     Actions.fl_windows_shortcut('t', ctrl=1)
Exemplo n.º 3
0
 def OnButtonClipPressed(self, control, event):
     if not ui.getFocused(midi.widPlaylist) or not ui.getVisible(
             midi.widPlaylist):
         transport.globalTransport(midi.FPT_F5, event.pmeFlags)
     elif self.controls.isButtonShiftPressed and ui.getFocused(
             midi.widPlaylist):
         transport.globalTransport(midi.FPT_F5, event.pmeFlags)
Exemplo n.º 4
0
 def OnButtonMixPressed(self, control, event):
     if not ui.getFocused(midi.widMixer) or not ui.getVisible(
             midi.widMixer):
         transport.globalTransport(midi.FPT_F9, event.pmeFlags)
     elif self.controls.isButtonShiftPressed and ui.getFocused(
             midi.widMixer):
         transport.globalTransport(midi.FPT_F9, event.pmeFlags)
Exemplo n.º 5
0
 def OnButtonDevicePressed(self, control, event):
     if not ui.getFocused(midi.widChannelRack) or not ui.getVisible(
             midi.widChannelRack):
         transport.globalTransport(midi.FPT_F6, event.pmeFlags)
     elif self.controls.isButtonShiftPressed and ui.getFocused(
             midi.widChannelRack):
         transport.globalTransport(midi.FPT_F6, event.pmeFlags)
Exemplo n.º 6
0
 def _toggle_visibility(self, window):
     if not ui.getVisible(window):
         ui.showWindow(window)
         ui.setFocused(window)
         return True
     else:
         ui.hideWindow(window)
         return False
Exemplo n.º 7
0
 def toggle_browser_visibility(unused_param_value):
     """Toggle browser"""
     if PYKEYS_ENABLED:
         Actions.fl_windows_shortcut('f8', alt=1)
     else:
         if ui.getVisible(midi.widBrowser):
             ui.hideWindow(midi.widBrowser)
         else:
             ui.showWindow(midi.widBrowser)
             ui.setFocused(midi.widBrowser)
Exemplo n.º 8
0
 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)
Exemplo n.º 9
0
 def _open_app_menu():
     # FPT_Menu needs to be triggered when channel rack in focus in order to bring up the app menu.
     # Save the visibility state of the channel rack and restore at the end.
     ui.closeActivePopupMenu()
     channel_rack_visible = ui.getVisible(midi.widChannelRack)
     # Need to reset focus state of channel rack to ensure menu brought up
     ui.hideWindow(midi.widChannelRack)
     ui.showWindow(midi.widChannelRack)
     ui.setFocused(midi.widChannelRack)
     transport.globalTransport(midi.FPT_Menu, 1)
     if not channel_rack_visible:
         ui.hideWindow(midi.widChannelRack)
     # Give some time for popup to appear
     time.sleep(0.2)
     timeout_time = time.monotonic() + 1
     # Avoid exceed waiting more than 1 second
     while not ui.isInPopupMenu() and time.monotonic() < timeout_time:
         time.sleep(0.05)
Exemplo n.º 10
0
 def _toggle_window_visibility(self, window):
     if ui.getVisible(window):
         ui.hideWindow(window)
     else:
         ui.showWindow(window)
         ui.setFocused(window)
 def _show_and_focus(self, window):
     if not ui.getVisible(window):
         ui.showWindow(window)
     if not ui.getFocused(window):
         ui.setFocused(window)
Exemplo n.º 12
0
 def pianoroll_quick_quantize(unused_param_value):
     """Quick quantize"""
     if ui.getVisible(midi.widPianoRoll) and ui.getFocused(
             midi.widPianoRoll):
         Actions.fl_windows_shortcut('q', ctrl=1)