[chuck-users] Question about new OSC support classes - OscIn
Simon Steptoe
simonsteptoe at yahoo.co.uk
Sat May 10 10:32:06 EDT 2014
I was looking at the new Osc support classes. When using OscIn, I can't
seem to receive more than the first character of a string.
If I replace the OscIn code with the equivalent using OscRecv code then the
strings come through okay.
If I sent the equivalent data to a separate program - e.g. PD - then the
strings also come through okay.
Conversely, if I send strings from PD to ChucK then, once again, my OscIn
code only picks up the first character.
So, I am assuming the issue lies with my code for OscIn rather than OscOut.
If anyone could put their finger on the problem, I would be most grateful.
And a separate issue with .addAddress: "oIn.addAddress( "/chuck/data,
ifss" )" works but "oIn.addAddress( "/chuck/data, i f s s" )" doesn't.
This didn't seem to be an issue when using with OscRev/.event.
Here's the code:
//===========================================
OscIn oIn;
OscMsg oMsg;
6452 => oIn.port;
oIn.addAddress( "/chuck/data, ifss" );
"localhost" => string hostname;
6452 => int port;
OscOut xmit;
xmit.dest( hostname, port );
spork ~ recvOsc();
spork ~ sendOsc();
while(true)
{
1::day => now;
}
//============================================
fun void sendOsc()
{
while( true )
{
xmit.start( "/chuck/data" );
Math.random2( 30, 80 ) => xmit.add;
Math.random2f( 0.1, 1 ) => xmit.add;
"xyz" => xmit.add;
"abc" => xmit.add;
xmit.send();
1::second => now;
}
}
//============================================
fun void recvOsc()
{
-1 => int i;
-1.0 => float f;
"NULL" => string s;
"NULL2" => string s2;
"NULL3" => string s3;
while( true )
{
oIn => now;
while( oIn.recv(oMsg) )
{
oMsg.getInt(0) => i;
oMsg.getFloat(1) => f;
oMsg.getString(2) => s;
oMsg.getString(3) => s2;
<<< "got (via OSC):", i, f, s, s2, s3 >>>;
}
}
}
//=================================================
Thanks
Simon
(PS - my machine is a PC running Windows Vista)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20140510/905065f8/attachment.htm>
More information about the chuck-users
mailing list