[chuck-users] limit on number of OSC addresses you can listen to?
Spencer Salazar
spencer at ccrma.stanford.edu
Mon Aug 25 21:19:32 EDT 2014
Hey y'all,
Thanks for tracking this down -- awesome sleuthing job. Im surprised that
that is the result of m_inMsgBuffer being too small because that is a
buffer for incoming messages, not created receivers. Nonetheless, that
buffer should definitely be bigger, even on the order of 1024 items isn't
large enough to cause any memory concerns.
spencer
On Fri, Aug 22, 2014 at 2:12 PM, Ben Steinberg <ben at potswift.org> wrote:
> And finally (?), in case anyone finds this thread and not the
> electro-music forum postings, I found the listenAll() method of OscIn in
> Appendix D of Ajay Kapur, Perry Cook, Spencer Salazar & Ge Wang,
> _Programming for Musicians and Digital Artists_. It seems to solve the
> problem:
>
> OscIn oin;
> OscMsg msg;
> 12001 => oin.port;
> oin.listenAll();
> while (true) {
> oin => now;
> while ( oin.recv(msg) )
> {
> <<< "got message:", msg.address, msg.typetag >>>;
> for(int n; n < msg.numArgs(); n++) {
> if(msg.typetag.charAt(n) == 'i') // integer
> <<< "arg", n, ":", msg.getInt(n) >>>;
> else if(msg.typetag.charAt(n) == 'f') // float
> <<< "arg", n, ":", msg.getFloat(n) >>>;
> else if(msg.typetag.charAt(n) == 's') // string
> <<< "arg", n, ":", msg.getString(n) >>>;
> }
> }
> 1::ms => now;
> }
>
> Ben
>
> On 8/22/14, 3:43 PM, Ben Steinberg wrote:
> > (Never mind, I take back the last bit about recompiling with lower
> > numbers -- I was testing from the command line with miniAudicle still
> > open and bound to the port.)
> >
> > Ben
> >
> > On 8/22/14, 3:21 PM, Ben Steinberg wrote:
> >> At Joel's and antimon's suggestion at electro-music, I tried OscRecv
> >> instead of OscIn -- all 16 listeners worked. Recompiling with 256 makes
> >> the original code work, as Joel said; my attempts to recompile with
> >> lower numbers (24, 32, 72) did not -- no listeners worked.
> >>
> >> Ben
> >>
> >> On 8/22/14, 2:43 PM, Ben Steinberg wrote:
> >>> Wow, thanks! I'll see about getting a dev environment together and
> >>> recompiling with something like 32 or 64 --
> >>>
> >>> Ben
> >>>
> >>> On 8/22/14, 2:38 PM, Joel Matthys wrote:
> >>>> It looks to me like the limit of 12 is hard-coded in
> src/ulib_opsc.cpp,
> >>>> line 201:
> >>>>
> >>>> m_inMsgBuffer(CircularBuffer<OscInMsg>(12)),
> >>>>
> >>>> I raised it to 256 and recompiled and your example worked correctly.
> >>>>
> >>>> I can definitely see the value of allowing more than 12 addresses on
> the
> >>>> same port. I'm not sure the memory impact though.
> >>>>
> >>>> Joel
> >>>> --
> >>>>
> >>>> On 08/22/2014 12:25 PM, Ben Steinberg wrote:
> >>>>> I've posted about this to the electro-music forum:
> >>>>> http://electro-music.com/forum/viewtopic.php?p=402793
> >>>>>
> >>>>> In trying to write some code for the Illucia dtr, I found that adding
> >>>>> addresses to an OscIn object appeared not to work after twelve
> >>>>> addresses. I wrote a test program that wasn't illucia-specific; the
> >>>>> following code starts 16 OSC transmitters and 16 receivers. When you
> run
> >>>>> it, you can see that transmitters 0-15 all transmit, but only
> receivers
> >>>>> 0-11 receive.
> >>>>>
> >>>>> for ( 0 => int i ; i < 16 ; i++ ) {
> >>>>> spork ~ output(i);
> >>>>> spork ~ input(i);
> >>>>> }
> >>>>>
> >>>>> while ( true ) {
> >>>>> 1::second => now;
> >>>>> }
> >>>>>
> >>>>> fun void output(int number) {
> >>>>> 12008 => int port;
> >>>>> "localhost" => string hostname;
> >>>>> OscOut xmit;
> >>>>> xmit.dest(hostname, port);
> >>>>> while (true) {
> >>>>> Math.random2f(5.5, 8.5) => float wait;
> >>>>> wait::second => now;
> >>>>> xmit.start("/tester/what/" + number);
> >>>>> Math.random2f(0.0, 1.0) => float temp => xmit.add;
> >>>>> xmit.send();
> >>>>> <<< "sent", number, temp >>>;
> >>>>> }
> >>>>> }
> >>>>>
> >>>>> fun void input(int number) {
> >>>>> OscIn oin;
> >>>>> OscMsg msg;
> >>>>> 12008 => oin.port;
> >>>>> oin.addAddress("/tester/what/" + number + ", f");
> >>>>> float val;
> >>>>> while (true) {
> >>>>> oin => now;
> >>>>> while ( oin.recv(msg) != 0 )
> >>>>> {
> >>>>> msg.getFloat(0) => val;
> >>>>> <<< "received", number, val >>>;
> >>>>> }
> >>>>> 5::ms => now;
> >>>>> }
> >>>>> }
> >>>>>
> >>>>> I'm running ChucK 1.3.4 on Mavericks, with and without miniAudicle.
> >>>>> _______________________________________________
> >>>>> chuck-users mailing list
> >>>>> chuck-users at lists.cs.princeton.edu
> >>>>> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
> >>>>
> >>>> _______________________________________________
> >>>> chuck-users mailing list
> >>>> chuck-users at lists.cs.princeton.edu
> >>>> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
> >>> _______________________________________________
> >>> chuck-users mailing list
> >>> chuck-users at lists.cs.princeton.edu
> >>> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
> >>>
> >> _______________________________________________
> >> chuck-users mailing list
> >> chuck-users at lists.cs.princeton.edu
> >> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
> >>
> > _______________________________________________
> > chuck-users mailing list
> > chuck-users at lists.cs.princeton.edu
> > https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
> >
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20140825/66314159/attachment.html>
More information about the chuck-users
mailing list