Forum

Welcome Guest 

Show/Hide Header

Welcome Guest, posting in this forum requires registration.





Pages: [1]
Author Topic: How to use OSC
maybites
Administrator
Posts: 32
Permalink
Post How to use OSC
on: May 12, 2012, 08:19
Quote

Under the menu->File->OSC... you can find all currently available OSC-commands.

MeshWarpServer is listening on port 12987.

There is currently no tool to do remotely control MWServer - at least not out of the box. But you can fairly quickly patch up a solution for yourself:

The following code for processing illustrates it:

/**
 * Processing patch
 *
 * example shows how to start a movie in meshwarpserver.
 *
 * you need the following library installed:
 * oscP5 website at http://www.sojamo.de/oscP5
 */
 
import oscP5.*;
import netP5.*;

NetAddress myRemoteLocation;
OscP5 oscP5;

void setup() {
  size(400,400);
  frameRate(25);
  oscP5 = new OscP5(this,9000);
 
  /* myRemoteLocation is a NetAddress. a NetAddress takes 2 parameters,
   * an ip address and a port number. myRemoteLocation is used as parameter in
   * oscP5.send() when sending osc packets to another computer, device, 
   * application. usage see below. for testing purposes the listening port
   * and the port of the remote location address are the same, hence you will
   * send messages back to this sketch.
   */
  myRemoteLocation = new NetAddress("127.0.0.1",12987);
}


void draw() {
  background(0);  
}

void mousePressed() {
  /* in the following different ways of creating osc messages are shown by example */
  OscMessage myMessage = new OscMessage("/mws/movie01/start");
  
  myMessage.add(1); /* add an int to the osc message */

  /* send the message */
  oscP5.send(myMessage, myRemoteLocation); 
}

click on the window and the movie of you local meshwarpserver will start. If you wanna control something else, simply change the OscMessage String accordingly.

If you wanna control multiple instances of meshwarpserver on different machines, you need to put them into the same LAN. Then you can use the Routers Broadcast IP (which is usually 192.168.1.255 - but that depends how the router is configured).

You have to change the following line:

  myRemoteLocation = new NetAddress("192.168.1.255",12987);

If you happen do make a more sophisticated one please let me know!

cheers

Craig
Newbie
Posts: 4
Permalink
Post Re: How to use OSC
on: September 20, 2013, 09:18
Quote

I tried the above to trigger MWS over a network on multiple machines.
Worked fine.
Making MWS an even more powerful tool.
Now... Any tips for keeping the movies synced?
I am guessing you use the '/mws/movie01/frame' command, but how do yo extract the frame info from the movie being played?

(Speak slowly...I have never used 'Precessing' before. 🙂

maybites
Administrator
Posts: 32
Permalink
Post Re: How to use OSC
on: September 20, 2013, 15:59
Quote

MWS - Osc- abilities are very simple: it is slave only, so it is not possible to set one as a master and slave the rest.

But fortunately your problem should be easy:

Assuming your movie(s) is rendered with 25fps, then you have to adapt the above code that when it starts, it also starts a frame-counter and sends the number to the /mws/movie01/frame address.

Since your processing patch is already set on 25 fps, all you have to do is to create

int frameCounter;

a new function like:

void sendFrameCounter(){
  OscMessage myMessage = new OscMessage("/mws/movie01/frame");
  
  myMessage.add(frameCounter++); /* add an int to the osc message */

  /* send the message */
  oscP5.send(myMessage, myRemoteLocation); 
}

and inside the draw() function a call like:

sendFrameCounter();

that should do it, so the movie starts with the start of the processing patch and keeps on running until patch is stopped. or the maximum integer number has been reached, but that would take some time 🙂

Pages: [1]
Mingle Forum by cartpauj
Version: 1.0.34 ; Page loaded in: 0.051 seconds.