wrapping bidimensional lists as a pointer for multi-dimensional arrays

    Jul 19 2011 | 11:30 am
    hi everyone.. I am writing a small script for an mxj object to create universal ccs or something like that (if anyone has even created it, but I guess not)
    so, here is the code I am working on.. I am pretty kinda noob with java in max, meaning that I only did a couple of simple programs.
    so my first question is:
    after receiving the list, how do I wrapp it into a multi-dimensional array as a pointer for the index?
    it's a noob question, but I really need your help
    if someone wants to work on this collaboratively and share authory please, say something
    tiago morgado
    /* cc input receives a list with two integers (cc number cc channel)
    there is a bidimensional matrix of 127*16
    this matrix stores all the values of the ccs
    when a index is received it iterates between ((0-1)*127) stores the number in the index
    and outputs a list to send for a midi format or ctlout with cc value cc number and cc channel
    import com.cycling74.max.*;
    public class midionoff extends MaxObject {
    private int[][] ccmidionoffout = new int[127][16]; // cc number, cc channel
    private List storage = new ArrayList()
    private int inletNUM = 1;
    private int outletNUM = 1;
    public midionoff() {
    declareInlets(new int[]{DataTypes.INT,DataTypes.INT});
    declareOutlets(new int[]{DataTypes.INT,DataTypes.INT});
    int inletCOUNT[]=new int[inletNUM];
    for(int i=0;i declareInlets(inletCOUNT); //declara de novo "k" outlets
    int outletCOUNT[]=new int[outletsNUM];
    for(int i=0;i declareOutlets(outletCOUNT);
    public onoff() {
    public inputstatus(){
    if(getInlet() == 0){;}
    public setmessage() {}
    public outmessage(){}

    • Jul 21 2011 | 2:37 pm
      Check out the Collections tutorial in the Java docs; it will make your life so much easier.
      You could implement this using the Map interface. Something along the lines of:
      Map> map = new TreeMap>();
      (TreeMap will maintain a sorted hash by key)
      First level of map is for the channel, second is for the CC and value. Stay away from matrices in Java if at all possible; the Collections are much, much easier to work with and decently optimized.