Hi there,
I was working on an app in java and I want now to convert on android app.
The problem is I was using g4p controls and I know that this lib is not working on android.
I really need this value cause with this I can make dynamic connection to send value on Puredata.
Do you have any solutions to help me on this code?
My old code here:
import oscP5.;
import netP5.;
import controlP5.;
import g4p_controls.;
GTextField txf1;
GTextField txf2;
ControlP5 controlP5;
Knob myDial;
Slider mySlider;
String newuserinput = “”;
String userinput = “” ;
String portinput = “”;
int newportinput = 0 ;
OscP5 oscP5;
NetAddress myRemoteLocation;
int sliderValue = 100;
void setup() {
size(400,400);
smooth();
frameRate(25);
txf1 = new GTextField(this, 10, 10, 200, 20);
txf2 = new GTextField(this, 30, 30, 200, 20);
txf1.setPromptText("");
txf1.setText(""); // works
txf2.setPromptText("");
txf2.setText(""); // works
// create a new instance of oscP5.
// 12000 is the port number you are listening for incoming osc messages.
oscP5 = new OscP5(this, 0000);
myRemoteLocation = new NetAddress(userinput, 0000);
controlP5 = new ControlP5(this);
mySlider = controlP5.addSlider(“sliderValue”,0, 127)
.setPosition(100,100)
.setSize(50, 200);
}
void draw() {
background(0);
fill(255, 0, 0);
;
println(sliderValue);
if (keyPressed && key == ENTER){
println(txf1.getText());
newuserinput = (txf1.getText());
if (keyPressed && key == ENTER){
println(txf2.getText());
portinput = (txf2.getText());
newportinput = Integer.parseInt (portinput);
oscP5 = new OscP5(this, newportinput);
controlP5 = new ControlP5(this);
myRemoteLocation = new NetAddress(newuserinput,newportinput);
}
}
}
void mousePressed() {
/* in the following different ways of creating osc messages are shown by example /
//OscMessage myMessage = new OscMessage(int(knobValue));
//myMessage.add();
OscMessage myMessage = new OscMessage("/fadder1");
myMessage.add(sliderValue);
/ send the message */
oscP5.send(myMessage, myRemoteLocation);
}
I hope you can help me,
Purr