mxj send and receive

    Mar 31 2010 | 7:36 pm
    Hi, I would need to pass huges String[][] from a mxj object to graphic and midi max objects. I am wondering if is possible to pass a LinkedList or a String[][] directly from the mxj object that produce it (sender) to others mxj objects in the patch (receivers) without using max send and receive (or Multisend), since I would need to break the String[][] in several String[], right?
    I tried to put my String[][] into a simple static "bucket" like this... ================ public class StaticDataBucket { private static String[] staticArray;
    public static synchronized void putStatic(String[] sa) { staticArray = sa; }
    public static synchronized String[] getStatic() { return staticArray; }
    } =========== and use its getStatic() in the receiver to read the array, but it doesn't work... It seems that the two instance of the StaticDataBucket do not refer the same object. I was looking for a mxj buffer for objects/Atoms instead of floats... Any suggestions...?

    • Mar 31 2010 | 7:42 pm
      ops... the StaticDataBucket I post it is for String[], but the problems remains for String[][] as well... Fabio
    • Apr 01 2010 | 10:46 am
      Hello Fabio,
      It works for me, see example below.
    • Apr 06 2010 | 8:26 am
      Hi Léo, thank you. I think I might have now understood the problem. In the enclosed example I made two object: a StaticProducer and (two instance of) a Static Receiver. They both refer to MyStaticVar. In order to update the changes I made in the code (with Eclipse) I usually clear the patch and than I recover it using cmd-z. If you do you so after a change in StaticProducer or MyStaticVar there is no problem. On the other hand, if you do you make any change in Static Receiver, and even if you close and re-open the patch, the Static Receiver will be null! If you close and re-open Max... it works! Am I missing something? Fabio
    • Apr 06 2010 | 10:51 am
      Hi Fabio,
      From what I understood from the mxj process, when you clear a MaxObject and reinstantiate it, Max will look for the latest .class of that MaxObject. Other classes like MyStaticVar are not freed when an object that calls it is destroyed, so when this object is reinstantiated with undo for example, it will look for the MyStaticVar that is already in the JVM, not the latest one your recompiled.
      (Hope that's clear ... and right)
      So, changing MyStaticVar code hasn't got any effect as it won't be reloaded until next jvm start (next max start) but that's logical given the explanation above.
      But in your example, there's something I don't fully understand. Indeed, changing the StaticReceiver code, compiling and reinstantiating it, seems to make it blind to the MyStaticVar already loaded in the jvm. What's surprises me most is that changing the StaticProducer code doesn't produce the same, it is still able to modify and get MyStaticVar.
      Can someone from Cycling explains this ?