PackPtr PackNew(SymbolPtr msg, AtomCount argc, AtomPtr argv) { PackPtr self; TTValue v; TTErr err; self = PackPtr(object_alloc(sPackClass)); if (self) { object_obex_store((void*)self, _sym_dumpout, (ObjectPtr)outlet_new(self, NULL)); self->graphOutlets[0] = outlet_new(self, "graph.connect"); v.setSize(2); v.set(0, TT("graph.input")); v.set(1, TTUInt32(1)); err = TTObjectInstantiate(TT("graph.object"), (TTObjectPtr*)&self->graphObject, v); ((TTGraphInput*)self->graphObject->mKernel)->setOwner(self->graphObject); if (!self->graphObject->mKernel) { object_error(SELF, "cannot load Jamoma object"); return NULL; } self->graphDictionary = new TTDictionary; self->graphDictionary->setSchema(TT("none")); self->graphDictionary->append(TT("outlet"), 0); attr_args_process(self, argc, argv); self->qelem = qelem_new(self, (method)PackQFn); // PackStartTracking(self); defer_low(self, (method)PackStartTracking, NULL, 0, NULL); } return self; }
PackPtr PackNew(t_symbol* msg, long argc, t_atom* argv) { PackPtr self; TTValue v; TTErr err; self = PackPtr(object_alloc(sPackClass)); if (self) { object_obex_store((void*)self, _sym_dumpout, (t_object*)outlet_new(self, NULL)); self->graphOutlets[0] = outlet_new(self, "graph.connect"); v.resize(2); v[0] = "graph.input"; v[1] = 1; err = TTObjectBaseInstantiate(TT("graph.object"), (TTObjectBasePtr*)&self->graphObject, v); ((TTGraphInput*)self->graphObject->mKernel.instance())->setOwner(self->graphObject); if (!self->graphObject->mKernel.valid()) { object_error(SELF, "cannot load Jamoma object"); return NULL; } self->graphDictionary = new TTDictionary; self->graphDictionary->setSchema(TT("none")); self->graphDictionary->append(TT("outlet"), 0); attr_args_process(self, argc, argv); self->qelem = qelem_new(self, (method)PackQFn); // PackStartTracking(self); defer_low(self, (method)PackStartTracking, NULL, 0, NULL); } return self; }
PackPtr PackNew(SymbolPtr msg, AtomCount argc, AtomPtr argv) { PackPtr self; TTValue sr(sys_getsr()); long attrstart = attr_args_offset(argc, argv); TTValue v; TTErr err; self =PackPtr(object_alloc(sInClass)); if (self) { self->maxNumChannels = 2; if (attrstart && argv) self->maxNumChannels = atom_getlong(argv); ttEnvironment->setAttributeValue(kTTSym_sampleRate, sr); v.setSize(3); v.set(0, TT("audio.generator")); v.set(1, 0); // no audio graph inlets (only msp inlets) v.set(2, 1); // one audio graph outlet err = TTObjectBaseInstantiate(TT("audio.object"), (TTObjectBasePtr*)&self->audioGraphObject, v); self->audioGraphObject->addAudioFlag(kTTAudioGraphGenerator); if (!self->audioGraphObject->getUnitGenerator()) { object_error(SELF, "cannot load audio.generator"); return NULL; } attr_args_process(self, argc, argv); object_obex_store((void*)self, _sym_dumpout, (object*)outlet_new(self,NULL)); self->audioGraphObjectOutlet = outlet_new((t_pxobject*)self, "audio.connect"); dsp_setup((t_pxobject*)self, self->maxNumChannels); self->obj.z_misc = Z_NO_INPLACE | Z_PUT_FIRST; } return self; }