Overdrive, messages and mxj Objects (plus OSC)

    Jul 15 2006 | 6:54 pm
    I have a script which only seems to work properly when overdrive is on:
    It gets a list of four ints which are used to pull keys from an array. The keys are used to access attributes of the array and from those to do the following:
    -- import a still image to a jit.matrix and copy it to a matrixset. -- call an mxj Java class that initializes a graphics environment -- call the Java calls to create a 480 x 480 image based on simple geometry and output it to a jit.matrix -- copy the image from matrix to a matrixset
    Here is the function:
    function igselect() {
      var args = arrayfromargs(arguments);
      post("igdata: " + ig_data +"nargs: "+ args +"n");
      // igdata: aida1,angel2,catherine3,claire4,dennis5,dori6,ed7,elena8 ...
      // args: 3,20,11,4
      for ( var i = 0; i < args.length; i++ ) {
        var igName = ig_data[args[i]];
        var igRecord = ig_data[igName];
        post( "loading " + igRecord.facename );
        messnamed("picset", "index", i );
        messnamed("pic", "importmovie", igRecord.facename);
        messnamed("picset", "jit_matrix", "picbuf" );
        // call Java class to set up graphics (low impact call)
        messnamed("ignogame", 0, igRecord.cards);
        var offset = i * 4;
        for ( var j = 0; j < 4; j++ ) {
          messnamed("shadowset", "index", offset + j);
          // call Java class to create a 480 x 480 image
          // and output it to jit.matrix maskbuf
          messnamed("ignogame", 1, "colormask", j + 1);
          // copy the matrix to a matrixset
          messnamed("shadowset", "jit_matrix", "maskbuf");
    Everything works when I have overdrive on. It fails with overdrive off. The graphics generation is Java is intensive enough to cause a brief hiccup. It is triggered by a bang, and so should be in the low priority queue (when overdrive is on, of course). I have run the bang through a deferlow in some tests, which smooths out the timing a little.
    I wonder if JS commands are executing before files and jit.matrices get loaded--that would be my guess about what is going on with overdrive off. But that would seem to imply that there could be separate execution threads for JS and for Max messages. With overdrive on, I would guess that the jit.matrix commands get handled in the high priority queue, and so do execute before the next JS message is hammered out.
    ISTR that it was working with overdrive off when I had the loop unrolled, but that may just be the result of too many late nights.
    For this project, I expect to use OSC. OSC has given me real problems with overdrive on--as I think is documented by many people on the list. I haven't heard of those problems being solved, so I am at some pains to solve this.
    I could move everything over to Java, but messaging seems a little easier in JS--and time does matter. and I am not sure that would solve anything. Sending the jit.matrix objects out from the mxj with outletHigh would only matter if overdrive is on. In any case, loading these graphics is not a high priority--they can show up when they are ready.
    Any ideas, maestros y maestras?
    -- Paul
    -- ----- |(*,+,#,=)(#,=,*,+)(=,#,+,*)(+,*,=,#)| ----- -