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
Help with Triggering clips using OSC and Processing
Re: Help with Triggering clips using OSC and Processing
You could use OSC out from Resolume to let Processing know that the clip is finished (it should send a connect/0 when its done playing and set to play once).
But maybe just setting the play mode to 'continue' should do the trick already. That way it won't jump to the beginning when you trigger it multiple times.
But maybe just setting the play mode to 'continue' should do the trick already. That way it won't jump to the beginning when you trigger it multiple times.
-
- Posts: 14
- Joined: Sat Nov 07, 2009 22:53
Re: Help with Triggering clips using OSC and Processing
Can anyone help with guides etc for connecting a Kinect to OSC so that I can use it to trigger clips / actions in Reso?
Re: Help with Triggering clips using OSC and Processing
Thanks for that. Yes, the solution is to listen to OSC out from Resolume. Works a treat.goto10 wrote:You could use OSC out from Resolume to let Processing know that the clip is finished (it should send a connect/0 when its done playing and set to play once).
But maybe just setting the play mode to 'continue' should do the trick already. That way it won't jump to the beginning when you trigger it multiple times.
Re: Help with Triggering clips using OSC and Processing
I haven't found many good guides, but i can help you out with some code? My coding is a bit rough, but I've nmanaged to cobble this together from various online examples.vide0junki3 wrote:Can anyone help with guides etc for connecting a Kinect to OSC so that I can use it to trigger clips / actions in Reso?
In Resolume, use the OSC mapping to find the correct address. Back in Processing, I then set the relevant atributes for a clip. Be aware of either float or integer values.
// Declare the clip variables
float position = 0; //Adjust the timeline of the clip
int playmode = 0; //Range from 0-3 - Loop, bounce, clear or pause
int playmodeAway = 0; //Range from 0-1 -Start from beginning, or from where it was left
int connect = 0; //Load the clip
int play = 0; //Range from 0-3 -reverse, play, pause or random
//If value is larger than 110, then send this bundle of information to Resolume
if (motion>110) {
myMessage.setAddrPattern("/layer1/clip1/connect");
myMessage.add(connect);//Load the clip
myBundle.add(myMessage);
myMessage.clear();
myMessage.setAddrPattern("/layer1/clip1/video/position/direction");
myMessage.add(play); //reverse, play, pause or random
myBundle.add(myMessage);
myMessage.clear();
myMessage.setAddrPattern("/layer1/clip1/video/position/playmode");
myMessage.add(playmode); //Loop, bounce, clear or pause
myBundle.add(myMessage);
myMessage.clear();
myMessage.setAddrPattern("/layer1/clip1/video/position/playmodeaway");
myMessage.add(playmodeAway); //Start from beginning, or from where it was left
myBundle.add(myMessage);
myMessage.clear();
myMessage.setAddrPattern("/layer1/clip1/video/position/values");
myMessage.add(position); //Adjust the timeline of the clip
myBundle.add(myMessage);
myMessage.clear();
oscP5.send(myBundle, myRemoteLocation);
myBundle.clear();
}
Re: Help with Triggering clips using OSC and Processing
This is what i used to listen to Resolume via OSC:
void oscEvent(OscMessage theOscMessage) {
if(theOscMessage.checkAddrPattern("/layer1/video/position/values") == true) {
layer1Position = theOscMessage.get(0).floatValue();
}
if(theOscMessage.checkAddrPattern("/layer2/video/position/values") == true) {
layer2Position = theOscMessage.get(0).floatValue();
}
}
void oscEvent(OscMessage theOscMessage) {
if(theOscMessage.checkAddrPattern("/layer1/video/position/values") == true) {
layer1Position = theOscMessage.get(0).floatValue();
}
if(theOscMessage.checkAddrPattern("/layer2/video/position/values") == true) {
layer2Position = theOscMessage.get(0).floatValue();
}
}