SETO_OSCServer

superclass: SETOServer

/*

Author:

2004, 2005, 2006, 2007, 2008

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, setoClass)

formatString a format String (explained in [SETObject])

netaddr a netaddr default nothing, listening to all.

setoClass the Class of the created objects.

Must be a subclass of [SETObject], defaults to SETObject.

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 = SETO_OSCServer('_ixya', NetAddr("priamos.techfak.uni-bielefeld.de", nil));

// ... or

t = SETO_OSCServer("_ixya", nil, SETObject); // 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 = SETO_OSCServer('_ixya', NetAddr("priamos.techfak.uni-bielefeld.de", nil));

// ... or

t = SETO_OSCServer("_ixyzuvw", nil, SETObject); // 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 = SETO_OSCServer('2Dobj', nil, SETObjectSimpleFunc)

SETObjectSimpleFunc.func = {|id, pos| pos.postln; ~out.spawn([\freq, 300+(pos[0]*1000)])}

t.start

//-------------using object classID's (SETObjectNodeProxyPlayer)-------------------

(

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 = SETO_OSCServer('2Dobj', NetAddr("priamos.techfak.uni-bielefeld.de", nil), SETObjectNodeProxyPlayer)

t = SETO_OSCServer('2Dobj', nil, SETObjectNodeProxyPlayer)

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 SETObjectGUIRep------------------

t = SETO_OSCServer('2Dobj', nil, SETObjectGUIRep)

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 SETOView:

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);