Mo cap Netherland workshop_Wekinator Code
/** | |
* oscP5broadcastClient by andreas schlegel | |
* an osc broadcast client. | |
* an example for broadcast server is located in the oscP5broadcaster exmaple. | |
* oscP5 website at http://www.sojamo.de/oscP5 | |
*/ | |
import processing.video.*; | |
import oscP5.*; | |
import netP5.*; | |
float prayAmount = 0; | |
float surfAmount = 0; | |
float phoneAmount = 0; | |
OscP5 oscP5; | |
boolean prayBool = false; | |
boolean surfBool = false; | |
boolean phoneBool = false; | |
Movie myMovie; | |
/* a NetAddress contains the ip address and port number of a remote location in the network. */ | |
NetAddress myBroadcastLocation; | |
void setup() { | |
fullScreen(2); | |
//size(1900, 1200); | |
frameRate(30); | |
myMovie = new Movie(this,"tracer_1mp4.mov"); | |
myMovie.loop(); | |
/* create a new instance of oscP5. | |
* 12000 is the port number you are listening for incoming osc messages. | |
*/ | |
oscP5 = new OscP5(this,12000); | |
/* create a new NetAddress. a NetAddress is used when sending osc messages | |
* with the oscP5.send method. | |
*/ | |
/* the address of the osc broadcast server */ | |
myBroadcastLocation = new NetAddress("127.0.0.1",32000); | |
} | |
void draw() { | |
background(0); | |
if(myMovie.available()){ | |
myMovie.read(); | |
} | |
image(myMovie,0,0,1920,1200); | |
} | |
/* incoming osc message are forwarded to the oscEvent method. */ | |
void oscEvent(OscMessage theOscMessage) { | |
/* get and print the address pattern and the typetag of the received OscMessage */ | |
println("### received an osc message with addrpattern "+theOscMessage.addrPattern()+" and typetag "+theOscMessage.typetag()); | |
prayAmount = theOscMessage.get(0).floatValue(); | |
surfAmount = theOscMessage.get(1).floatValue(); | |
phoneAmount = theOscMessage.get(2).floatValue(); | |
println("does it work"+prayAmount+","+surfAmount+","+phoneAmount); | |
if(prayAmount > 0.9 && prayBool == true){ | |
myMovie.jump(30); | |
prayBool = false; | |
} | |
if(prayAmount < 0.3){ | |
prayBool = true; | |
} | |
if(surfAmount > 0.9 && surfBool == true){ | |
myMovie.jump(60); | |
surfBool = false; | |
} | |
if(surfAmount < 0.3){ | |
surfBool = true; | |
} | |
if(phoneAmount > 0.9 && phoneBool ==true){ | |
myMovie.jump(135); | |
phoneBool = false; | |
} | |
if(phoneAmount < 0.3){ | |
phoneBool = true; | |
} | |
//theOscMessage.print(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment