TUIO_OSCServer
superclass: TUIOServer
/*
Author:
2004, 2005, 2006
Till Bovermann
Neuroinformatics Group
Faculty of Technology
Bielefeld University
Germany
*/
a server fullfilling the TUIO-Specs.
drawbacks:
no 'P' symbols are yet handled...
*new(formatString, netaddr, tuioClass)
formatString a format String (explained in [TUIObject])
netaddr a netaddr default nothing, listening to all.
tuioClass the Class of the created objects.
Must be a subclass of [TUIObject], defaults to TUIObject.
start
starts listening
stop
stops litening
gui
creates a gui representing recognized objects
Examples / Tests:
// create a server and start it...
(
// ... listening to all messages from priamos
//t = TUIO_OSCServer('_ixya', NetAddr("priamos.techfak.uni-bielefeld.de", nil));
// ... or
t = TUIO_OSCServer("_ixya", nil, TUIObject); // listen to all messages from anywhere
t.start;
// inspect its behavior
//i = t.inspect;
g = t.gui;
// send him messages
a = NetAddr.localAddr;
a.sendMsg("/tuio/_ixya", \set, 1, 42, 0.5, 0.5, 2pi.rand, 0, 0, 0);
a.sendMsg('/tuio/_ixya', \alive, 1);
i.update;
)
a.sendMsg('/tuio/_ixya', \set, 2, 42, 0.5, 0.8, 2pi.rand, 0, 0, 0);
a.sendMsg('/tuio/_ixya', \alive, 1, 2);
i.update;
a.sendMsg('/tuio/_ixya', \set, 3, 42, 0.5, 0.6, 2pi.rand, 0, 0, 0);
a.sendMsg('/tuio/_ixya', \alive, 1, 2, 3);
i.update;
a.sendMsg('/tuio/_ixya', \set, 4, 42, 0.5, 0.5, 2pi.rand, 0, 0, 0);
a.sendMsg('/tuio/_ixya', \alive, 1, 2, 3, 4);
i.update;
// send alive messages
a.sendMsg('/tuio/_ixya', \alive, 1, 2);
i.update
// 5 does not exist
a.sendMsg('/tuio/_ixya', \alive, 1, 2, 5);
i.update
a.sendMsg('/tuio/_ixya', \alive);
i.update;
t.stop
// create a server and start it... now using 3D axis notation
(
// ... listening to all messages from priamos
//t = TUIO_OSCServer('_ixya', NetAddr("priamos.techfak.uni-bielefeld.de", nil));
// ... or
t = TUIO_OSCServer("_ixyzuvw", nil, TUIObject); // listen to all messages from anywhere
t.start;
// inspect its behavior
i = t.inspect;
g = t.gui;
// send him messages
n = NetAddr.localAddr;
n.sendMsg('/tuio/_ixyzuvw', \set, 1, 42, 0.7.rand, 0.5, 2pi.rand, 10, 20, 30.rand);
n.sendMsg('/tuio/_ixyzuvw', \alive, 1);
i.update;
)
//////////////////////////////////////////////////////////////////////////////
//-----------------
p = ProxySpace.push(s.boot);
~out.ar(2)
~out.awake = false
~out.play
~out = {|freq = 800| Saw.ar(freq, 0.1*EnvGen.kr(Env.perc, doneAction: 2))}
~out.spawn
t = TUIO_OSCServer('2Dobj', nil, TUIObjectSimpleFunc)
TUIObjectSimpleFunc.func = {|id, pos| pos.postln; ~out.spawn([\freq, 300+(pos[0]*1000)])}
t.start
//-------------using object classID's (TUIObjectNodeProxyPlayer)-------------------
(
Server.default = Server.internal;
Server.default.boot;
)
Server.default.initTree;
s=Server.default;
s.scope
Server.default.dumpOSC(0)
Server.default.queryAllNodes;
// create a server and start it
//t = TUIO_OSCServer('2Dobj', NetAddr("priamos.techfak.uni-bielefeld.de", nil), TUIObjectNodeProxyPlayer)
t = TUIO_OSCServer('2Dobj', nil, TUIObjectNodeProxyPlayer)
t.start
t.stop
// send him messages
a = A_OSCInterface('tuio/2Dobj', NetAddr("127.0.0.1", 57120));
a.send(\set, 120, 120, 0);
a.send(\set, 120, 120, 0.5);
a.send(\set, 120, 120, 0.7);
a.send(\set, 1, 1, 0.4);
a.send(\set, 60, 60, 0.0);
// inspect its behavior
t.inspect
// send alive messages
a.send(\alive, 1, 60);
a.send(\alive);
//-------------using TUIObjectGUIRep------------------
t = TUIO_OSCServer('2Dobj', nil, TUIObjectGUIRep)
t.start
//t.stop
a = A_OSCInterface('tuio/2Dobj', NetAddr("127.0.0.1", 57120));
a.send(\set, 120, 120, 0);
a.send(\set, 120, 120, 0.5);
a.send(\set, 120, 120, 0.7);
// inspect its behavior
t.inspect
// drag this into the TUIOView:
b = LogicObject.new("testObj");
//b.setAction = {|... args| args.postln;}
b.makeWindow;
b.inspect
p = ProxySpace.push(s.boot)
~out = {|freq = 100| SinOsc.ar(freq)}
~out.play
b.linkedProxy = ~out
{20.do{a.send(\set, 120, 120, 1.0.rand); 0.3.wait}}.fork
~out.add{|freq = 100| Saw.ar(1.2*freq)}
~out.add{|freq = 100| Saw.ar(1.4*freq)}
~out.add{|freq = 100| Saw.ar(1.6*freq)}
~out.add{|freq = 100| Saw.ar(1.8*freq)}
~out.free(2)
~out.play
~out.class
~out.set(\freq, 440)
// send alive messages
a.send(\alive, 120, 60);
a.send(\alive);