Change the way the osc is handled

This commit is contained in:
Devine Lu Linvega 2019-07-22 11:27:42 +09:00
parent 4ee834bdb6
commit 605dd1fb9e
3 changed files with 16 additions and 14 deletions

View File

@ -17,7 +17,8 @@ function Osc (ronin) {
}
this.onMsg = (msg, timeTag, info) => {
this.msg[msg.address] = msg.args
// ronin.log(`${info.address}:${info.port} > ${msg.args}`, info)
if (ronin.bindings[msg.address]) {
ronin.bindings[msg.address](msg.args)
}
}
}

View File

@ -1 +0,0 @@
(debug (of (osc "/a") :0 :value))

View File

@ -1,11 +1,13 @@
(defn on-msg
(msg)
(
(clear)
(def x (of (osc "/test") "args" "0" "value"))
(def y (of (osc "/test") "args" "1" "value"))
(def r (of (osc "/test") "args" "2" "value"))
(fill
(circle x y r)
"red")
(def msg-value
(of
(first msg) :value))
(stroke
(circle x y r)
5 "white")
(circle 300 300 150) 2
(if
(eq msg-value 1) "#ffb545" "#72dec2" ))))
; trigger
(on "/a" on-msg)