-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdummy.ts
72 lines (66 loc) · 1.7 KB
/
dummy.ts
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
import {
DeviceChangeMessage,
DeviceConfiguration,
DeviceController,
DeviceMessageListener,
DeviceMetersMessage,
} from '@remote-mixer/types'
import { logger } from '@remote-mixer/utils'
export default class DummyDeviceController implements DeviceController {
deviceConfig: DeviceConfiguration = {
categories: [
{
key: 'ch',
label: 'Channels',
count: 32,
meters: true,
namePrefix: 'CH',
faderProperties: [
{ key: 'value', label: 'CH' },
{ key: 'aux1', label: 'AUX1' },
{ key: 'aux2', label: 'AUX2' },
{ key: 'aux3', label: 'AUX3' },
{ key: 'aux4', label: 'AUX4' },
],
},
{
key: 'aux',
label: 'AUX',
count: 4,
namePrefix: 'AUX',
},
{
key: 'sum',
label: 'Master',
count: 1,
namePrefix: 'SUM',
},
],
colors: true,
}
constructor(private listener: DeviceMessageListener) {
setInterval(() => {
const message: DeviceMetersMessage = {
type: 'meters',
meters: {},
}
for (let i = 1; i <= 32; i++) {
message.meters['ch' + i] = Math.round(Math.random() * 255)
}
this.listener(message)
}, 1000)
setInterval(() => {
const message: DeviceChangeMessage = {
type: 'change',
category: 'ch',
id: String(1 + Math.round(Math.random() * 31)),
property: 'value',
value: Math.round(Math.random() * 255),
}
this.listener(message)
}, 1000)
}
change(category: string, id: string, property: string, value: string): void {
logger.debug('[dummy] change', category, id, property, value)
}
}