From 880636a183ceaf29babfe0e1beb60ba355b38c8a Mon Sep 17 00:00:00 2001 From: Fabian Stamm Date: Sun, 18 Jun 2017 16:14:01 +0200 Subject: [PATCH] adding event triggering with artnet support --- db.json | 25 +------------------------ lib/timec.js | 8 ++++++-- lib/timec.js.map | 2 +- package-lock.json | 14 +++++++++++--- package.json | 1 + src/timec.ts | 30 +++++++++--------------------- testEvent.json | 5 ++--- 7 files changed, 31 insertions(+), 54 deletions(-) diff --git a/db.json b/db.json index f722eb7..8544837 100644 --- a/db.json +++ b/db.json @@ -1,32 +1,9 @@ { - "t2mp4": [ - { - "id": "f786c17431e6", - "time": "1500", - "channel": "1", - "note": "2", - "name": "test", - "value": "5" - } - ], "3d47edcdc882": { "displayName": "test", "id": "3d47edcdc882", "triggers": [ - { - "midi": { - "channel": 1, - "note": 3, - "value": 4 - }, - "time": { - "lframe": 15, - "lseconds": 5, - "lminutes": 0, - "lhours": 0, - "lmilliseconds": 5600 - } - } + ] } } \ No newline at end of file diff --git a/lib/timec.js b/lib/timec.js index 487b681..3af346b 100644 --- a/lib/timec.js +++ b/lib/timec.js @@ -13,8 +13,8 @@ var ioClient = require("socket.io-client")("http://localhost:5000"); var ios = io(http); const rtpmidi = require("rtpmidi"); var midisession = rtpmidi.manager.createSession({ - localName: "Node Timecode", - bonjourName: "Node Timecode", + localName: "node", + bonjourName: "node", port: 5004 }); class FrameTime { @@ -194,4 +194,8 @@ midisession.on("ready", () => { //midisession.sendMessage([1, 5, 100]); }, 500); }); +midisession.on('message', function (deltaTime, message) { + console.log('Received a message', message); +}); +midisession.connect({ address: "dmx.event.margau.net", port: 5004 }); //# sourceMappingURL=timec.js.map \ No newline at end of file diff --git a/lib/timec.js.map b/lib/timec.js.map index 05a4709..9cbf819 100644 --- a/lib/timec.js.map +++ b/lib/timec.js.map @@ -1 +1 @@ -{"version":3,"file":"timec.js","sourceRoot":"","sources":["../src/timec.ts"],"names":[],"mappings":"AAAA,UAAU;;AAEV,6BAA8B;AAC9B,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,CAAC,CAAC,CAAC;AAEH,WAAW,CAAC,OAAO,CAAC,EAAC,OAAO,EAAC,sBAAsB,EAAE,IAAI,EAAC,IAAI,EAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 46544a4..8882802 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,17 +6,20 @@ "@types/node": { "version": "7.0.31", "resolved": "https://registry.npmjs.org/@types/node/-/node-7.0.31.tgz", - "integrity": "sha512-+KrE1LDddn97ip+gXZAnzNQ0pupKH/6tcKwTpo96BDVNpzmhIKGHug0Wd3H0dN4WEqYB1tXYI5m2mZuIZNI8tg==" + "integrity": "sha512-+KrE1LDddn97ip+gXZAnzNQ0pupKH/6tcKwTpo96BDVNpzmhIKGHug0Wd3H0dN4WEqYB1tXYI5m2mZuIZNI8tg==", + "dev": true }, "@types/socket.io": { "version": "1.4.29", "resolved": "https://registry.npmjs.org/@types/socket.io/-/socket.io-1.4.29.tgz", - "integrity": "sha1-hqazqat4z5qQDO74W5totr6oZxI=" + "integrity": "sha1-hqazqat4z5qQDO74W5totr6oZxI=", + "dev": true }, "@types/socket.io-client": { "version": "1.4.29", "resolved": "https://registry.npmjs.org/@types/socket.io-client/-/socket.io-client-1.4.29.tgz", - "integrity": "sha1-+HQwcM7pMXXjbgtqd6ivc+WMyzI=" + "integrity": "sha1-+HQwcM7pMXXjbgtqd6ivc+WMyzI=", + "dev": true }, "accepts": { "version": "1.3.3", @@ -33,6 +36,11 @@ "resolved": "https://registry.npmjs.org/arraybuffer.slice/-/arraybuffer.slice-0.0.6.tgz", "integrity": "sha1-8zshWfBTKj8xB6JywMz70a0peco=" }, + "artnet": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/artnet/-/artnet-1.3.2.tgz", + "integrity": "sha1-ox3XjJoo6rnEa2932cxoyk5nChg=" + }, "assertion-error": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.0.0.tgz", diff --git a/package.json b/package.json index 91c4cae..d45664e 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ }, "homepage": "https://github.com/margau/node_vlc_rc#readme", "dependencies": { + "artnet": "^1.3.2", "lowdb": "^0.16.2", "rtpmidi": "^0.1.8", "short-id": "0.1.0-1", diff --git a/src/timec.ts b/src/timec.ts index c2eae0b..7ce58e5 100644 --- a/src/timec.ts +++ b/src/timec.ts @@ -13,12 +13,9 @@ import io = require("socket.io"); var ioClient = require("socket.io-client")("http://localhost:5000"); var ios = io(http); -import rtpmidi = require("rtpmidi"); -var midisession = rtpmidi.manager.createSession({ - localName:"Node Timecode", - bonjourName:"Node Timecode", - port: 5004 -}); +const artnetp = require("artnet"); +const universe = 21; +var artnet = artnetp({host:"192.168.1.255"}); class FrameTime{ lframe = 0; @@ -118,8 +115,8 @@ class Timecode { var d = new Date().getTime() - this.startTime; this.toTrigger.forEach(e=>{ if(e.time.milliseconds <= d) { - ios.emit("midi", e.midi); - midisession.sendMessage([e.midi.channel, e.midi.note, e.midi.value]); + ios.emit("artnet", e.art); + artnet.set(universe, e.art.subnet) var i = this.toTrigger.indexOf(e); this.toTrigger.splice(i, 1); } @@ -167,9 +164,8 @@ class Timecode { } class TrackEvent { - midi: { - channel:number, - note:number, + art: { + subnet:number, value:number } time:FrameTime; @@ -219,10 +215,9 @@ ios.on("connection", socket=>{ }); socket.on("set", (data)=>{ var tid = data.track; - var midi = data.midi; var time = new FrameTime(data.time); var tracke = new TrackEvent(); - tracke.midi = midi; + tracke.art = data.art; tracke.time = time; db.get(tid + ".triggers").push(tracke).write(); socket.emit("set_finished", tracke); @@ -233,11 +228,4 @@ ios.on("connection", socket=>{ }); }); -midisession.on("ready", ()=>{ - http.listen(5001); - setInterval(()=>{ - midisession.sendMessage([0x80, 0x40]); - midisession.sendMessage([0x90, 0x40, 0x7f]); - //midisession.sendMessage([1, 5, 100]); - }, 500); -}); \ No newline at end of file +http.listen(5001); diff --git a/testEvent.json b/testEvent.json index 61e5ded..de28060 100644 --- a/testEvent.json +++ b/testEvent.json @@ -1,8 +1,7 @@ { "track": "3d47edcdc882", - "midi":{ - "channel":1, - "note":3, + "art":{ + "subnet":1, "value":4 }, "time": { "hours":0,