2013年6月15日 星期六

MAX/MSP ﹣ external java , example , 2 input to 2 output

set the java file to : /Applications/Max6/Cycling '74/java/classes






=======================

the context of B1.java

=======================
import com.cycling74.max.*;

public class B1 extends MaxObject
{

    private static final String[] INLET_ASSIST = new String[]{
        "inlet 1 help"
    };
    private static final String[] OUTLET_ASSIST = new String[]{
        "outlet 1 help"
    };
   
    public B1(Atom[] args)
    {
        declareInlets(new int[]{DataTypes.INT,DataTypes.INT});         //2 input
        declareOutlets(new int[]{DataTypes.INT,DataTypes.INT});         //2 input
       
        setInletAssist(INLET_ASSIST);
        setOutletAssist(OUTLET_ASSIST);

    }
   
    public void bang()
    {
    }
   
    public void inlet(int i)
    {
        int inletNo=getInlet();      //get the number from which input

        if( inletNo==0){           // from first input
            outlet(0,i);               // output to the first output
        }
        else{                         //from second input
            outlet(1,i);             //output to the second output
        }
    }
   
    public void inlet(float f)
    {
    }
   
   
    public void list(Atom[] list)
    {
    }
   
}


沒有留言:

張貼留言