Fixed osc
This commit is contained in:
parent
bc9f4e1368
commit
a3d0856c6e
@ -2,23 +2,17 @@
|
|||||||
|
|
||||||
function Osc (ronin) {
|
function Osc (ronin) {
|
||||||
const osc = require('node-osc')
|
const osc = require('node-osc')
|
||||||
|
this.port = 49162
|
||||||
this.msg = {}
|
|
||||||
|
|
||||||
this.start = function () {
|
this.start = function () {
|
||||||
|
const server = new osc.Server(49162, '0.0.0.0')
|
||||||
const udpPort = new osc.Server(
|
server.on('message', this.onMsg)
|
||||||
49162,
|
|
||||||
'0.0.0.0'
|
|
||||||
)
|
|
||||||
|
|
||||||
udpPort.on('message', this.onMsg)
|
|
||||||
ronin.log('OSC', 'Started.')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.onMsg = (msg, timeTag, info) => {
|
this.onMsg = (msg) => {
|
||||||
if (ronin.bindings[msg.address]) {
|
const address = msg.shift()
|
||||||
ronin.bindings[msg.address](msg.args)
|
if (ronin.bindings[address]) {
|
||||||
|
ronin.bindings[address](msg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,24 +1,6 @@
|
|||||||
;
|
;
|
||||||
(def ring
|
|
||||||
(circle 300 300 150))
|
|
||||||
;
|
|
||||||
(defn redraw
|
|
||||||
()
|
|
||||||
(
|
|
||||||
(clear)
|
|
||||||
(stroke ring 2 "red")))
|
|
||||||
;
|
|
||||||
(defn on-msg
|
(defn on-msg
|
||||||
(msg)
|
(msg)
|
||||||
(
|
(debug msg))
|
||||||
(def msg-value
|
|
||||||
(of
|
|
||||||
(first msg) :value))
|
|
||||||
(set ring :r 150)))
|
|
||||||
; frame
|
|
||||||
(set ring :r
|
|
||||||
(sub
|
|
||||||
(of ring :r) 1))
|
|
||||||
(redraw)
|
|
||||||
; trigger
|
; trigger
|
||||||
(on "/a" on-msg)
|
(on "/a" on-msg)
|
Loading…
x
Reference in New Issue
Block a user