Help with Triggering clips using OSC and Processing
Posted: Thu Jan 26, 2012 14:49
Hi all,
I need some help on triggering clips in Resolume. I’m using Processing and a Kinect, and communicating via OSC. Everything is talking to each other and working really well, but I can’t quite work out the code in Processing for getting the clips to continue playing in Resolume after they’ve been triggered. I can trigger the clip no worries, but the problem I have is that the clip continues to trigger, and so begins stuttering and going back to frame 1 and playing over and over. I seem to be sending the same message every frame.
Basically, I am checking how much motion is in each frame, and if it is above a certain level, then telling Resolume to connect a clip and play, while still checking for motion.
My coding is pretty primitive, and I just can’t work out what strategy to take!! I want to test for motion, then use that variable to trigger, and somehow hold that variable constant for the duration of the clip, then test for motion again. I’ve tried timers, which sort of work, I’ve used a while loop, which sort of works.....
If this makes sense, then any suggestions would be enormously appreciated.
Here is an example:
connect = 1;
playmode = 3;
play = 1;
if (motion>110) {
myMessage.setAddrPattern("/layer1/clip1/connect");
myMessage.add(connect);
myBundle.add(myMessage);
myMessage.clear();
myMessage.setAddrPattern("/layer1/clip1/video/position/playmode");
myMessage.add(playmode);
myBundle.add(myMessage);
myMessage.clear();
myMessage.setAddrPattern("/layer1/clip1/video/position/direction");
myMessage.add(play);
myBundle.add(myMessage);
myMessage.clear();
oscP5.send(myBundle, myRemoteLocation);
myBundle.clear();
while (layer1Position < 0.9) {
motion=0;
}
}
Cheers,
Chris
I need some help on triggering clips in Resolume. I’m using Processing and a Kinect, and communicating via OSC. Everything is talking to each other and working really well, but I can’t quite work out the code in Processing for getting the clips to continue playing in Resolume after they’ve been triggered. I can trigger the clip no worries, but the problem I have is that the clip continues to trigger, and so begins stuttering and going back to frame 1 and playing over and over. I seem to be sending the same message every frame.
Basically, I am checking how much motion is in each frame, and if it is above a certain level, then telling Resolume to connect a clip and play, while still checking for motion.
My coding is pretty primitive, and I just can’t work out what strategy to take!! I want to test for motion, then use that variable to trigger, and somehow hold that variable constant for the duration of the clip, then test for motion again. I’ve tried timers, which sort of work, I’ve used a while loop, which sort of works.....
If this makes sense, then any suggestions would be enormously appreciated.
Here is an example:
connect = 1;
playmode = 3;
play = 1;
if (motion>110) {
myMessage.setAddrPattern("/layer1/clip1/connect");
myMessage.add(connect);
myBundle.add(myMessage);
myMessage.clear();
myMessage.setAddrPattern("/layer1/clip1/video/position/playmode");
myMessage.add(playmode);
myBundle.add(myMessage);
myMessage.clear();
myMessage.setAddrPattern("/layer1/clip1/video/position/direction");
myMessage.add(play);
myBundle.add(myMessage);
myMessage.clear();
oscP5.send(myBundle, myRemoteLocation);
myBundle.clear();
while (layer1Position < 0.9) {
motion=0;
}
}
Cheers,
Chris