[chuck-users] questions on osc, events and multi-shredding

eduard aylon eduard.aylon at gmail.com
Tue Mar 27 03:51:13 EDT 2007


Hi Lu,

just answering on regards to the code. Other questions might be  
addressed better by developers.

There is 1 offending line, namely orec.event("/test/*, i s") @=>  
OscEvent e . This means your receiver is waiting for events of the  
form /test/*, which are never received for you are sending events / 
test/bla

Trying to fix lu's code I realised that the following yields the same  
results:
  1. xmit.startMsg("/test/bla", "i, s");   and  xmit.startMsg("/test/ 
bla, i, s");
2. orec.event("/test/bla", "i,s") @=> OscEvent e; and orec.event("/ 
test/bla, i,s") @=> OscEvent e;

Should it be this way?

eduard


You may try this code,

string words[];
["foo", "bar", "foo2", "bar2"] @=> words;
words.cap() => int size;
size--;

fun int sender(){
     OscSend xmit;
     xmit.setHost("localhost",6449);
     0 => int i;
     while(true){
     now + 1000::ms => now;
     xmit.startMsg("/test/bla", "i, s");
     i => xmit.addInt;  //sending different ints to check it's  
receiving correct msgs
     words[i++ & size] => xmit.addString; // sending different strings
         }

}
spork ~ sender();


OscRecv orec;
6449 => orec.port;
orec.listen();
orec.event("/test/bla, i,s") @=> OscEvent e;
while(true){
     e => now;
     e.nextMsg();
     e.getInt() => int i1;
     e.getString() => string s1;
     <<<"event recieved!", i1, s1>>>;
}


On Mar 27, 2007, at 1:59 AM, Lukas Degener wrote:

> Hi List,
>
> Do I understand this correctly that I have to create an OscEvent for
> every single OSC method I want to listen for?
>
> The docs say I can use any valid OSC address pattern, but this does  
> not
> seem to work. I have attached a (stupid) program that demonstrates the
> problem.
> So I need a separate shred for each  OSC method?
>
> Which brings me to another thing I was wondering about lately:
> A shred can not wait for more than one event (including time  
> passage) at
> the same time.
> So in many situtations, I will have no choice but to either do polling
> on a set of conditions, or create a separate shred for each event I am
> interested in.
> But this could be quite a large (theoretically infinit) number of  
> shreds.
> Until now, I decided to use polling, but I was wondering if there was
> some kind of "proven pattern" that could be employed in such  
> situations.
>
> What is the overhead of a shred anyway? Would it be a problem to  
> create
> a *lot* of them? Like - let's say - a couple of thousands? From some
> primitive experiments, it seems that the creation involves some
> noticeable overhead, but I already had thousands of them running  
> (well,
> mostly idle) without any problem. Are there any upper bounds?
>
> Otoh, is it a good idea to do polling in very short intervals, like  
> the
> duration of one frame?
>
> Sorry, lots of questions. :-)
>
> Best Regards,
> --lu
>
> fun int sender(){
> 	OscSend xmit;
> 	xmit.setHost("localhost",6449);
> 	while(true){
> 		now + 1000::ms => now;
> 		xmit.startMsg("/test/bla", "i s");
> 		42 => xmit.addInt;
> 		"knarz" => xmit.addString;
> 	}
> 	
> }
> spork ~ sender();
>
>
> OscRecv orec;
> 6449 => orec.port;
> orec.listen();
> orec.event("/test/*, i s") @=> OscEvent e;
> while(true){
> 	e => now;
> 	e.nextMsg();
> 	<<<"event recieved!">>>;	
> }
>
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users



More information about the chuck-users mailing list