I don't know about the segv signal, but it seems to me that there is only one Bang instance that is shared by all iterations/shreds. This means that if two events arrive at this loop:
while( oe.nextMsg() ) {
oe.getInt() => b.value;
osctype => b.message;
b.broadcast();
}
the second's values will overwrite those of the first (value and message from the first event will be lost). Also, if the two oscListener shreds happen to call broadcast simultaneously, one shred's bang values will overwrite the other's.
I'm wondering about this statement:
osctype => b.message;
Will it cause some kind of copied string object? Probably not, I guess. The lack of garbage collection of strings has been one of my woes when composing OSC addresses.
/Stefan
there is a known bug with OSC receiving on multiple ports, which may account for this. it's been reported:dtOn Apr 28, 2008, at 2:47 AM, mike clemow wrote:Hello all,So, the following code sporks out two shreds to listen for two (fornow--I want to be using 14) OSC messages, put their int values into anevent and report back to the parent shred with the value and theaddress. This is supposed to be a way to get around the fact that,a) I seem to have to listen on a different port if the OSC messageshave the same type,b) that I can't wait on multiple events and,c) that I want all the values to control parameters in a single patch.My OSC messages are being lobbed at Chuck via a Python script andeverything seems to be working fine on that end. I've even gottenthis to work using two chuck shreds that were manually sporked. Atany rate, this code runs fine for about two seconds and then dies ineither a segmentation fault or a bus error.Any guesses?---// extend the Event classclass Bang extends Event {string message;int value;}// a generic osc listener shredfun void oscListener( Bang b, int port, string osctype ) {// create our OSC receiverOscRecv recv;port => recv.port;recv.listen();// create an address in the receiver, store in new variablerecv.event( osctype ) @=> OscEvent oe;while( true ) {// wait for osc event to arriveoe => now;while( oe.nextMsg() ) {oe.getInt() => b.value;osctype => b.message;b.broadcast();}}}// our event "Bang"Bang bang;8000 => int oscport;// the types for the osc objects"/leftraw, i" => string leftraw;"/leftavg, i" => string leftavg;spork ~ oscListener( bang, oscport, leftraw );// shreds are usually happier listening on a separate portspork ~ oscListener( bang, oscport + 1, leftavg );SinOsc raw => dac;SinOsc avg => dac;while( true ) {bang => now;//<<<bang.message, bang.value>>>;if( bang.message == leftraw ) {bang.value => raw.freq;}else if( bang.message == leftavg ) {bang.value => avg.freq;}}_______________________________________________chuck-users mailing list
_______________________________________________
chuck-users mailing list
chuck-users@lists.cs.princeton.edu
https://lists.cs.princeton.edu/mailman/listinfo/chuck-users