17 #include "TTClassWrapperMax.h"
21 t_object* jamoma_new(t_symbol *s,
long argc, t_atom* argv);
22 t_object* wrappedClass_new(t_symbol *name,
long argc, t_atom* argv);
26 static t_class* s_jamoma_class;
27 static t_hashtab* s_jamoma_class_hash = NULL;
35 s_jamoma_class = class_new(
"j~", (method)jamoma_new, (method)wrappedClass_free,
sizeof(WrappedInstance), (method)0L, A_GIMME, 0);
36 class_register(CLASS_BOX, s_jamoma_class);
38 common_symbols_init();
48 t_object* jamoma_new(t_symbol *s,
long argc, t_atom* argv)
50 int attrstart = attr_args_offset(argc, argv);
53 t_symbol *className = gensym(
"gain");
54 WrappedClassPtr classWrapper = NULL;
55 char maxClassName[256];
58 error(
"must specify a jamoma class as the first argument");
62 if (atom_gettype(argv+i) == A_LONG)
63 channelCount = atom_getlong(argv+i);
64 else if (atom_gettype(argv+i) == A_SYM)
65 className = atom_getsym(argv+i);
69 snprintf(maxClassName, 256,
"j.%s~", className->s_name);
71 if (!s_jamoma_class_hash)
72 s_jamoma_class_hash = hashtab_new(0);
73 hashtab_lookup(s_jamoma_class_hash, className, (t_object**)&classWrapper);
76 wrapTTClassAsMaxClass(className->s_name, maxClassName, &classWrapper);
77 hashtab_store(s_jamoma_class_hash, className, (t_object*)(classWrapper));
80 return wrappedClass_new(gensym(maxClassName), argc-1, argv+1);
WrappedInstance * WrappedInstancePtr
Pointer to a wrapped instance of our object.
int C74_EXPORT main(void)
Set up this class as a Max external the first time an object of this kind is instantiated.
void TTDSP_EXPORT TTDSPInit(const char *pathToBinaries=NULL)
Initialise the Jamoma DSP library, as well as Jamoma Foundation foundation if needed.