ah ok. So I really need to parse the string then.
Miguel Negrão A 2009/12/26, às 12:00, nonprivate escreveu:
but the first element of your array is still a single string, it is not an array on its own. it looks as if the "/" characters were simply removed, "/mrmr" is not going to respond to it. On 25 Dec 2009, at 21:18, Miguel Negrao wrote: Thanks that’s it. I thought that with /mrmr I would get all messages with that prefix. Indeed using the full string I can get the messages. mrmr also has a mode where the messages come in an array appearing has: message: [ /mrmr slider horizontal 3 iPhone-de-Miguel-Negrao, 0.68199998140335 ] but still doing OSCResponderNode(nil,/mrmr,{ print stuff action }).add doesn’t show anything...
I’ll check your code.
thanks Miguel
A 2009/12/25, às 14:23, nonprivate escreveu: hi, i think it's because the first item in the message is a single string: "/mrmr/accelerometerZ/10/iPhone-de-Miguel-Negrao"
wheras the responder is set to respond to the string: "/mrmr"
you would idealy want all the elements in the first string to be seperate elements in an array or something similar, so you can do some if or case operations on it. but alas they are not!
i made an extension to OSCresponder recently to deal with this situation, i'm attaching the file, see if it helps you? (if you set the response to "/mrmr" it should respond to any string with this in, and split the following elements up - although beware that any numbers in the string will still be strings after the split - if you know that an element in a certain position is a number then you can do something like "10".asInt i believe) also my extension allows to set the responder to "/anything", and then any message will be responded to, which may also be useful (it's slightly nicer than setting thisProcess.recvOSCfunc directly)
<C2_OSCresponderExtensions.sc>On 25 Dec 2009, at 14:28, Miguel Negrao wrote: Having a bit of difficulty with an iphone 3gs, mrmr and sc. I’ve set the port to 57120 in the iphone. If I do
( thisProcess.recvOSCfunc = { |time, addr, msg| if(msg[0] != 'status.reply') { "time: % sender: %\nmessage: %\n".postf(time, addr, msg); } } );
I see all the messages comming in. E.g:
time: 881.128271648 sender: a NetAddr(192.168.1.105, 49195) message: [ /mrmr/accelerometerZ/10/iPhone-de-Miguel-Negrao, 0.21299999952316 ]
But If I do :
o = OSCresponder.new(nil, "/mrmr", { arg time, resp, msg; [time,resp].postln; } ).add; // create the OSCresponder
nothing happens... I’m a bit lost here, anyone care to help ?
thanks Miguel Negrão
A 2009/04/08, às 08:10, kimm furt escreveu:
|