-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGetControls.lua
More file actions
313 lines (284 loc) · 12.1 KB
/
Copy pathGetControls.lua
File metadata and controls
313 lines (284 loc) · 12.1 KB
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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
-- ============================================================
-- PLUGIN CONTROLS (must return a table)
-- Controls are persistent data objects stored within the design.
-- They are bound to the UI and to pins.
-- ============================================================
--[[
=====================================================================
FULL REFERENCE FOR GetControls()
=====================================================================
COMMON PROPERTIES FOR ALL CONTROLS:
+-----------------+----------+-----------+--------------------------------------------------+
| Property | Type | Required | Description |
+-----------------+----------+-----------+--------------------------------------------------+
| Name | String | YES | Control name (no spaces recommended) |
| ControlType | String | YES | "Button" | "Knob" | "Indicator" | "Text" |
| Count | Integer | No | Number of controls. If > 1 -> array |
| | | | Runtime access: Controls.Name[i] |
| PinStyle | String | No | "Input" | "Output" | "Both" | "None" |
| UserPin | Boolean | No | If true -> pin visible under "Control Pins" |
| DefaultValue | Varies | No | Initial value (Boolean / number / string) |
+-----------------+----------+-----------+--------------------------------------------------+
NOTE on Count > 1:
- If Count = 3 and Name = "Button", the controls are named:
"Button 1", "Button 2", "Button 3"
- In layout they are referenced the same way: layout["Button 1"] = { ... }
- At runtime: Controls.Button[1], Controls.Button[2], Controls.Button[3]
NOTE on PinStyle vs UserPin:
- UserPin = true + PinStyle defined -> User can choose whether to show the pin
- UserPin = false + PinStyle defined -> Pin is always visible (no option to hide it)
- UserPin = false + no PinStyle -> No external pin
-------------------------------------------------------------------
TYPE: Button
-------------------------------------------------------------------
Exclusive properties:
+-------------+---------+-----------+----------------------------------------------------+
| ButtonType | String | YES | "Momentary" -> Active while held down |
| | | | "Toggle" -> Alternates between on/off |
| | | | "Trigger" -> Single event pulse |
| | | | "StateTrigger" -> Multiple states (needs Min/Max) |
| Icon | String | No | QDS icon name ("Power","skull", etc.) |
| | | | or path to local file (requires Plugin Compiler) |
| IconType | String | Cond. | REQUIRED if Icon is defined. |
| | | | "Icon" (default) | "Image" (PNG/JPG) | "SVG" |
| Min | Integer | Cond. | REQUIRED if ButtonType = "StateTrigger" |
| Max | Integer | Cond. | REQUIRED if ButtonType = "StateTrigger" |
+-------------+---------+-----------+----------------------------------------------------+
-------------------------------------------------------------------
TYPE: Knob
-------------------------------------------------------------------
Exclusive properties:
+-------------+---------+-----------+----------------------------------------------------+
| ControlUnit | String | YES | Unit of the control. See ranges table below. |
| Min | Number | Cond. | Lower bound. Required unless marked NOT req. |
| Max | Number | Cond. | Upper bound. Required unless marked NOT req. |
+-------------+---------+-----------+----------------------------------------------------+
Knob-Specific Ranges (source: q-syshelp.qsc.com -> Reserved Functions -> Knob-Specific Ranges):
+--------------+------------------+------------------+---------------+---------------+----------+
| ControlUnit | Lower Limit | Upper Limit | Default Min | Default Max | Min/Max |
| | | | | | Required |
+--------------+------------------+------------------+---------------+---------------+----------+
| "dB" | -100 | 20 | -100 | 20 | Yes |
| "Hz" | 20 | 20000 | 20 | 20000 | Yes |
| "Float" | -1,000,000,000 | 1,000,000,000 | 0 | 100 | Yes |
| "Integer" | -999,999,999 | 999,999,999 | 1 | 100 | Yes |
| "Pan" | -1 | 1 | -1 | 1 | No |
| "Percent" | 0 | 100 | 0 | 100 | Yes |
| "Position" | 0 | 1 | 0 | 1 | No |
| "Seconds" | 0 | 87400 | 0 | 1 | Yes |
+--------------+------------------+------------------+---------------+---------------+----------+
NOTE: Default Min/Max are the values used when Min/Max are not specified. For units
where Min/Max are required (Yes), the defaults only apply if the developer omits them
accidentally -- always specify Min/Max explicitly for required units.
-------------------------------------------------------------------
TYPE: Indicator
-------------------------------------------------------------------
Exclusive properties:
+---------------+---------+-----------+--------------------------------------------------+
| IndicatorType | String | YES | "Led" -> LED indicator (on/off) |
| | | | "Meter" -> Level meter |
| | | | "Text" -> Read-only text indicator |
| | | | "Status" -> Q-SYS system status indicator |
+---------------+---------+-----------+--------------------------------------------------+
-------------------------------------------------------------------
TYPE: Text
-------------------------------------------------------------------
No exclusive properties at control level.
The display type (TextBox, ComboBox, ListBox) is defined in GetControlLayout().
=====================================================================
]]--
function GetControls(props)
local ctrls = {}
-- Rebuild the complete page list using the helper function.
-- GetControls() may need to know which pages exist when adding
-- controls conditionally based on the active page configuration.
-- Even if not used directly here, calling BuildPageNames() ensures
-- consistency with GetPages() and GetControlLayout().
-- local allPages = BuildPageNames(props) -- uncomment if needed
table.insert(ctrls, {
Name = "SendButton",
ControlType = "Button",
ButtonType = "Momentary",
Count = 1,
PinStyle = "Input",
UserPin = true,
Icon = "Power", -- Q-SYS Designer icon name
IconType = "Icon", -- "Icon" | "Image" | "SVG"
})
-- Toggle Button
table.insert(ctrls, {
Name = "MuteButton",
ControlType = "Button",
ButtonType = "Toggle",
Count = 1,
PinStyle = "Both",
UserPin = true,
})
-- Trigger Button
table.insert(ctrls, {
Name = "ResetButton",
ControlType = "Button",
ButtonType = "Trigger",
Count = 1,
PinStyle = "Input",
UserPin = true,
})
-- StateTrigger Button (multiple states)
table.insert(ctrls, {
Name = "SourceSelector",
ControlType = "Button",
ButtonType = "StateTrigger",
Min = 0, -- Minimum state (required for StateTrigger)
Max = 3, -- Maximum state (required for StateTrigger)
Count = 1,
PinStyle = "Both",
UserPin = true,
})
-- Knob type dB
table.insert(ctrls, {
Name = "InputGain",
ControlType = "Knob",
ControlUnit = "dB",
Min = -100,
Max = 20,
Count = 1,
PinStyle = "Both",
UserPin = true,
})
-- Knob type Hz
table.insert(ctrls, {
Name = "Frequency",
ControlType = "Knob",
ControlUnit = "Hz",
Min = 20,
Max = 20000,
Count = 1,
PinStyle = "Both",
UserPin = true,
})
-- Knob type Percent
table.insert(ctrls, {
Name = "Percentage",
ControlType = "Knob",
ControlUnit = "Percent",
Min = 0,
Max = 100,
Count = 1,
PinStyle = "Both",
UserPin = true,
})
-- Knob type Integer
table.insert(ctrls, {
Name = "IntegerValue",
ControlType = "Knob",
ControlUnit = "Integer",
Min = 1,
Max = 64,
Count = 1,
PinStyle = "Both",
UserPin = true,
})
-- Knob type Float
table.insert(ctrls, {
Name = "FloatValue",
ControlType = "Knob",
ControlUnit = "Float",
Min = 0.0,
Max = 1.0,
Count = 1,
PinStyle = "Both",
UserPin = false,
})
-- Knob type Pan
table.insert(ctrls, {
Name = "Pan",
ControlType = "Knob",
ControlUnit = "Pan",
-- Min/Max NOT required for Pan (fixed range -1 to 1)
Count = 1,
PinStyle = "Both",
UserPin = true,
})
-- Knob type Position
table.insert(ctrls, {
Name = "Position",
ControlType = "Knob",
ControlUnit = "Position",
-- Min/Max NOT required for Position (fixed range 0 to 1)
Count = 1,
PinStyle = "Both",
UserPin = false,
})
-- Knob type Seconds
table.insert(ctrls, {
Name = "DelayTime",
ControlType = "Knob",
ControlUnit = "Seconds",
Min = 0,
Max = 5,
Count = 1,
PinStyle = "Both",
UserPin = true,
})
-- LED Indicator (array of 4 LEDs)
table.insert(ctrls, {
Name = "StatusLed",
ControlType = "Indicator",
IndicatorType = "Led",
Count = 4, -- Creates: "StatusLed 1" .. "StatusLed 4"
PinStyle = "Output",
UserPin = true,
})
-- Meter Indicator
table.insert(ctrls, {
Name = "LevelMeter",
ControlType = "Indicator",
IndicatorType = "Meter",
Count = 1,
PinStyle = "Input",
UserPin = true,
})
-- Text Indicator (read-only)
table.insert(ctrls, {
Name = "StatusText",
ControlType = "Indicator",
IndicatorType = "Text",
Count = 1,
PinStyle = "Output",
UserPin = true,
})
-- Status Indicator (Q-SYS system status)
table.insert(ctrls, {
Name = "ConnectionStatus",
ControlType = "Indicator",
IndicatorType = "Status",
Count = 1,
PinStyle = "Output",
UserPin = true,
})
-- Text control (textbox / combo / list)
-- The display type is defined in GetControlLayout()
table.insert(ctrls, {
Name = "TextBox",
ControlType = "Text",
Count = 1,
PinStyle = "Both",
UserPin = true,
})
-- CODE PIN (external code injection at runtime)
-- Enabled from the Properties panel with "Enable Code Pin".
-- Allows connecting a Block Controller, Text Controller or other
-- external component to send Lua code to the plugin at runtime.
-- The external code runs AFTER the "if Controls then" block,
-- not as a replacement. See full behavior notes at the end of this file.
if props["Enable Code Pin"].Value then
table.insert(ctrls, {
Name = "code",
ControlType = "Text",
Count = 1,
PinStyle = "Input",
UserPin = true,
})
end
return ctrls
end