We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I am writing a sketch that uses the ControlP5 and OSC libraries. I want to have control over something using theControlP5 GUI in Processing. I also want to have a fader on my mobile device change the y-position through OSC.
My question is how can I route the OSC signal into ControlP5 so that the GUI fader is updated as I use the mobile interface?
Otherwise I would end up changing a variable in the sketch without updating the GUI.
I hope my question is clear.
oscP5: http://www.sojamo.de/libraries/oscp5/ controlP5: http://www.sojamo.de/libraries/controlP5/
Answers
Hi, when an OSC message is received by oscEvent(OscMessage) then get the instance of a controller by calling
Controller c = cp5.getController("slider");
to change the value of the Controller, call
setValue()
. lets assume your OSC message carries a float as its first argument, then use the followingto set the position of a controller, use the same method but instead of calling
setValue(f)
, callsetPosition(x,y)
.Okay sweet, so you can set the value. I think this will provide a way to so it. I will try and construct a working sketch and explore this path.
Thank you for the advice and thank you for contributing the excellent libraries!
Got it, I was able to use the keyboard. But I can see how this would extend to any command. I would imagine you can set other parameters this way like position and all that? Wow, very cool. Going to do the button version next.
And a toggle button...
}
@sojam When I get a lot of sliders and buttons and try to setValue(x) in the setup() function I sometimes am not able to load negative numbers. Is there any way to hard set this?
EDIT I found you had to make a separate variable if you want to have it be loaded in draw(). I think it's time to learn about the saving values feature.
Thanks again,