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