void WrappedInputClass_new(TTPtr self, AtomCount argc, AtomPtr argv) { WrappedModularInstancePtr x = (WrappedModularInstancePtr)self; long attrstart = attr_args_offset(argc, argv); // support normal arguments TTString sInstance; TTValue v; // Prepare extra data x->extra = (t_extra*)malloc(sizeof(t_extra)); // Get input instance symbol if (attrstart && argv) { jamoma_ttvalue_from_Atom(v, _sym_nothing, attrstart, argv); v.toString(); sInstance = TTString(v[0]); EXTRA->instance = TTSymbol(sInstance.data()); } else EXTRA->instance = kTTSymEmpty; // Create Input Object and one outlet x->outlets = (TTHandle)sysmem_newptr(sizeof(TTPtr)); #ifdef JCOM_IN_TILDE jamoma_input_create_audio((ObjectPtr)x, &x->wrappedObject); dsp_setup((t_pxobject *)x, 1); x->obj.z_misc = Z_NO_INPLACE | Z_PUT_FIRST; outlet_new((t_pxobject *)x, "signal"); // Prepare memory to store internal datas x->internals = new TTHash(); // Prepare extra data for envelope tracking EXTRA->clock = NULL; EXTRA->pollInterval = 0; // not active by default EXTRA->meter = 0.; EXTRA->peak = 0.; #else jamoma_input_create((ObjectPtr)x, &x->wrappedObject); x->outlets[0] = outlet_new(x, 0L); #endif // handle attribute args attr_args_process(x, argc, argv); // The following must be deferred because we have to interrogate our box, // and our box is not yet valid until we have finished instantiating the object. // Trying to use a loadbang method instead is also not fully successful (as of Max 5.0.6) defer_low((ObjectPtr)x, (method)in_subscribe, NULL, 0, NULL); }
void WrappedInputClass_new(TTPtr self, long argc, t_atom *argv) { WrappedModularInstancePtr x = (WrappedModularInstancePtr)self; long attrstart = attr_args_offset(argc, argv); // support normal arguments TTString sInstance; TTValue v; // Prepare extra data x->extra = (t_extra*)malloc(sizeof(t_extra)); // Get input instance symbol if (attrstart && argv) { jamoma_ttvalue_from_Atom(v, _sym_nothing, attrstart, argv); v.toString(); sInstance = TTString(v[0]); EXTRA->instance = TTSymbol(sInstance.data()); } else EXTRA->instance = kTTSymEmpty; // set no model or view by default EXTRA->modelOrView = NULL; // Create Input Object and one outlet x->outlets = (TTHandle)sysmem_newptr(sizeof(TTPtr)); #ifdef J_IN_TILDE jamoma_input_create_audio((t_object*)x, x->wrappedObject); dsp_setup((t_pxobject *)x, 1); x->obj.z_misc = Z_NO_INPLACE | Z_PUT_FIRST; outlet_new((t_pxobject *)x, "signal"); #endif #ifdef J_IN_MULTI jamoma_input_create_audio((t_object*)x, x->wrappedObject); x->outlets[0] = outlet_new(x, 0L); #endif #ifndef J_IN_TILDE #ifndef J_IN_MULTI jamoma_input_create((t_object*)x, x->wrappedObject); x->outlets[0] = outlet_new((t_object*)x, 0L); #endif #endif // handle attribute args attr_args_process(x, argc, argv); // The following must be deferred because we have to interrogate our box, // and our box is not yet valid until we have finished instantiating the object. // Trying to use a loadbang method instead is also not fully successful (as of Max 5.0.6) // in_subscribe(x); // defer_low((t_object*)x, (method)in_subscribe, NULL, 0, NULL); }