-
Notifications
You must be signed in to change notification settings - Fork 5
/
feedbacks.js
170 lines (165 loc) · 3.66 KB
/
feedbacks.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
import { combineRgb } from '@companion-module/base'
/**
* Get the available feedbacks.
*
* @returns {Object[]} the available feedbacks
* @access public
*
*/
export const getFeedbacks = (self) => {
var feedbacks = {}
feedbacks['input_used'] = {
type: 'boolean',
name: 'Source used',
description: 'If a source is used in preset, change the style of the button',
defaultStyle: {
color: 0xffffff,
bgcolor: combineRgb(200, 0, 0),
},
options: [
{
type: 'number',
label: 'Source',
id: 'source',
default: 1,
min: 1,
max: 48,
},
{
type: 'dropdown',
id: 'preset',
choices: [
{ id: 'pgm', label: 'Program' },
{ id: 'pvw', label: 'Preview' },
{ id: 'any', label: 'Any' },
],
default: 'pgm',
},
],
callback: (feedback) => {
if (
(feedback.options.preset === pgm || feedback.options.preset === any) &&
self.tallyPGM[feedback.options.source]
) {
return true
}
if (
(feedback.options.preset === pvw || feedback.options.preset === any) &&
self.tallyPVW[feedback.options.source]
) {
return true
}
return false
},
}
feedbacks['memory_active'] = {
type: 'boolean',
name: 'Memory active',
description: 'If a screen memory is loaded in preset, change the style of the button',
defaultStyle: {
color: 0xffffff,
bgcolor: combineRgb(200, 0, 0),
},
options: [
{
type: 'number',
label: 'Screen Memory',
id: 'memory',
default: 1,
min: 1,
max: 119,
},
{
type: 'dropdown',
label: 'Screen',
id: 'screen',
default: 'any',
choices: [
{ id: 'any', label: 'Any' },
{ id: 0, label: '1' },
{ id: 1, label: '2' },
{ id: 2, label: '3' },
{ id: 3, label: '4' },
{ id: 4, label: '5' },
{ id: 5, label: '6' },
{ id: 6, label: '7' },
{ id: 7, label: '8' },
],
},
{
type: 'dropdown',
id: 'preset',
choices: [
{ id: 'pgm', label: 'Program' },
{ id: 'pvw', label: 'Preview' },
{ id: 'any', label: 'Any' },
],
default: 'pgm',
},
],
callback: (feedback) => {
if (feedback.options.screen === 'any') {
if (
(feedback.options.preset === 'pgm' || feedback.options.preset === 'any') &&
self.memoriesPGM.some((mem) => mem === feedback.options.memory - 1)
) {
return true
}
if (
(feedback.options.preset === 'pvw' || feedback.options.preset === 'any') &&
self.memoriesPVW.some((mem) => mem === feedback.options.memory - 1)
) {
return true
}
} else {
if (
(feedback.options.preset === 'pgm' || feedback.options.preset === 'any') &&
self.memoriesPGM[feedback.options.screen] === feedback.options.memory - 1
) {
return true
}
if (
(feedback.options.preset === 'pvw' || feedback.options.preset === 'any') &&
self.memoriesPVW[feedback.options.screen] === feedback.options.memory - 1
) {
return true
}
}
return false
},
}
feedbacks['screen_active'] = {
type: 'boolean',
name: 'Screen selected',
description: 'If a screen for global take is selected, change the style of the button',
defaultStyle: {
color: 0xffffff,
bgcolor: combineRgb(200, 0, 0),
},
options: [
{
type: 'dropdown',
label: 'Screen',
id: 'screen',
default: 0,
choices: [
{ id: 0, label: '1' },
{ id: 1, label: '2' },
{ id: 2, label: '3' },
{ id: 3, label: '4' },
{ id: 4, label: '5' },
{ id: 5, label: '6' },
{ id: 6, label: '7' },
{ id: 7, label: '8' },
],
},
],
callback: (feedback) => {
if (self.activeScreen[feedback.options.screen]) {
return true
}
return false
},
}
return feedbacks
}