-
Notifications
You must be signed in to change notification settings - Fork 0
/
variables.py
82 lines (60 loc) · 3.88 KB
/
variables.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import device
PORT=device.getPortNumber() # Save controller's assigned port as the PORT variable. May be useful.
"""
Remember that MIDI info require three bytes (which is the same as three hexadecimal pairs, e.g. AA BB CC;
or three base ten numbers, e.g. 170 187 204) in order to transmit a message understandable by a
MIDI host (in this case, FL Studio).
The first byte communicates the MIDI status (STATUS), the kind of message sent (note on/off, pad on/off, knob rotation, etc).
The second one indicates aditional MIDI info 1 (DATA1). The controller's pads, knobs and buttons are identified
by this method, since every one of these are mapped to an unique STATUS-DATA1 bytes combination.
You can find those mappings in Novation Launchkey MK3 Programmer's reference manual, or using a
MIDI monitoring tool (like Pocket MIDI).
The third byte indicates the MIDI info 2 (DATA2), a value between 0 and 127, that can be interpreted as the status
of the note, pad, knob or button triggered at a time. On keystrokes and pads, it indicates the MIDI velocity,
for knobs it indicates the degree of rotation, and for buttons it indicates if it's held down (value 127),
or if it's released (value 0).
By the way, most of the functions handled by FL Studio need decimal values in order to operate correctly,
but you can use Python's hexadecimal notation to represent those values.
For example, if an operation here requires the decimal number 170, this one can be expressed as the
hexadecimal value 0xAA. This comes in handy since the Programming Manual provided by Novation for their
Launchkey MK3 device series show those values in both ways, but sometimes it preffers one above the other.
On other side, fortunately, Launchkey Mini MK3 makes almost no use of SysEx messages (just when the Host device queries
device info, when it triggers the original boot animation [or even a custom one 🌈], or when setting the
status for special buttons [as Arp or Fixed Chord]).
The next sections define specific bytes that might act as those AAs, BBs or CCs, for each pad, knob or button.
"""
SHIFT_STATUS = False
FOCUS_STATUS = 0
MIXER_READYFOR = "" # This variable determines the status of the Stop/Solo/Mute buttons in Mixer mode.
PLAYLIST_READYFOR = "" # This variable determines the status of the Stop/Solo/Mute buttons in Playlist mode.
CHANRACK_READYFOR = "" # This variable determines the status of the Stop/Solo/Mute buttons in Channel Rack mode.
PIANOROLL_READYFOR = "" # This variable determines the status of the Stop/Solo/Mute buttons in Piano Roll mode.
WAITFORINPUT = ""
KNOBSTATUS = ""
PADSTATUS = ""
SCENE_SEL = "Mixer" # Default scene. Can be "Mixer", "Channel Rack" and "Editor".
SCENEUP_STATUS=""
crRectPos = 0 # This variable determines the position of the Channel Rack's rectangle.
scmodes = {"MIXER_READYFOR":"","PLAYLIST_READYFOR":"", "CHANRACK_READYFOR":"", "PIANOROLL_READYFOR":"", "EDITOR_READYFOR":"", 'MONITOR_READYFOR':''} # This dict determines the status of the Stop/Solo/Mute buttons in each mode.
# For shortcut lights in Editor mode.
shortpress = ""
shortdata = ""
currentTime = None # This variable shows the current time (EPOCH).
#repeatqueue = {}
#repeatok = {}
keysVelo = 1
padsVelo = 1
fxStatus = 1
mixerFx = {}
pushTime = 0
holdTime = 0
isLongPress = 0
holdMidiId = 0
holdData1 = 0
isPushed = 0
focusedPlugin = ["", None, None] # First item is the plugin name, second is the plugin index1, third is the plugin index2.
isPlaying = None # This variable determines if FL Studio is playing or not.
isPerformance = None # Is performance mode enabled? This is set at startup or if performance mode is enabled inside FL Studio
setPerformance = 0 # Sets controller to Performance mode if the user requires it
perfPosition = [0, 1] # This variable determines the position of the performance mode rectangle (top left corner) (pad-1, track)
perfPadsFour = True # This variable determines if the performance mode pads are 4x4 or 8x2