dynamic oscP5 messages
in
Contributed Library Questions
•
1 month ago
Hi everyone,
I'm pretty new to processing but I can't seem to get enough of it! Anyway, I'm stuck on something I feel should have a solution...
I'm using OscP5 in my program and want to have several variables coming in simultaneously; however, I also want to avoid having to rewrite the entire oscEvent function over and over again for a different variable. What I'm wondering is how to dynamically create an Osc function that accepts arguments so I can just write, for instance:
myOscEvent(someString, someChar, printMe?);
such that:
- float oscEvent(OscMessage theOscMessage) {
- if (theOscMessage.checkAddrPattern(someString)==true) {
- if (theOscMessage.checkTypetag(someChar)) {
- float firstValue = theOscMessage.get(0).floatValue();
- if(printMe?==true) {
- println(" values: "+firstValue);
- }
- return firstValue;
- }
- }
- }
I also suppose I don't understand how to pass arguments to oscEvent if (oscMessage theOscMessage) are there... And how do I pass strings as arguments in the first place?? Thanks for letting me be a noob...
2