oscP5 for the APDE

For the APDE app to work with oscP5, it requires a full structured library with a dex.jar, So I build this new jar and you can download it [here]. Just unzip the file into the Sketchbook/libraries folder. Below, a code for simultaneous interaction between two devices or PC. It’s pretty fast and suitable for a ping pong game. (Anyone feels challenged?)

import oscP5.*;
import netP5.*;

OscP5 oscP5;
NetAddress remoteLocation;
int x, y;

void setup() {
  size(400, 400);
  oscP5 = new OscP5(this, 12000); 
  remoteLocation = new NetAddress("192.168.25.4", 12000); // 192.168.25.4 has to be the IP of the other phone/PC
  fill(0);
}

void draw() {
  background(255);  
  ellipse(x, y, 10, 10);
}

void oscEvent(OscMessage m) {
  // if(m.checkAddrPattern("/tes") == true) {
  //  if(m.checkTypetag("ii")) { 
  x = m.get(0).intValue(); 
  y = m.get(1).intValue();
  // }  
  //}
}

void mouseDragged() {
  oscP5.send("/tes", new Object[] {new Integer(str(mouseX)), new Integer(str(mouseY))}, remoteLocation);
}

/*
 Address patterns in the OSC protocol are used as "labels" to switch/direct easily to different functions
 using "checkAddrPattern(/yourLabel)"
 The typetag is actually a string containing the order and amount of data types that you use in 
 the Object[] parameters. For instance; "ifs" means three parameters in object respectively, int, float, and string 
 */
1 Like

3 posts were split to a new topic: Posts in Gallery vs platform/language mode

Thank you.
I will try this code and response to you

@noel – Thank you so much for making and sharing this. Any chance that you could release this through a hosted code sharing site, e.g. github? I’d love to save a copy as a community resource.