diff --git a/desktop/sources/scripts/osc.js b/desktop/sources/scripts/osc.js index a508d82..4aa94e4 100644 --- a/desktop/sources/scripts/osc.js +++ b/desktop/sources/scripts/osc.js @@ -2,23 +2,17 @@ function Osc (ronin) { const osc = require('node-osc') - - this.msg = {} + this.port = 49162 this.start = function () { - - const udpPort = new osc.Server( - 49162, - '0.0.0.0' - ) - - udpPort.on('message', this.onMsg) - ronin.log('OSC', 'Started.') + const server = new osc.Server(49162, '0.0.0.0') + server.on('message', this.onMsg) } - this.onMsg = (msg, timeTag, info) => { - if (ronin.bindings[msg.address]) { - ronin.bindings[msg.address](msg.args) + this.onMsg = (msg) => { + const address = msg.shift() + if (ronin.bindings[address]) { + ronin.bindings[address](msg) } } } diff --git a/examples/events/on-osc.lisp b/examples/events/on-osc.lisp index a82e98d..b626a09 100644 --- a/examples/events/on-osc.lisp +++ b/examples/events/on-osc.lisp @@ -1,24 +1,6 @@ ; -(def ring - (circle 300 300 150)) -; -(defn redraw - () - ( - (clear) - (stroke ring 2 "red"))) -; (defn on-msg (msg) - ( - (def msg-value - (of - (first msg) :value)) - (set ring :r 150))) -; frame -(set ring :r - (sub - (of ring :r) 1)) -(redraw) + (debug msg)) ; trigger (on "/a" on-msg) \ No newline at end of file