osc/client
src/osc/client.tur
defn
client-new
(client-new [host :cstr port :cstr proto :cstr] :ptr<void>)
create a new OSC client address targeting host:port.
Parameters
| host | target hostname or IP string (e.g. "127.0.0.1") | |
| port | target port string (e.g. "7770") | |
| proto | ignored; lo_address_new always uses UDP |
Returns
(ok addr-ptr) on success; (err 0) on failure. addr-ptr is an opaque :int handle; pass to client-send and client-free.
Example
(let [r (client-new "127.0.0.1" "7770" "udp")]
(if (ok? r) (let [c (ok-val r)] ...) (println "client-new failed")))
Since: OSC0
defn
client-free
(client-free [c :int] :void)
release a client address created by client-new.
Parameters
| c | addr-ptr (ok-val from client-new) |
Returns
void
Example
(client-free c)
Since: OSC0
defn
client-send
(client-send [c :int m :int] :ptr<void>)
send an OSC message to the client address.
Parameters
| c | addr-ptr (ok-val from client-new) | |
| m | msg wrapper :int (return value of msg-new from osc/msg) |
Returns
(ok 0) on success; (err rc) on failure where rc is the liblo error code.
Example
(let [m (msg-new "/synth/freq")]
(msg-add-float m 440.0)
(let [r (client-send c m)]
(if (ok? r) (println "sent") (println "send failed"))))
Since: OSC0
defn
client-send-bundle
(client-send-bundle [c :int bundle :int] :ptr<void>)
send an OSC bundle to the client address.
Parameters
| c | addr-ptr (ok-val from client-new) | |
| bundle | bundle :int (return value of bundle-new from osc/bundle) |
Returns
(ok 0) on success; (err rc) on failure where rc is the liblo error code.
Example
(let [b (bundle-new 0.0)]
(bundle-add-msg b m)
(let [r (client-send-bundle c b)]
(if (ok? r) (println "sent") (println "send-bundle failed"))))
Since: OSC0
Internal definitions
__ok-- create an ok result wrapping integer value v.__err-- create an err result wrapping integer error value e.