-
Notifications
You must be signed in to change notification settings - Fork 8
/
upgrades.js
158 lines (146 loc) · 3.23 KB
/
upgrades.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
import { CreateConvertToBooleanFeedbackUpgradeScript } from '@companion-module/base'
import { combineRgb } from '@companion-module/base'
import { ICON_SOLO } from './icons.js'
export const UpgradeScripts = [
// grab these values for later
// [0]
function (context, props) {
const result = {
updatedConfig: null,
updatedActions: [],
updatedFeedbacks: [],
}
for (let action of props.actions) {
if (['mute', 'mMute', 'usbMute'].includes(action.actionId)) {
if (action.options.mute === null) {
action.options.mute = '0'
result.updatedActions.push(action)
}
}
if ('mute_grp' == action.actionId) {
if (action.options.mute === null) {
action.options.mute = '1'
result.updatedActions.push(action)
}
}
}
return result
},
CreateConvertToBooleanFeedbackUpgradeScript({
solo_mute: true,
solo_mono: true,
solo_dim: true,
rtn: true,
lr: true,
fxsend: true,
dca: true,
bus: true,
ch: true,
solosw_aux: true,
solosw_bus: true,
solosw_ch: true,
solosw_dca: true,
solosw_fxr: true,
solosw_fxs: true,
solosw_lr: true,
'rtn/aux': true,
'config/mute': true,
}),
// [1]
function (context, props) {
const result = {
updatedConfig: null,
updatedActions: [],
updatedFeedbacks: [],
}
for (let fb of props.feedbacks) {
if (fb.feedbackId?.match(/^solosw_/) && Object.keys(fb?.style || {}).length == 0) {
fb.style = {
color: combineRgb(255, 255, 255),
bgcolor: 0,
png64: ICON_SOLO,
}
result.updatedFeedbacks.push(fb)
}
}
return result
},
function (context, props) {
const result = {
updatedConfig: null,
updatedActions: [],
updatedFeedbacks: [],
}
for (let action of props.actions) {
let changed = false
let aId = action.actionId
if (aId.match(/^send/)) {
// chNum changed to num to match other actions
if (action.options.chNum != undefined) {
action.options.num = action.options.chNum
delete action.options.chNum
changed = true
}
}
if (aId.match(/^fad|send|mFad|usbFad/)) {
action.options.faderLim = false
changed = true
}
if (changed) {
result.updatedActions.push(action)
}
}
return result
},
CreateConvertToBooleanFeedbackUpgradeScript({
snap_color: true,
}),
function (context, props) {
const result = {
updatedConfig: null,
updatedActions: [],
updatedFeedbacks: [],
}
for (let fb of props.feedbacks) {
let changed = false
if (fb.feedbackId == 'rtn/aux') {
fb.feedbackId = 'rtn_aux'
changed = true
}
if (fb.feedbackId == 'rtn_aux') {
if (fb.options.state == undefined) {
fb.options.state = '1'
changed = true
}
}
if (changed) {
result.updatedFeedbacks.push(fb)
}
}
return result
},
function (context, props) {
const result = {
updatedConfig: null,
updatedActions: [],
updatedFeedbacks: [],
}
for (let fb of props.feedbacks) {
let changed = false
if (fb.feedbackId == 'config/mute') {
fb.feedbackId = 'config_mute'
changed = true
}
if (fb.feedbackId == 'config_mute') {
if (fb.options.state == undefined) {
fb.options.state = '1'
changed = true
}
}
if (changed) {
result.updatedFeedbacks.push(fb)
}
}
return result
},
]