-
Notifications
You must be signed in to change notification settings - Fork 8
/
constants.js
218 lines (202 loc) · 5.53 KB
/
constants.js
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
import { combineRgb } from '@companion-module/base'
import { pad0 } from './helpers.js'
export function buildConstants(self) {
// discreet float values for faders (1024)
self.fLevels[1024] = []
for (let i = 0; i < 1024; i++) {
self.fLevels[1024][i] = Math.min(
1.0,
Math.floor((Math.round(self.stepsToFader(i, 1024) * 1023.5) / 1023) * 10000) / 10000
)
}
self.levelOpts = [
{ op: '', act: 'Set' },
{ op: '_a', act: 'Adjust' },
{ op: '_s', act: 'Store' },
{ op: '_r', act: 'Recall' },
]
// pre-set linear values for various other 'levels'
const lvls = [
161, // sends, solo level
101, // pan
145, // trim, headamp gain
73, // solo source trim
65, // aux gain
40, // solo dim att/gain
]
for (let lvl of lvls) {
self.fLevels[lvl] = []
for (let i = 0; i < lvl; i++) {
self.fLevels[lvl][i] = self.stepsToFader(i, lvl)
}
}
self.STORE_LOCATION = []
for (let i = 1; i <= 10; i++) {
var i2 = pad0(i)
self.STORE_LOCATION.push({
label: `Global ${i}`,
id: `gs_${i2}`,
})
}
self.FADER_VALUES = [
{ label: '- ∞', id: '0.0' },
{ label: '-50 dB: ', id: '0.1251' },
{ label: '-30 dB', id: '0.251' },
{ label: '-20 dB', id: '0.375' },
{ label: '-18 dB', id: '0.4' },
{ label: '-15 dB', id: '0.437' },
{ label: '-12 dB', id: '0.475' },
{ label: '-9 dB', id: '0.525' },
{ label: '-6 dB', id: '0.6' },
{ label: '-3 dB', id: '0.675' },
{ label: '-2 dB', id: '0.7' },
{ label: '-1 dB', id: '0.725' },
{ label: '0 dB', id: '0.75' },
{ label: '+1 dB', id: '0.775' },
{ label: '+2 dB', id: '0.8' },
{ label: '+3 dB', id: '0.825' },
{ label: '+4 dB', id: '0.85' },
{ label: '+5 dB', id: '0.875' },
{ label: '+6 dB', id: '0.9' },
{ label: '+9 dB', id: '0.975' },
{ label: '+10 dB', id: '1.0' },
]
self.COLOR_VALUES = [
{ label: 'Off', id: '0', bg: 0, fg: combineRgb(64, 64, 64) },
{ label: 'Red: ', id: '1', bg: combineRgb(224, 0, 0), fg: 0 },
{ label: 'Green', id: '2', bg: combineRgb(0, 224, 0), fg: 0 },
{ label: 'Yellow', id: '3', bg: combineRgb(224, 224, 0), fg: 0 },
{ label: 'Blue', id: '4', bg: combineRgb(0, 0, 224), fg: 0 },
{ label: 'Magenta', id: '5', bg: combineRgb(224, 0, 224), fg: 0 },
{ label: 'Cyan', id: '6', bg: combineRgb(0, 192, 224), fg: 0 },
{ label: 'White', id: '7', bg: combineRgb(224, 224, 224), fg: 0 },
{ label: 'Off Inverted', id: '8', bg: combineRgb(64, 64, 64), fg: 0 },
{ label: 'Red Inverted', id: '9', bg: 0, fg: combineRgb(224, 0, 0) },
{ label: 'Green Inverted', id: '10', bg: 0, fg: combineRgb(0, 224, 0) },
{ label: 'Yellow Inverted', id: '11', bg: 0, fg: combineRgb(224, 224, 0) },
{ label: 'Blue Inverted', id: '12', bg: 0, fg: combineRgb(0, 0, 224) },
{ label: 'Magenta Inverted', id: '13', bg: 0, fg: combineRgb(224, 0, 224) },
{ label: 'Cyan Inverted', id: '14', bg: 0, fg: combineRgb(0, 192, 224) },
{ label: 'White Inverted', id: '15', bg: 0, fg: combineRgb(224, 224, 224) },
]
self.MONITOR_SOURCES = [
{ id: 0, label: 'Off' },
{ id: 1, label: 'LR' },
{ id: 2, label: 'LR (PFL)' },
{ id: 3, label: 'LR (AFL)' },
{ id: 4, label: 'AUX' },
{ id: 5, label: 'USB 17/18' },
{ id: 6, label: 'Bus 1' },
{ id: 7, label: 'Bus 2' },
{ id: 8, label: 'Bus 3' },
{ id: 9, label: 'Bus 4' },
{ id: 10, label: 'Bus 5' },
{ id: 11, label: 'Bus 6' },
{ id: 12, label: 'Bus 1/2' },
{ id: 13, label: 'Bus 3/4' },
{ id: 14, label: 'Bus 5/6' },
]
self.TAPE_FUNCTIONS = [
{ label: 'STOP', id: '0' },
{ label: 'PLAY PAUSE', id: '1' },
{ label: 'PLAY', id: '2' },
{ label: 'RECORD PAUSE', id: '3' },
{ label: 'RECORD', id: '4' },
{ label: 'FAST FORWARD', id: '5' },
{ label: 'REWIND', id: '6' },
]
self.BAR_LOCATION = [
{ id: 't', label: 'Top' },
{ id: 'b', label: 'Bottom' },
{ id: 'l', label: 'Left' },
{ id: 'r', label: 'Right' },
]
self.MIXER_MODEL = {
XR12: { desc: 'XAir 12 Rack', channels: 12 },
XR16: { desc: 'XAir 16 Rack', channels: 16 },
XR18: { desc: 'XAir 18 Rack', channels: 18 },
X18: { desc: 'XAir 18 Desk', channels: 18 },
}
self.MIXER_CHOICES = []
Object.entries(self.MIXER_MODEL).forEach(([key, val]) => {
self.MIXER_CHOICES.push({
id: key,
label: val.desc,
})
})
self.HA_CONFIG = [
{
12: { name: '', has: false },
16: { name: '', has: false },
18: { name: '', has: false },
},
]
for (let c = 1; c < 25; c++) {
switch (c) {
case 1:
case 2:
case 3:
case 4:
self.HA_CONFIG[c] = {
12: { name: `XLR ${c}`, has: true },
16: { name: `XLR ${c}`, has: true },
18: { name: `XLR ${c}`, has: true },
trim: 145,
ph: true,
}
break
case 5:
case 6:
case 7:
case 8:
self.HA_CONFIG[c] = {
12: { name: '', has: false },
16: { name: `XLR ${c}`, has: true },
18: { name: `XLR ${c}`, has: true },
trim: 145,
ph: true,
}
break
case 9:
case 10:
case 11:
case 12:
case 13:
case 14:
case 15:
case 16:
self.HA_CONFIG[c] = {
12: { name: '', has: false },
16: { name: '', has: false },
18: { name: `XLR ${c}`, has: true },
trim: 145,
ph: true,
}
break
case 17:
self.HA_CONFIG[c] = {
12: { name: `1/4 ${c - 16}`, has: true },
16: { name: `1/4 ${c - 16}`, has: true },
18: { name: 'RCA', has: true },
trim: 65,
ph: false,
}
break
case 18:
case 19:
case 20:
case 21:
case 22:
case 23:
case 24:
self.HA_CONFIG[c] = {
12: { name: `1/4 ${c - 16}`, has: true },
16: { name: `1/4 ${c - 16}`, has: true },
18: { name: '', has: false },
trim: 65,
ph: false,
}
break
}
}
}