diff options
-rw-r--r-- | desktop/core/io.js | 6 | ||||
-rw-r--r-- | desktop/core/io/midi.js | 25 |
2 files changed, 31 insertions, 0 deletions
diff --git a/desktop/core/io.js b/desktop/core/io.js index 8544065..97a1d21 100644 --- a/desktop/core/io.js +++ b/desktop/core/io.js @@ -30,12 +30,18 @@ export default function IO (terminal) { this.mono.clear() this.udp.clear() this.osc.clear() + + // Light + this.udp.send('clear') } this.run = function () { this.midi.run() this.cc.run() this.mono.run() + // Light + this.udp.send('show') + this.udp.run() this.osc.run() } diff --git a/desktop/core/io/midi.js b/desktop/core/io/midi.js index 0267e9b..45ce090 100644 --- a/desktop/core/io/midi.js +++ b/desktop/core/io/midi.js @@ -51,6 +51,31 @@ export default function Midi (terminal) { if (!n || c === 127) { return } this.outputDevice().send([c, n, v]) + + // Light Listener - Start + + if (down !== true) { return } + + // Drums + if (channel >= 0 && channel <= 3) { + if (transposed.note === 'C') { + terminal.io.udp.send('f:9') + } else if (transposed.note === 'E') { + terminal.io.udp.send('c:9') + } else { + terminal.io.udp.send('e:9') + } + } + // Synths + else if (channel >= 4 && channel <= 7 && !isNaN(transposed.id)) { + terminal.io.udp.send(`n:${transposed.id}`) + } + // + else if (channel >= 8 && channel <= 11 && !isNaN(transposed.id)) { + terminal.io.udp.send(`l:${transposed.id}`) + } else { + terminal.io.udp.send(`r:${parseInt(transposed.id)}`) + } } this.press = function (item) { |