CLASS_NOBOX and CLASS_BOX


    Jan 29 2019 | 4:53 pm
    is there an official way to do make an object that both works as a patcher object and a JS object? I tried making two separate classes and registering them but it doesn't work.
    (yes I remembered the js extension)

    • Jan 30 2019 | 3:43 am
      I believe I have solved the problem.
      1) make two separate classes in ext_main() like so t_class *jsmyclass = class_new("jsmyclass",yada yada); class_addmethod(jsmyclass,method stuff); jsmyclass->c_flags = CLASS_FLAG_POLYGLOT ; class_register(CLASS_NOBOX,jsmyclass); t_class *myclass = class_new("myclass",yada,yada); class_addmethod(myclass,method stuff); class_register(CLASS_BOX,myclass);
      2) important: make sure that the mxo file is named jsmyclass,mxo. This seems to be key
      3)add the appropriate file to jsextentions folder: maxclasswrap("jsmyclass" , "myclass"); This should allow you to load myclass as a max object and a jsobject.
    • Jan 30 2019 | 2:13 pm
      I guess this thread is turning into a blog but anyway I found something amazing. You can return t_objects from C into javascript meaning that you can (potentially) have access to a full C object hierarchy in Javascript. you just use atom_setobj.
      The thing I love about this approach is that you get all the benefits of quickly coding in js but you can access the data outside javascript in a high priority fashion. (through the conduit method described in the SDK).