forked from bitfocus/companion-module-behringer-xair
-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildHADefs.js
55 lines (51 loc) · 1.13 KB
/
buildHADefs.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
import { pad0 } from './helpers.js'
export function buildHADefs(self) {
let haActions = {}
let haVariables = []
let ppRange = [1,4]
const mc = self.config.channels
for (let s = 1; s <= 24; s++) {
let c = pad0(s)
let baseID = `/headamp/${c}/`
let fID = `ha_gain${c}`
let vID = `ha_gain${s}`
let theID = baseID + 'gain'
self.fbToStat[fID] = theID
self.xStat[theID] = {
varID: vID,
valid: false,
fbID: fID,
polled: 0,
}
if (self.HA_CONFIG[s][mc].has) {
let haName = self.HA_CONFIG[s][mc].name + 'Gain'
haVariables.push({
name: haName + ' %',
variableId: vID + '_p',
})
haVariables.push({
name: haName + ' dB',
variableId: vID + '_d',
})
if (self.HA_CONFIG[s].ph) {
fID = `ha_pp${c}`
vID = `ha_pp${s}`
theID = baseID + 'phantom'
self.fbToStat[fID] = theID
self.xStat[theID] = {
varID: vID,
valid: false,
fbID: fID,
polled: 0,
pp: false,
}
haVariables.push({
name: self.HA_CONFIG[s][mc].name + ' Phantom',
variableId: vID,
})
ppRange[2] = Math.max(ppRange[2],s)
}
}
}
self.variableDefs.push(...haVariables)
}