Jamoma API  0.6.0.a19
Max/source/j.receive/j.receive.cpp
Go to the documentation of this file.
1 /** @file
2  *
3  * @ingroup implementationMaxExternals
4  *
5  * @brief j.receive / j.receive~ : Receive messages and audio through remote communication
6  *
7  * @details
8  *
9  * @authors Théo de la Hogue, Trond Lossius
10  *
11  * @copyright © 2011 by Théo de la Hogue @n
12  * This code is licensed under the terms of the "New BSD License" @n
13  * http://creativecommons.org/licenses/BSD/
14  */
15 
16 
18 
19 #define data_out 0
20 #define address_out 1
21 #define dump_out 2
22 
23 // Definitions
24 
25 /** Wrap the j.receive class as a Max object.
26  @param c The class to be wrapped
27  @see WrappedReceiverClass_new, WrappedReceiverClass_free
28  */
29 void WrapTTReceiverClass(WrappedClassPtr c);
30 
31 /** Wrapper for the j.receive constructor class, called when an instance is created.
32  @param self Pointer to this object.
33  @param argc The number of arguments passed to the object.
34  @param argv Pointer to an array of atoms passed to the object.
35  @see WrappedReceiverClass_free, receive_subscribe
36  */
37 void WrappedReceiverClass_new(TTPtr self, long argc, t_atom *argv);
38 
39 /** Wrapper for the j.receive deconstructor class, called when an instance is destroyed.
40  @param self Pointer to this object.
41  @see WrappedReceiverClass_new
42  */
44 
45 /** Assistance Method.
46  @param self Pointer to this object.
47  @param b Pointer to (exactly what?)
48  @param msg The message passed to the object.
49  @param arg
50  @param dst Pointer to the destination that assistance strings are passed to for display.
51  */
52 void receive_assist(TTPtr self, void *b, long msg, long arg, char *dst);
53 
54 /** Associate j.receive(~) with NodeLib. This is a prerequisit for communication with other Jamoma object in the module and beyond. */
55 void receive_subscribe(TTPtr self);
56 
57 void receive_return_model_address(TTPtr self, t_symbol *msg, long argc, t_atom *argv);
58 
59 #ifdef JCOM_RECEIVE_TILDE
60 
61 /** j.receive~ 32-bit MSP perform method (for Max 5). Only defined for j.receive~. */
62 t_int* receive_perform(t_int *w);
63 
64 /** j.receive~ 32-bit DSP method (for Max 5).Only defined for j.receive~. */
65 void receive_dsp(TTPtr self, t_signal **sp, short *count);
66 
67 /** j.receive~ 64-bit MSP perform method (for Max 6). Only defined for j.receive~. */
68 void receive_perform64(TTPtr self, t_object *dsp64, double **ins, long numins, double **outs, long numouts, long sampleframes, long flags, void *userparam);
69 
70 /** j.receive~ 64-bit DSP method (for Max 6). Only defined for j.receive~. */
71 void receive_dsp64(TTPtr self, t_object *dsp64, short *count, double samplerate, long maxvectorsize, long flags);
72 
73 #else
74 
75 void receive_return_address(TTPtr self, t_symbol *msg, long argc, t_atom *argv);
76 void receive_return_value(TTPtr self, t_symbol *msg, long argc, t_atom *argv);
77 
78 /** bang handler for j.receive
79  @param self Pointer to this object
80  @see receive_int, receive_float, receive_list, WrappedOutputClass_anything
81  */
82 void receive_bang(TTPtr self);
83 #endif
84 
85 /** address message handler for j.receive. To change the address to bind.
86  @param self Pointer to this object
87  @param address The address to bind
88  @see receive_subscribe
89  */
90 void receive_address(TTPtr self, t_symbol *address);
91 
92 #pragma mark -
93 #pragma mark main
94 
95 int C74_EXPORT main(void)
96 {
97  ModularSpec *spec = new ModularSpec;
98  spec->_wrap = &WrapTTReceiverClass;
99  spec->_new = &WrappedReceiverClass_new;
100  spec->_free = &WrappedReceiverClass_free;
101  spec->_any = NULL;
102 
103 #ifdef JCOM_RECEIVE_TILDE
104  return wrapTTModularClassAsMaxClass(kTTSym_Receiver, "j.receive~", NULL, spec);
105 #else
106  return wrapTTModularClassAsMaxClass(kTTSym_Receiver, "j.receive", NULL, spec);
107 #endif
108 
109 }
110 
111 void WrapTTReceiverClass(WrappedClassPtr c)
112 {
113  class_addmethod(c->maxClass, (method)receive_assist, "assist", A_CANT, 0L);
114 
115  class_addmethod(c->maxClass, (method)receive_return_model_address, "return_model_address", A_CANT, 0);
116 
117 #ifdef JCOM_RECEIVE_TILDE
118  class_addmethod(c->maxClass, (method)receive_dsp, "dsp", A_GIMME, 0);
119  class_addmethod(c->maxClass, (method)receive_dsp64, "dsp64", A_CANT, 0);
120 #else
121  class_addmethod(c->maxClass, (method)receive_return_address, "return_address", A_CANT, 0);
122  class_addmethod(c->maxClass, (method)receive_return_value, "return_value", A_CANT, 0);
123 
124  class_addmethod(c->maxClass, (method)receive_bang, "bang", 0);
125 #endif
126 
127  class_addmethod(c->maxClass, (method)receive_address, "address", A_SYM, 0);
128 }
129 
130 #pragma mark -
131 #pragma mark Object life
132 
133 void WrappedReceiverClass_new(TTPtr self, long argc, t_atom *argv)
134 {
136  t_symbol *address;
137  long attrstart = attr_args_offset(argc, argv); // support normal arguments
138  t_atom a[1];
139 
140  // read first argument
141  if (attrstart && argv)
142  address = atom_getsym(argv);
143  else
144  address = _sym_nothing;
145 
146  x->address = TTAddress(jamoma_parse_dieze((t_object*)x, address)->s_name);
147 
148  // if the j.receive tries to bind an Output object : bind the signal attribute if no attribute is precised
149  if (x->address.getName() == TTSymbol("out") || x->address.getName() == TTSymbol("in"))
150  if (x->address.getAttribute() == kTTSymEmpty)
151  x->address = x->address.appendAttribute(kTTSym_signal);
152 
153  x->index = 0; // the index member is usefull to count how many time the external tries to bind
154 
155  x->outlets = (TTHandle)sysmem_newptr(sizeof(TTPtr) * 2);
156 
157 #ifdef JCOM_RECEIVE_TILDE
159 
160  dsp_setup((t_pxobject *)x, 1);
161  x->obj.z_misc = Z_NO_INPLACE | Z_PUT_FIRST;
162 
163  x->outlets[address_out] = outlet_new(x, NULL); // anything outlet to output address
164  x->outlets[data_out] = outlet_new((t_pxobject *)x, "signal"); // signal outlet to output audio
165 #else
166  jamoma_receiver_create((t_object*)x, x->wrappedObject);
167 
168  x->outlets[address_out] = outlet_new(x, NULL); // anything outlet to output address
169  x->outlets[data_out] = outlet_new(x, NULL); // anything outlet to output data
170 #endif
171 
172  // handle attribute args
173  attr_args_process(x, argc, argv);
174 
175  // for absolute address
176  if (x->address.getType() == kAddressAbsolute) {
177 
178  x->wrappedObject.set(kTTSym_address, x->address);
179  atom_setsym(a, gensym((char*)x->address.c_str()));
180  object_obex_dumpout((t_object*)x, gensym("address"), 1, a);
181 
182  JamomaDebug object_post((t_object*)x, "binds on %s", x->address.c_str());
183 
184  return;
185  }
186 
187  // The following must be deferred because we have to interrogate our box,
188  // and our box is not yet valid until we have finished instantiating the object.
189  // Trying to use a loadbang method instead is also not fully successful (as of Max 5.0.6)
190  defer_low((t_object*)x, (method)receive_subscribe, NULL, 0, 0);
191 }
192 
194 {
196 
197  x->wrappedObject.set(kTTSym_address, kTTAdrsEmpty);
198 
199 #ifdef JCOM_RECEIVE_TILDE
200 
201  // Always call dsp_free first in this routine
202  dsp_free((t_pxobject *)x);
203 #endif
204 }
205 
206 #pragma mark -
207 #pragma mark NodeLib association
208 
210 {
212  TTValue v;
213  t_atom a[1];
214  TTAddress contextAddress = kTTAdrsEmpty;
215  TTAddress absoluteAddress, returnedAddress;
216  TTNodePtr returnedNode = NULL;
217  TTNodePtr returnedContextNode = NULL;
218  TTObject anObject, empty;
219 
220  if (x->address == kTTAdrsEmpty)
221  return;
222 
223  // for relative address
225 
226  if (!jamoma_subscriber_create((t_object*)x, empty, TTAddress("model"), x->subscriberObject, returnedAddress, &returnedNode, &returnedContextNode)) {
227 
228  // get the context address to make
229  // a receiver on the contextAddress/model:address attribute
230  x->subscriberObject.get("contextAddress", v);
231  contextAddress = v[0];
232 
233  // release the subscriber
234  x->subscriberObject = TTObject();
235 
236  if (x->patcherContext) {
237 
238  if (x->address == TTAddress("model:address")) {
239 
240  x->wrappedObject.set(kTTSym_address, contextAddress.appendAddress(x->address));
241  atom_setsym(a, gensym((char*)x->address.c_str()));
242  object_obex_dumpout((t_object*)x, gensym("address"), 1, a);
243 
244  JamomaDebug object_post((t_object*)x, "binds on %s", contextAddress.appendAddress(x->address).c_str());
245 
246  return;
247  }
248  else {
249 
250  // observe model:address attribute (in view patcher : deferlow return_model_address)
251  makeInternals_receiver(x, contextAddress, TTSymbol("/model:address"), gensym("return_model_address"), anObject, x->patcherContext == kTTSym_view);
252 
253  return;
254  }
255  }
256  }
257 
258  // else, if no context, set address directly
259  else if (x->patcherContext == kTTSymEmpty) {
260 
261  // release the subscriber
262  x->subscriberObject = TTObject();
263 
264  contextAddress = kTTAdrsRoot;
265  absoluteAddress = contextAddress.appendAddress(x->address);
266  x->wrappedObject.set(kTTSym_address, absoluteAddress);
267 
268  atom_setsym(a, gensym((char*)absoluteAddress.c_str()));
269  object_obex_dumpout((t_object*)x, gensym("address"), 1, a);
270 
271  return;
272  }
273 
274  // otherwise while the context node is not registered : try to binds again :(
275  // (to -- this is not a good way todo. For binding we should make a subscription
276  // to a notification mechanism and each time an TTObjet subscribes to the namespace
277  // using jamoma_subscriber_create we notify all the externals which have used
278  // jamoma_subscriber_create with NULL object to bind)
279 
280  // release the subscriber
281  x->subscriberObject = TTObject();
282 
283  x->index++; // the index member is usefull to count how many time the external tries to bind
284  if (x->index > 100) {
285  object_error((t_object*)x, "tries to bind too many times on %s", x->address.c_str());
286  object_obex_dumpout((t_object*)x, gensym("error"), 0, NULL);
287  return;
288  }
289 
290  // The following must be deferred because we have to interrogate our box,
291  // and our box is not yet valid until we have finished instantiating the object.
292  // Trying to use a loadbang method instead is also not fully successful (as of Max 5.0.6)
293  defer_low((t_object*)x, (method)receive_subscribe, NULL, 0, 0);
294 }
295 
296 void receive_return_model_address(TTPtr self, t_symbol *msg, long argc, t_atom *argv)
297 {
299  TTAddress absoluteAddress;
300  t_atom a[1];
301 
302  if (argc && argv && x->wrappedObject.valid() && x->address.getType() == kAddressRelative) {
303 
304  // set address attribute of the wrapped Receiver object
305  absoluteAddress = TTAddress(atom_getsym(argv)->s_name).appendAddress(x->address);
306  x->wrappedObject.set(kTTSym_address, absoluteAddress);
307  x->index = 0; // the index member is usefull to count how many time the external tries to bind
308 
309  atom_setsym(a, gensym((char*)absoluteAddress.c_str()));
310  object_obex_dumpout((t_object*)x, gensym("address"), 1, a);
311 
312  JamomaDebug object_post((t_object*)x, "binds on %s", absoluteAddress.c_str());
313  }
314 }
315 
316 #ifndef JCOM_RECEIVE_TILDE
317 void receive_return_address(TTPtr self, t_symbol *msg, long argc, t_atom *argv)
318 {
320 
321  outlet_anything(x->outlets[address_out], msg, argc, argv);
322 }
323 
324 void receive_return_value(TTPtr self, t_symbol *msg, long argc, t_atom *argv)
325 {
327  TTValue v;
328 
329  // avoid blank before data
330  if (msg == _sym_nothing)
331  outlet_atoms(x->outlets[data_out], argc, argv);
332  else
333  outlet_anything(x->outlets[data_out], msg, argc, argv);
334 }
335 #endif
336 
337 #pragma mark -
338 #pragma mark Methods bound to input/inlets
339 
340 // Method for Assistance Messages
341 void receive_assist(TTPtr self, void *b, long msg, long arg, char *dst)
342 {
343  if (msg==1) // Inlets
344  strcpy(dst, "address of node");
345  else { // Outlets
346  switch(arg) {
347  case data_out:
348 #ifdef JCOM_RECEIVE_TILDE
349  strcpy(dst, "(signal) node value");
350 #else
351  strcpy(dst, "node value");
352 #endif
353  break;
354  case address_out:
355  strcpy(dst, "address output");
356  break;
357  case dump_out:
358  strcpy(dst, "dumpout");
359  break;
360  }
361  }
362 }
363 
364 #ifndef JCOM_RECEIVE_TILDE
365 
366 void receive_bang(TTPtr self)
367 {
369 
370  // catch error : dump an error
371  if (x->wrappedObject.send(kTTSym_Get))
372  object_obex_dumpout(self, _sym_error, 0, NULL);
373 }
374 
375 #endif
376 
377 void receive_address(TTPtr self, t_symbol *address)
378 {
380  t_atom a[1];
381  TTAddress newAddress = TTAddress(jamoma_parse_dieze((t_object*)x, address)->s_name);
382 
383  // if the former address was relative and the new one is absolute :
384  // we don't need model:address receiver anymore
385  if (x->address.getType() == kAddressRelative &&
386  newAddress.getType() == kAddressAbsolute) {
387 
388  TTValue v;
389  TTErr err = x->internals->lookup(TTSymbol("/model:address"), v);
390 
391  if (!err) {
392 
393  TTObject aReceiver = v[0];
394  aReceiver.set(kTTSym_address, kTTAdrsEmpty);
395 
396  x->internals->remove(TTSymbol("/model:address"));
397  }
398  }
399 
400  // assign the new address
401  x->address = newAddress;
402 
403  // if the j.receive tries to bind an Output object : bind the signal attribute if no attribute is precised
404  if (x->address.getName() == TTSymbol("out") || x->address.getName() == TTSymbol("in"))
405  if (x->address.getAttribute() == kTTSymEmpty)
406  x->address = x->address.appendAttribute(kTTSym_signal);
407 
408  // for absolute address
409  if (x->address.getType() == kAddressAbsolute) {
410 
411  x->wrappedObject.set(kTTSym_address, x->address);
412 
413  atom_setsym(a, gensym((char*)x->address.c_str()));
414  object_obex_dumpout((t_object*)x, gensym("address"), 1, a);
415 
416  JamomaDebug object_post((t_object*)x, "binds on %s", x->address.c_str());
417 
418  return;
419  }
420 
421  receive_subscribe(self);
422 }
423 
424 #pragma mark -
425 #pragma mark Methods relating to audio processing
426 
427 #ifdef JCOM_RECEIVE_TILDE
428 // Perform Method - just pass the whole vector straight through
429 // (the work is all done in the dsp method)
430 t_int *receive_perform(t_int *w)
431 {
434  TTListPtr objectCache = NULL;
435  TTObject anObject;
436  TTUInt16 vectorSize = 0;
437  TTValue v;
438  TTFloat32 d;
439  TTBoolean active;
440 
441  aReceiver->getAttributeValue(kTTSym_active, v);
442  active = v[0];
443 
444  if (x->obj.z_disabled || !active)
445  return w + 4;
446 
447  if (aReceiver) {
448 
449  // get signal vectorSize
450  aReceiver->mSignal.get(kTTSym_vectorSize, vectorSize);
451 
452  // store the input
453  TTAudioSignalPtr(aReceiver->mSignal.instance())->setVector(0, vectorSize, (TTFloat32*)w[2]);
454 
455  // get the object cache of the Receiver object
456  if (!x->wrappedObject.get(kTTSym_objectCache, v)) {
457 
458  objectCache = TTListPtr((TTPtr)v[0]);
459 
460  if (objectCache) {
461 
462  // sum all object signals
463  for (objectCache->begin(); objectCache->end(); objectCache->next()) {
464 
465  anObject = objectCache->current()[0];
466 
467  if (anObject.valid()) {
468 
469  // OUTPUT case : sum the signal from the output
470  if (anObject.name() == kTTSym_OutputAudio) {
471 
472  // get output signal vectorSize
473  TTOutputPtr(anObject.instance())->mSignalOut.get(kTTSym_vectorSize, vectorSize);
474 
475  // sum output signal
476  *TTAudioSignalPtr(aReceiver->mSignal.instance()) += *TTAudioSignalPtr(TTOutputPtr(anObject.instance())->mSignalOut.instance());
477  }
478 
479  // INPUT AUDIO case : sum the signal from the input
480  else if (anObject.name() == kTTSym_InputAudio) {
481 
482  // get output signal vectorSize
483  TTInputPtr(anObject.instance())->mSignalOut.get(kTTSym_vectorSize, vectorSize);
484 
485  // sum output signal
486  *TTAudioSignalPtr(aReceiver->mSignal.instance()) += *TTAudioSignalPtr(TTOutputPtr(anObject.instance())->mSignalOut.instance());
487  }
488 
489  // DATA case : fill a signal with the data value and sum it
490  else if (anObject.name() == kTTSym_Data) {
491 
492  // get value
493  anObject.get(kTTSym_value, v);
494  d = v[0];
495 
496  // TEST : fill the signal with the value
497  // TODO : add a += TTFloat64 inline method to TTAudioSignal class
498  TTAudioSignalPtr(aReceiver->mSignal.instance())->fill(d);
499  }
500  }
501  }
502  }
503 
504  // send signal to the outlet
505  TTAudioSignalPtr(aReceiver->mSignal.instance())->getVector(0, vectorSize, (TTFloat32*)w[3]);
506  }
507  }
508 
509  return w + 4;
510 }
511 
512 
513 // Perform Method 64 bit - just pass the whole vector straight through
514 // (the work is all done in the dsp 64 bit method)
515 void receive_perform64(TTPtr self, t_object *dsp64, double **ins, long numins, double **outs, long numouts, long sampleframes, long flags, void *userparam)
516 {
519  TTListPtr objectCache = NULL;
520  TTObject anObject;
521  TTUInt16 vectorSize = 0;
522  TTValue v;
523  TTFloat32 d;
524  TTBoolean active;
525 
526  aReceiver->getAttributeValue(kTTSym_active, v);
527  active = v[0];
528 
529  if (x->obj.z_disabled || !active) {
530 
531  if (aReceiver) {
532 
533  // get signal vectorSize
534  aReceiver->mSignal.get(kTTSym_vectorSize, vectorSize);
535 
536  // send signal to the outlet
537  TTAudioSignalPtr(aReceiver->mSignal.instance())->getVectorCopy(0, vectorSize, outs[0]);
538  }
539 
540  return;
541  }
542 
543  if (aReceiver) {
544 
545  // get signal vectorSize
546  aReceiver->mSignal.get(kTTSym_vectorSize, vectorSize);
547 
548  // store the input
549  TTAudioSignalPtr(aReceiver->mSignal.instance())->setVector64Copy(0, vectorSize, ins[0]);
550 
551  // get the object cache of the Receiver object
552  if (!aReceiver->getAttributeValue(kTTSym_objectCache, v)) {
553 
554  objectCache = TTListPtr((TTPtr)v[0]);
555 
556  if (objectCache) {
557 
558  // sum all object signals
559  for (objectCache->begin(); objectCache->end(); objectCache->next()) {
560 
561  anObject = objectCache->current()[0];
562 
563  if (anObject.valid()) {
564 
565  // OUTPUT AUDIO case : sum the signal from the output
566  if (anObject.name() == kTTSym_OutputAudio) {
567 
568  // get output signal vectorSize
569  TTOutputPtr(anObject.instance())->mSignalOut.get(kTTSym_vectorSize, vectorSize);
570 
571  // sum output signal
572  *TTAudioSignalPtr(aReceiver->mSignal.instance()) += *TTAudioSignalPtr(TTOutputPtr(anObject.instance())->mSignalOut.instance());
573  }
574 
575  // INPUT AUDIO case : sum the signal from the input
576  else if (anObject.name() == kTTSym_InputAudio) {
577 
578  // get output signal vectorSize
579  TTInputPtr(anObject.instance())->mSignalOut.get(kTTSym_vectorSize, vectorSize);
580 
581  // sum output signal
582  *TTAudioSignalPtr(aReceiver->mSignal.instance()) += *TTAudioSignalPtr(TTInputPtr(anObject.instance())->mSignalOut.instance());
583  }
584 
585  // DATA case : fill a signal with the data value and sum it
586  else if (anObject.name() == kTTSym_Data) {
587 
588  // get value
589  anObject.get(kTTSym_value, v);
590  d = v[0];
591 
592  // TEST : fill the signal with the value
593  // TODO : add a += TTFloat64 inline method to TTAudioSignal class
594  TTAudioSignalPtr(aReceiver->mSignal.instance())->fill(d);
595  }
596  }
597  }
598  }
599  }
600 
601  // send signal to the outlet
602  TTAudioSignalPtr(aReceiver->mSignal.instance())->getVectorCopy(0, vectorSize, outs[0]);
603  }
604 }
605 
606 // DSP Method
607 void receive_dsp(TTPtr self, t_signal **sp, short *count)
608 {
611  void** audioVectors = NULL;
612  TTUInt16 vectorSize = sp[0]->s_n;
613 
614  if (aReceiver) {
615 
616  audioVectors = (void**)sysmem_newptr(sizeof(void*) * 3);
617  audioVectors[0] = x;
618 
619  if (count[0] || count[1]) {
620  if (sp[0]->s_n > vectorSize)
621  vectorSize = sp[0]->s_n;
622 
623  audioVectors[1] = sp[0]->s_vec;
624  audioVectors[2] = sp[1]->s_vec;
625  }
626 
627  // set signal numChannels and vectorSize
628  aReceiver->mSignal.set(kTTSym_numChannels, 1);
629  aReceiver->mSignal.set(kTTSym_vectorSize, vectorSize);
630 
631  // anOutput->mSignal will be set in the perform method
632  aReceiver->mSignal.send(kTTSym_alloc);
633 
634  dsp_addv(receive_perform, 3, audioVectors);
635  sysmem_freeptr(audioVectors);
636  }
637 }
638 
639 // DSP64 method
640 void receive_dsp64(TTPtr self, t_object *dsp64, short *count, double samplerate, long maxvectorsize, long flags)
641 {
644 
645  if (aReceiver) {
646 
647  // set signal numChannels and vectorSize
648  aReceiver->mSignal.set(kTTSym_numChannels, 1);
649  aReceiver->mSignal.set(kTTSym_vectorSize, (TTUInt16)maxvectorsize);
650 
651  // aReceiver->mSignal will be set in the perform method
652  aReceiver->mSignal.send(kTTSym_alloc);
653 
654  object_method(dsp64, gensym("dsp_add64"), x, receive_perform64, 0, NULL);
655  }
656 }
657 
658 #endif // JCOM_RECEIVE_TILDE
TTErr JAMOMA_EXPORT jamoma_patcher_get_info(t_object *obj, t_object **returnedPatcher, TTSymbol &returnedContext, TTSymbol &returnedClass, TTSymbol &returnedName)
Get all context info from an object (his patcher and the context, the class and the name of his patch...
TTAddress appendAddress(const TTAddress &toAppend)
Return a new TTAddress with the appended part.
Definition: TTAddress.h:167
TTObject subscriberObject
The instance of a TTSubscriber object used to register the wrapped object in the tree structure...
int C74_EXPORT main(void)
Set up this class as a Max external the first time an object of this kind is instantiated.
bool TTBoolean
Boolean flag, same as Boolean on the Mac.
Definition: TTBase.h:167
std::uint16_t TTUInt16
16 bit unsigned integer
Definition: TTBase.h:176
TTErr send(const TTSymbol aName)
Send a message to this object with no arguments.
Definition: TTObject.cpp:135
TTAddress appendAttribute(TTSymbol anAttribute)
Return a new TTAddress with attribute part.
Definition: TTAddress.h:161
TTHandle outlets
an array of outlet
TTErr wrapTTModularClassAsMaxClass(TTSymbol &ttblueClassName, const char *maxClassName, WrappedClassPtr *c, ModularSpec *specificities)
Wrap a Jamoma class as a Max class.
TTErr lookup(const TTSymbol key, TTValue &value)
Find the value for the given key.
Definition: TTHash.cpp:76
t_symbol JAMOMA_EXPORT * jamoma_parse_dieze(t_object *x, t_symbol *address)
Parse #N inside address and replace them by parent patcher arguments if there are.
We build a directory of TTNodes, and you can request a pointer for any TTNode, or add an observer to ...
Definition: TTNode.h:59
TTAddress address
sometime external needs to store an address (e.g. send, receive, view, ...)
TTReceiver ...
Definition: TTReceiver.h:27
TTSymbol patcherClass
the patcher class in which the external is
TTErr JAMOMA_EXPORT jamoma_receiver_create_audio(t_object *x, TTObject &returnedReceiver)
Create a TTReceiver object for audio signal.
The TTAddress class is used to represent a string and efficiently pass and compare that string...
Definition: TTAddress.h:29
Create and use Jamoma object instances.
Definition: TTObject.h:29
void receive_subscribe(TTPtr self)
Associate j.receive(~) with NodeLib.
TTErr getAttributeValue(const TTSymbol name, TTValue &value)
Get an attribute value for an object.
t_object * patcherPtr
the patcher in which the external is (ignoring subpatcher)
this flag means that an address have no leading slash
Definition: TTAddressBase.h:64
TTHashPtr internals
An hash table to store any internal TTObjectBases (like TTData, TTViewer, ...)
TTErr JAMOMA_EXPORT jamoma_receiver_create(t_object *x, TTObject &returnedReceiver)
Create a TTReceiver object.
void WrappedReceiverClass_new(TTPtr self, long argc, t_atom *argv)
Wrapper for the j.receive constructor class, called when an instance is created.
void * TTPtr
A generic pointer.
Definition: TTBase.h:248
TTErr get(const TTSymbol aName, T &aReturnedValue) const
Get an attribute value for an object.
void WrapTTReceiverClass(WrappedClassPtr c)
Wrap the j.receive class as a Max object.
TTSymbol name() const
Return the name of this class.
Definition: TTObject.cpp:129
t_object obj
Max control object header.
TTErr set(const TTSymbol aName, T aValue)
Set an attribute value for an object.
The TTSymbol class is used to represent a string and efficiently pass and compare that string...
Definition: TTSymbol.h:26
void receive_address(TTPtr self, t_symbol *address)
address message handler for j.receive.
float TTFloat32
32 bit floating point number
Definition: TTBase.h:187
void receive_assist(TTPtr self, void *b, long msg, long arg, char *dst)
Assistance Method.
TTObject wrappedObject
The instance of the Jamoma object we are wrapping.
The TTAudioSignal class represents N vectors of audio samples for M channels.
Definition: TTAudioSignal.h:57
TTSymbol & getAttribute()
Get the attribute part.
Definition: TTAddress.h:130
this flag means that an address have a leading slash
Definition: TTAddressBase.h:65
const char * c_str() const
Return a pointer to the internal string as a C-string.
Definition: TTSymbol.h:77
void WrappedReceiverClass_free(TTPtr self)
Wrapper for the j.receive deconstructor class, called when an instance is destroyed.
void receive_bang(TTPtr self)
bang handler for j.receive
Data Structure for this object.
TTAddressType getType()
Get the type.
Definition: TTAddress.h:136
TTErr remove(const TTSymbol key)
Remove an item from the hash table.
Definition: TTHash.cpp:108
TTErr
Jamoma Error Codes Enumeration of error codes that might be returned by any of the TTBlue functions a...
Definition: TTBase.h:342
Wraps Jamoma Core classes as objects for Max/MSP.
TTErr get(const TTSymbol aName, T &aReturnedValue)
Get an attribute value for an object This is the same as calling getAttributeValue().
Definition: TTObjectBase.h:280
TTSymbol patcherContext
the patcher context in which the external is (model, view)
TTSymbol patcherName
the patcher name in which the external is
TTObjectBase * instance() const
Return a direct pointer to the internal instance.
Definition: TTObject.cpp:105
TTErr JAMOMA_EXPORT jamoma_subscriber_create(t_object *x, TTObject &anObject, TTAddress relativeAddress, TTObject &returnedSubscriber, TTSymbol &returnedAddress, TTNodePtr *returnedNode, TTNodePtr *returnedContextNode)
Create a #TTSubscriber object and register a TTObject into the tree or, if aTTObject is NULL...
long index
index of the inlet used
TTObject mSignal
any data structure to receive complex signal
Definition: TTReceiver.h:33
TTBoolean valid() const
Determine if the object contained by this TTObject is truly ready for use.
Definition: TTObject.cpp:179
TTSymbol & getName()
Get the name part.
Definition: TTAddress.h:118
WrappedModularInstance * WrappedModularInstancePtr
Pointer to a wrapped instance of our object.
[doxygenAppendixC_copyExample]
Definition: TTValue.h:34