How does oscEvent() work?

edited July 2014 in Library Questions

Hello,

I'm using OscP5 within an Android App. Basically it works nicely. However I don't understand how oscEvent works. As far as I can see no variable that gets updated (or set after having it declared on top of my sketch along with other variables used across the app) within oscEvent() gets populated within the sketch as well as oscEvent doesn't seem to catch any changes to existing variables outside its own scope. What I wanted to do was to write some OSC-message to screen based on a condition that's determined by the value of a variable that gets updated outside oscEvent(). But no matter what I did - printing the variable from outside oscEvent reflects the actual value while trying to print it from inside oscEvent always gives the value to which my variable was set in setup().

Can someone enlighten me a bit about what's going on here?

Thanks.

Tagged:

Answers

  • Answer ✓

    Found a simple solution: a (global) variable which shall be accessed from within oscEvent() (or from a function invoked from within oscEvent()) must be declared as 'static'. That seems to be all.

Sign In or Register to comment.