I don&#39;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:<br><br>&nbsp; &nbsp; &nbsp;&nbsp; while( oe.nextMsg() ) {<br>

 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;oe.getInt() =&gt; b.value;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;osctype =&gt; b.message;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;b.broadcast();<br>
 &nbsp; &nbsp; &nbsp; &nbsp;}<br><br>the second&#39;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&#39;s bang values will overwrite the other&#39;s.<br>
<br>I&#39;m wondering about this statement:<br><br>osctype =&gt; b.message;<br><br>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.<br>
<br>/Stefan<br><br><div class="gmail_quote">On Mon, Apr 28, 2008 at 1:24 PM, dan trueman &lt;<a href="mailto:dtrueman@princeton.edu">dtrueman@princeton.edu</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div style="">
there is a known bug with OSC receiving on multiple ports, which may account for this. it&#39;s been reported:<div><br></div><div><div style="margin: 0px;"><font style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: normal; font-size-adjust: none; font-stretch: normal;" face="Helvetica" size="3"><a href="http://wiki.cs.princeton.edu/index.php/OSC_multiple_port_bug" target="_blank">http://wiki.cs.princeton.edu/index.php/OSC_multiple_port_bug</a></font></div>
<div style="margin: 0px;"><br></div><font color="#888888"><div style="margin: 0px;">dt</div></font><div><div></div><div class="Wj3C7c"><div style="margin: 0px;"><br></div><div><div>On Apr 28, 2008, at 2:47 AM, mike clemow wrote:</div>
<br><blockquote type="cite"><div style="margin: 0px;">Hello all,</div><div style="margin: 0px; min-height: 14px;"><br></div><div style="margin: 0px;">So, the following code sporks out two shreds to listen for two (for</div>
<div style="margin: 0px;">now--I want to be using 14) OSC messages, put their int values into an</div><div style="margin: 0px;">event and report back to the parent shred with the value and the</div><div style="margin: 0px;">
address.<span>&nbsp; </span>This is supposed to be a way to get around the fact that,</div><div style="margin: 0px; min-height: 14px;"><br></div><div style="margin: 0px;">a) I seem to have to listen on a different port if the OSC messages</div>
<div style="margin: 0px;">have the same type,</div><div style="margin: 0px;">b) that I can&#39;t wait on multiple events and,</div><div style="margin: 0px;">c) that I want all the values to control parameters in a single patch.</div>
<div style="margin: 0px; min-height: 14px;"><br></div><div style="margin: 0px;">My OSC messages are being lobbed at Chuck via a Python script and</div><div style="margin: 0px;">everything seems to be working fine on that end.<span>&nbsp; </span>I&#39;ve even gotten</div>
<div style="margin: 0px;">this to work using two chuck shreds that were manually sporked.<span>&nbsp; </span>At</div><div style="margin: 0px;">any rate, this code runs fine for about two seconds and then dies in</div><div style="margin: 0px;">
either a segmentation fault or a bus error.</div><div style="margin: 0px; min-height: 14px;"><br></div><div style="margin: 0px;">Any guesses?</div><div style="margin: 0px; min-height: 14px;"><br></div><div style="margin: 0px;">
---</div><div style="margin: 0px;">// extend the Event class</div><div style="margin: 0px;">class Bang extends Event {</div><div style="margin: 0px;"><span>&nbsp; &nbsp; </span>string message;</div><div style="margin: 0px;"><span>&nbsp; &nbsp; </span>int value;</div>
<div style="margin: 0px;">}</div><div style="margin: 0px; min-height: 14px;"><br></div><div style="margin: 0px;">// a generic osc listener shred</div><div style="margin: 0px;">fun void oscListener( Bang b, int port, string osctype ) {</div>
<div style="margin: 0px;"><span>&nbsp; &nbsp; </span>// create our OSC receiver</div><div style="margin: 0px;"><span>&nbsp; &nbsp; </span>OscRecv recv;</div><div style="margin: 0px;"><span>&nbsp; &nbsp; </span>port =&gt; recv.port;</div><div style="margin: 0px;">
<span>&nbsp; &nbsp; </span>recv.listen();</div><div style="margin: 0px; min-height: 14px;"><br></div><div style="margin: 0px;"><span>&nbsp; &nbsp; </span>// create an address in the receiver, store in new variable</div><div style="margin: 0px;">
<span>&nbsp; &nbsp; </span>recv.event( osctype ) @=&gt; OscEvent oe;</div><div style="margin: 0px; min-height: 14px;"><br></div><div style="margin: 0px;"><span>&nbsp; &nbsp; </span>while( true ) {</div><div style="margin: 0px;"><span>&nbsp; &nbsp; &nbsp; &nbsp; </span>// wait for osc event to arrive</div>
<div style="margin: 0px;"><span>&nbsp; &nbsp; &nbsp; &nbsp; </span>oe =&gt; now;</div><div style="margin: 0px; min-height: 14px;"><br></div><div style="margin: 0px;"><span>&nbsp; &nbsp; &nbsp; &nbsp; </span>while( oe.nextMsg() ) {</div><div style="margin: 0px;">
<span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span>oe.getInt() =&gt; b.value;</div><div style="margin: 0px;"><span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span>osctype =&gt; b.message;</div><div style="margin: 0px;"><span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span>b.broadcast();</div><div style="margin: 0px;">
<span>&nbsp; &nbsp; &nbsp; &nbsp; </span>}</div><div style="margin: 0px;"><span>&nbsp; &nbsp; </span>}</div><div style="margin: 0px;">}</div><div style="margin: 0px; min-height: 14px;"><br></div><div style="margin: 0px;">// our event &quot;Bang&quot;</div>
<div style="margin: 0px;">Bang bang;</div><div style="margin: 0px;">8000 =&gt; int oscport;</div><div style="margin: 0px; min-height: 14px;"><br></div><div style="margin: 0px;">// the types for the osc objects</div><div style="margin: 0px;">
&quot;/leftraw, i&quot; =&gt; string leftraw;</div><div style="margin: 0px;">&quot;/leftavg, i&quot; =&gt; string leftavg;</div><div style="margin: 0px; min-height: 14px;"><br></div><div style="margin: 0px;">spork ~ oscListener( bang, oscport, leftraw );</div>
<div style="margin: 0px;">// shreds are usually happier listening on a separate port</div><div style="margin: 0px;">spork ~ oscListener( bang, oscport + 1, leftavg );</div><div style="margin: 0px; min-height: 14px;"><br></div>
<div style="margin: 0px;">SinOsc raw =&gt; dac;</div><div style="margin: 0px;">SinOsc avg =&gt; dac;</div><div style="margin: 0px; min-height: 14px;"><br></div><div style="margin: 0px;">while( true ) {</div><div style="margin: 0px;">
<span>&nbsp; &nbsp; </span>bang =&gt; now;</div><div style="margin: 0px;"><span>&nbsp; &nbsp; </span>//&lt;&lt;&lt;bang.message, bang.value&gt;&gt;&gt;;</div><div style="margin: 0px;"><span>&nbsp; &nbsp; </span>if( bang.message == leftraw ) {</div><div style="margin: 0px;">
<span>&nbsp; &nbsp; &nbsp; &nbsp; </span>bang.value =&gt; raw.freq;</div><div style="margin: 0px;"><span>&nbsp; &nbsp; </span>}</div><div style="margin: 0px;"><span>&nbsp; &nbsp; </span>else if( bang.message == leftavg ) {</div><div style="margin: 0px;"><span>&nbsp; &nbsp; &nbsp; &nbsp; </span>bang.value =&gt; avg.freq;</div>
<div style="margin: 0px;"><span>&nbsp; &nbsp; </span>}</div><div style="margin: 0px;">}</div><div style="margin: 0px;">_______________________________________________</div><div style="margin: 0px;">chuck-users mailing list</div><div style="margin: 0px;">
<a href="mailto:chuck-users@lists.cs.princeton.edu" target="_blank">chuck-users@lists.cs.princeton.edu</a></div><div style="margin: 0px;"><a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users" target="_blank">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a></div>
 </blockquote></div><br></div></div></div></div><br>_______________________________________________<br>
chuck-users mailing list<br>
<a href="mailto:chuck-users@lists.cs.princeton.edu">chuck-users@lists.cs.princeton.edu</a><br>
<a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users" target="_blank">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Release me, insect, or I will destroy the Cosmos!