Lhex recompiling

    Feb 01 2014 | 3:15 pm
    Dear List, I need to build hex message to control my HE50SE caméra. The message is like 8 digit in hex starting from 00000000 to 7FFF7FFF (4 digit for the pan movement and 4 digit for the tilt movement) so i use Lhex from Peter Elsea Lobj collection. This object is limited to 255. In the C source code there is this sentence #define MAXSIZE 256 So is it just this number to change and then recompile it to get higher values or is there much more under the hood i don't even know that it exist?? Thank you for any help or comment. Cheers Hubert
    Lhex.cTXETEIWCˇˇˇˇW¿Që^≤fˇ¿ÅÅRè// lhex file for Max object // by Peter Elsea, University of California, Santa Cruz // copyright © 1998, Regents of the University of California // This code and the object created by it may be modified and/or // distributed by any means, provided that this copyright and notice // appear in all subsequent copies and documentation.
    #include "ext.h" #include #include "ext_common.h"
    #define MAXSIZE 256 #define ASSIST_INLET 1 #define ASSIST_OUTLET 2
    typedef struct lhex { struct object ob;
    Symbol *byteSym[256]; Atom outList[MAXSIZE]; int listsize; int oldListSize; long nextValue; int dataPending; int loHigh; int nibbleSize; int nibbleMask; int maxBytes; void *outL; Symbol *messageType; } Lhex;
    void *lhex_new(); void lhex_free(); void lhex_Lists(); void lhex_setConstant(); void lhex_floatConstant(); void lhex_anything(); void lhex_bang(); void lhex_du

    • Feb 01 2014 | 3:34 pm
      I had a quick look at the code of Lhex. From what I can see I am pretty sure that if you change the #define MAXSIZE to a higher value it ought to accept longer lists without the need of touching other parts of the code. However I wouldn't go too crazy. Use the minimum value that serves your purposes (possibly 512 or you might be able to get away even with 1024), but I wouldn't go much higher than 1024 given that memory for lists is statically allocated in the code. BTW, it's good to keep it a power of two, that's why I suggested 512 or 1024...
      Good luck
      - Luigi