Forums > Java

matrix to message object in mxj

November 18, 2010 | 6:13 pm

Hi everyone!
quick (and hopefully simple-to-answer) question…

I would like to use a jitter object within my mxj code that doesn’t return a matrix, but does analysis and spits out numbers. Specifically, I want to use jit.findbounds, which spits out two pairs of numbers for the min and max bounding vertices. How can I get a hold of these numbers in Java code? do I still use the matrixcalc() method, or is there something else? (i.e. a message to call/send)

I’ve tried setting the second argument of matrixcalc() to being both a String (no result) and an Atom[] (compile error), in case it returned data that way. Nope.

Any suggestions appreciated…
Dan


November 18, 2010 | 6:43 pm

If I remember correctly jit.findbounds is not available in Java.


January 2, 2011 | 2:46 am

Hi
maybe it’s a bit late now:) but it works for me with the output argument to matrixcalc() as null:

import com.cycling74.jitter.*;
import com.cycling74.max.*;

public class myfb extends MaxObject {
   private JitterObject fb;

   public myfb() {
      declareInlets(new int[] {DataTypes.MESSAGE});
      declareOutlets(new int[] {DataTypes.LIST, DataTypes.LIST});
      setInletAssist(0, "(matrix) in");
      setOutletAssist(new String[]{"(list) min bounds", "(list) max bounds"});
      declareAttribute("min", "getMin", "setMin");
      declareAttribute("max", "getMax", "setMax");
      fb = new JitterObject("jit.findbounds");
   }

   private Atom[] getMin() {
      return fb.getAttr("min");
   }

   private void setMin(Atom[] a) {
      fb.setAttr("min", a);
   }

   private Atom[] getMax() {
      return fb.getAttr("max");
   }

   private void setMax(Atom[] a) {
      fb.setAttr("max", a);
   }

   public void jit_matrix(String in) {
      fb.matrixcalc(in, null);
      outlet(1, fb.getAttr("boundmax"));
      outlet(0, fb.getAttr("boundmin"));
   }

   @Override
   protected void notifyDeleted() {
      fb.freePeer();
   }

}

hth!


Viewing 3 posts - 1 through 3 (of 3 total)