blob: 5355d65a63a7a68b6e4995c5f7bb9d4a49987ef9 (
plain)
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
|
'use strict'
function MidiCC (terminal) {
this.stack = []
this.start = function () {
console.info('MidiCC Starting..')
}
this.clear = function () {
this.stack = []
}
this.run = function () {
for (const id in this.stack) {
this.play(this.stack[id])
}
}
this.send = function (channel, knob, value) {
this.stack.push([channel, knob, value])
}
this.play = function (data) {
const device = terminal.io.midi.device()
if (device) {
device.send([0xb0 + data[0], 64 + data[1], data[2]])
} else {
console.warn(`No Midi device.`)
}
}
}
module.exports = MidiCC
|