29 common_symbols_init();
31 c = class_new(
"j.pack=", (method)
PackNew, (method)
PackFree,
sizeof(
Pack), (method)0L, A_GIMME, 0);
33 class_addmethod(c, (method)
PackReset,
"audio.reset", A_CANT, 0);
34 class_addmethod(c, (method)
PackSetup,
"audio.setup", A_CANT, 0);
37 class_addmethod(c, (method)
PackDsp64,
"dsp64", A_CANT, 0);
38 class_addmethod(c, (method)
PackAssist,
"assist", A_CANT, 0);
39 class_addmethod(c, (method)object_obex_dumpout,
"dumpout", A_CANT, 0);
42 class_register(_sym_box, c);
55 long attrstart = attr_args_offset(argc, argv);
59 self =
PackPtr(object_alloc(sInClass));
61 self->maxNumChannels = 2;
62 if (attrstart && argv)
63 self->maxNumChannels = atom_getlong(argv);
70 v[0] =
"audio.generator";
76 if (!self->audioGraphObject->getUnitGenerator().valid()) {
77 object_error(SELF,
"cannot load audio.generator");
81 attr_args_process(
self, argc, argv);
84 object_obex_store((
void*)
self, _sym_dumpout, (
object*)outlet_new(
self,NULL));
87 self->audioGraphObjectOutlet = outlet_new((t_pxobject*)
self,
"audio.connect");
90 dsp_setup((t_pxobject*)
self, self->maxNumChannels);
93 self->obj.z_misc = Z_NO_INPLACE | Z_PUT_FIRST;
101 dsp_free((t_pxobject*)
self);
114 if (arg > 0) { snprintf(dst, 256,
"(signal) single-channel input Nr. %ld", arg + 1); }
115 else { strcpy(dst,
"control messages and (signal) single-channel input Nr. 1");}
118 strcpy(dst,
"multichannel output");
120 strcpy(dst,
"dumpout");
127 return self->audioGraphObject->resetAudio();
135 atom_setobj(a+0, (t_object*)(self->audioGraphObject));
136 atom_setlong(a+1, 0);
137 outlet_anything(self->audioGraphObjectOutlet, gensym(
"audio.connect"), 2, a);
142 void PackPerform64(
PackPtr self, t_object* dsp64,
double **ins,
long numins,
double **outs,
long numouts,
long sampleframes,
long flags,
void *userparam)
144 for (
TTUInt32 i=0; i <
self->numChannels; i++)
145 TTAudioGraphGeneratorPtr(self->audioGraphObject->getUnitGenerator().instance())->mBuffer->setVector64Copy(i, self->vectorSize, ins[i]);
149 void PackDsp64(
PackPtr self, t_object* dsp64,
short *count,
double samplerate,
long maxvectorsize,
long flags)
151 self->vectorSize = maxvectorsize;
169 self->numChannels =
self->maxNumChannels;
170 self->audioGraphObject->setOutputNumChannels(0, self->numChannels);
172 self->audioGraphObject->getUnitGenerator().set(kTTSym_vectorSize, self->vectorSize);
173 self->audioGraphObject->getUnitGenerator().set(kTTSym_maxNumChannels, self->maxNumChannels);
174 self->audioGraphObject->getUnitGenerator().set(kTTSym_sampleRate, samplerate);
176 object_method(dsp64, gensym(
"dsp_add64"),
self,PackPerform64, 0, NULL);
TTErr TTObjectBaseRelease(TTObjectBasePtr *anObject)
DEPRECATED.
TTFOUNDATION_EXPORT TTEnvironment * ttEnvironment
The environment object has one instance, which is global in scope.
Base class for all first-class Jamoma objects.
This object is an audio generator, and do not expect audio input.
Pack * PackPtr
Pointer to a j.pack= instance.
TTErr setAttributeValue(const TTSymbol name, TTValue &value)
Set an attribute value for an object.
pack= : Max external packing several MSP audio signals onto one AudioGraph multichannel audio signal...
#define TT
This macro is defined as a shortcut for doing a lookup in the symbol table.
void PackAssist(PackPtr self, void *b, long msg, long arg, char *dst)
Provides assist strings in Max for object inlets and outlets.
TTErr PackReset(PackPtr self, long vectorSize)
Reset audio for this object.
TTAudioGraphGenerator * TTAudioGraphGeneratorPtr
Pointer to a TTAudioGraphGenerator.
PackPtr PackNew(t_symbol *msg, long argc, t_atom *argv)
Create a new instance of the j.in= object.
TTErr TTObjectBaseInstantiate(const TTSymbol className, TTObjectBasePtr *returnedObjectPtr, const TTValue arguments)
DEPRECATED.
void PackDsp64(PackPtr self, t_object *dsp64, short *count, double samplerate, long maxvectorsize, long flags)
Called when MSP is compiling the DSP chain, used to set up audio processing.
TTErr MaxAudioGraphObject(t_object *x, TTAudioGraphObjectBasePtr *returnedAudioGraphObject)
Returns a pointer to the Jamoma Audio Graph object that is wrapped by this Max object.
TTErr
Jamoma Error Codes Enumeration of error codes that might be returned by any of the TTBlue functions a...
TTErr PackSetup(PackPtr self)
This method is used internally by AudioGraph when configuring itself.
std::uint32_t TTUInt32
32 bit unsigned integer
Data Structure for the j.pack= Max object.
TTErr MaxAudioGraphDrop(t_object *x, long inletNumber, t_object *sourceMaxObject, long sourceOutletNumber)
Method called when a connection from an upstream node is dropped.
int C74_EXPORT main(void)
Set up this class as a Max external the first time an object of this kind is instantiated.
void PackFree(PackPtr self)
Called when the object is freed (destroyed), ensuring that memory is properly freed up...
void resize(size_type n)
Change the number of elements.
[doxygenAppendixC_copyExample]