This repository has been archived by the owner on Mar 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
HighLowFX.lua
195 lines (139 loc) · 6.47 KB
/
HighLowFX.lua
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
--[[
This plugin is written by Egidius Mengelberg
It enables you to automaticly make a HighFX and LowFX preset to use in your effects
--]]
--USER CONFIG
-- Numbers of color preset Pool Items
local cNum = {1,2,3,4,5,6,7,8,9,10,11,12}
local macStart = 1200 --starting macro pool item to be stored to
local seqStart = 200 --starting sequence number to be stored to
local startingPg = 2 --page to start
local startingExec = 161 --fader to start
local LowFXPreset = 112 -- Low fx pool item
local HighFXPreset = 113 -- High fx pool item
local layoutView = 1
local startX = 0.5
local startY = 8
local layoutSpacing = 0.1
local imageStart = 544
local imageSpaceBetween = 4
-- Colors from Swatch Book (to change Appearance of Macro to this color)
local colSwatchBook = {'White', 'Red', 'Orange', 'Yellow', 'Green', 'Sea Green', 'Cyan', 'Lavender', 'Blue', 'Violet', 'Magenta', 'Pink'}
-- Filed images
local filledImages = {304,305,306,307,308,309,310,311,312,313,314,315}
-- Unfiled images
local unfilledImages = {320,321,322,323,324,325,326,327,328,329,330,331}
local imageGrid = {}
-- Image grid
-- END USER CONFIG
--local shortcut variables
local text = gma.textinput
local cmd = gma.cmd
local getHandle = gma.show.getobj.handle
--FUNCTIONS
function getLabel(str)
return gma.show.getobj.label(getHandle(str))
end
function getClass(str)
return gma.show.getobj.class(getHandle(str))
end
function macStore(macroNum, label) --generate macro
gma.cmd('Store Macro 1.'..macroNum) --create macro
gma.cmd('Label Macro 1.'..macroNum..' \"'..label..'\"') --label the macro
end
function macLine(macroNum, lineNum, command, wait) --generate new line within macro
cmd('Store Macro 1.'..macroNum..'.'..lineNum)
cmd('Assign Macro 1.'..macroNum..'.'..lineNum..'/cmd = \"'..command..'\"')
if wait then cmd('Assign Macro 1.'..macroNum..'.'..lineNum..'/wait = \"'..wait..'\"') end
end
return function()
-----------------------------------------------------------------
--------------------- START OF PLUGIN ---------------------------
-----------------------------------------------------------------
local imageCurrent = imageStart
for r=1,2 do
for c=1,#cNum do
if c == 1 then
imageGrid[r] = {}
end
imageGrid[r][c] = imageCurrent
cmd('Copy Image '..unfilledImages[c]..' At '..imageGrid[r][c]..' /m /nc')
imageCurrent = imageCurrent + 1
end
imageCurrent = imageCurrent + imageSpaceBetween
end
local cName = {} --list where names of preset pool items will be stored
-- get the name of the according number of preset
for c=1,#cNum do
cName[c] = getLabel('Preset 4.'..cNum[c])
gma.feedback('Color with number '..cNum[c]..' found')
if (not cName[c]) then cName[c] = 'Color '..cNum[c] end
gma.feedback('Label '..cName[c]..' assigned')
end
--PRESETS TO SEQUENCE CUES BY GROUP AND CREATE MACROS--
local macCurrent = macStart
local seqCurrent = seqStart
local faderCurrent = startingExec
cmd('ClearAll')
local str_storeOpt = ' /use=active /so=Prog /nc'
for t=1,2 do
for c = 1, #cNum do
local execCurrent = tostring(startingPg..'.'..faderCurrent)
local copyCommand = ''
cmd('ClearAll')
cmd('Store Sequence '..seqCurrent..' Cue '..c..' '..str_storeOpt) --store to sequence and cue
if c == #cNum then
cmd('Assign Sequence '..seqCurrent..' At Executor '..execCurrent) --assign sequence to executor
end
if t == 1 then
cmd('Label Sequence '..seqCurrent..' \"Low FX\"'); --label sequence
macStore(macCurrent, 'Low FX '..cName[c]) --create macro; label with color name
macLine(macCurrent, 1, 'Goto Executor '..execCurrent..' Cue '..c)
macLine(macCurrent, 2, 'Off Macro '..macStart+(#cNum*(t-1))..' Thru '..(macStart-1)+(#cNum*(t-1))+#cNum..' - '..macCurrent)
copyCommand = 'Copy Preset 4.'..c..' At Preset 4.'..LowFXPreset
end
if t == 2 then
cmd('Label Sequence '..seqCurrent..' \"High FX\"'); --label sequence
macStore(macCurrent, 'High FX '..cName[c]) --create macro; label with color name
macLine(macCurrent, 1, 'Goto Executor '..execCurrent..' Cue '..c)
macLine(macCurrent, 2, 'Off Macro '..macStart+(#cNum*(t-1))..' Thru '..(macStart-1)+(#cNum*(t-1))+#cNum..' - '..macCurrent)
copyCommand = 'Copy Preset 4.'..c..' At Preset 4.'..HighFXPreset
end
local imageCommand1 = 'Copy Image '..unfilledImages[1]..' Thru '..unfilledImages[#cNum]..' At '..imageGrid[t][1]..' /m /nc'
local imageCommand2 = 'Copy Image '..filledImages[c]..' At '..imageGrid[t][c]..' /m /nc'
cmd('Assign Sequence '..seqCurrent..' Cue '..c..' /cmd=\"'..copyCommand..' /m /nc; '..imageCommand1..' /m /nc; '..imageCommand2..'/m /nc\"')
cmd('Label Sequence '..seqCurrent..' Cue '..c..' \"'..cName[c]..'\"'); --label cue w/ name tables
-- change the appearance of the macro
cmd('Appearance Macro '..macCurrent..' /color='..'"'..colSwatchBook[c]..'"')
cmd('ClearAll'); --clear your programmer
posX = (c+startX) * (1+layoutSpacing)
posY = (t+startY) * (1+layoutSpacing)
cmd('Assign Macro '..macCurrent..' At Layout '..layoutView..'/x='..posX..' /y='..posY)
macCurrent = macCurrent + 1 --move to next macro number
gma.sleep(0.05) --to ease processing power conflicts
end
seqCurrent = seqCurrent + 1 --move to next sequence number
faderCurrent = faderCurrent + 1
end
local macCurrent = macStart + (2 * #cNum) --resets variable at the position after all color macros based on the number of possible combinations
local mac_sys_start = macCurrent
local mac_uninstall = mac_sys_start + 2
local seqEnd = seqStart + (2 * #cNum)
--lock uninstall macro
macStore(macCurrent, 'DISABLE Uninstall HighLowFX Macro')
macLine(macCurrent, 1, 'Assign Macro 1.'..mac_uninstall..'.* /disabled=yes')
macLine(macCurrent, 2, 'Lock Macro '..mac_uninstall)
macCurrent = macCurrent + 1
--enable uninstall macro
macStore(macCurrent, 'ENABLE Uninstall HighLowFX Macro')
macLine(macCurrent, 1, 'Unlock Macro '..mac_uninstall)
macLine(macCurrent, 2, 'Assign Macro 1.'..mac_uninstall..'.* /disabled=no')
macCurrent = macCurrent + 1
--UNINSTALL MACRO--
macStore(macCurrent, 'UNINSTALL HighLowFX')
macLine(macCurrent, 1, 'Delete Sequence '..seqStart..' Thru '..seqEnd..' /nc')
macLine(macCurrent, 2, 'Delete Image '..imageGrid[1][1]..' Thru '..imageGrid[2][#cNum]..' /nc')
macLine(macCurrent, 2, "Delete Layout "..layoutView..' If Macro '..macStart..' Thru '..macCurrent)
macLine(macCurrent, 3, 'Delete Macro '..macStart..' Thru '..macCurrent)
cmd('Macro '..mac_sys_start) --run uninstall-lock macro
end --END OF PLUGIN