mxjのテスト
自分用メモ
スゴい今更ながらmxj試したかったので勉強してる。道具がひとつ増えてく感いいなー
bangメッセージ送ると、つながってるjit.gl.pathオブジェクトにpathアトリビュートの数だけ適当にパス書いてくれるプログラム。
以下mxj
import com.cycling74.max.*;
public class test2 extends MaxObject
{
public int path=15;
private static final String INLET_ASSIST = new String{
"inlet 1 help"
};
private static final String OUTLET_ASSIST = new String{
"outlet 1 help"
};
public test2(Atom args)
{
declareInlets(new int{DataTypes.ALL});
declareOutlets(new int{DataTypes.ALL});
setInletAssist(INLET_ASSIST);
setOutletAssist(OUTLET_ASSIST);
declareAttribute("path");
}
public void bang()
{
double a = 0.0001;
double mat = new double[3];
int i =3;
int qwe=0;
double posef;
double scale;
// fase1
for( qwe =0; qwe
mat[i]=noise;
}
outlet(0,"append",mat);
// fase2
outletBang(0);
//fase3
if(qwe==0 || qwe== path-1){
posef=0.01;
}else{
double decide = Math.random();
if(decide>0.5){
posef=1.3;
}else{
posef=0.2;
}
}
//fase 4
double rnd = (Math.random()*3.0)+0.1;
scale=rnd*posef;
outlet(0,"addscale",scale);
}
}// void bang end
public void inlet(int i)
{
}
public void inlet(float f)
{
}
public void list(Atom[] list)
{
}
}
*1:Math.random(