Home > code, jitter > Processing to Jitter

Processing to Jitter

Some weeks ago I posted a small template to start porting processing into jitter. Technically is not that complex but requires a ‘switch’ in the way of thinking how the code should be organized.

In order to compile you can use the javac command on your terminal(don’t forget to link the max and jitter jars with -classpath) or an IDE like eclipse(which BTW is very cool!)

Here is the small template. I will upload it on my website and then post the link here.

public class PJTemplate extends MaxObject{
Random rr;
//matrix to draw
JitterMatrix jjm;

//constructor
public PJTemplate(){
declareIO(1,1);
jjm=new JitterMatrix(“ana”,1,”char”,10,10);
this.rr=new Random();
}

//messages
public void hello(){
post(“i like java and jitter”);
}

//when you get a bang from the max patcher…
public void bang(){
this.vectorial();
outlet(0,”jit_matrix”,jjm.getName());
}

//a simple method to draw geometries
private void vectorial(){
for(int i=0;i<10;i++){
for(int j=0;j<10;j++){
jjm.setcell(new int[]{i,j},0,this.rr.nextInt(254));
}
}
}
}

the max patch:

———-begin_max5_patcher———-

444.3ocyTsrTBCCEcc6WQmrtxPBsEvct0UtvcNNNosQHXaRGR5.JC+6lWUDk

BEPbXQSm68lGmy4dRV46AR4KIBPvsAOE34sx2yyjRmvyE6AJwKyJvByz.ynx

duVIlTSAgtx7bhtTjKtBKylRYSdYNISZ25DTu9gAvwiz+F0WONPkJ3Y2RX0k

TVAQZNBnK4qblTP+vr2iUKwlklafAOc1MwfMKmWKaVOxk0lR9dEwBB.HT880

Yp2dFtzTDb2bJt.nKr12WODdDxQ0BJKmu.zN+gCizbFgL5.BZkiQCOjD7MxF

cZj8DoTFonHsfm81dH0fww1tZhseNzxsn1HEpq8UztoZTaTsfJjF5FdY5wkD

g.OgzfJIYoQA.SUhDeOBDx5zgnwNCerJH9rkmjcKOvVcB+wxQZsTxY6ysacD

1K8IIMic1pO3HIXJlM4zr5LxB0A9qFa4xYAOb+ijxpBrjbXlBSLde6kb3vy9

gM3E7gMyzTWYX+7YeC8z42VuD754YMGjCbAaHXNQHoLrjpbDalSzVyYJMOmX

J2v0RZdEmxjNHzRuqqHJoCHB9uhnAWcHpKcMzUGhhOCDoBV6+IvJchPS

———–end_max5_patcher———–

BTW: wordpress is quite annoying when it comes to post code or load files. I will be migrating my blog to somewhere else in the near future.

Advertisements
Categories: code, jitter
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: