Jamoma API  0.6.0.a19
Max/source/j.cue/j.cue.cpp
Go to the documentation of this file.
1 /** @file
2  *
3  * @ingroup implementationMaxExternals
4  *
5  * @brief j.cue - store and recall the state of several models
6  *
7  * @details
8  *
9  * @authors Théo de la Hogue, Trond Lossius
10  *
11  * @copyright © 2010 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 #include "jpatcher_api.h"
19 
20 // This is used to store extra data
21 typedef struct extra {
22  TTObject *toEdit; // the object to edit (a cue or all the cuelist)
23  TTSymbol cueName; // the name of the edited cue
24  TTString *text; // the text of the editor to read after edclose
25  t_object* textEditor; // the text editor window
26 } t_extra;
27 #define EXTRA ((t_extra*)x->extra)
28 
29 #define line_out 0
30 #define dump_out 1
31 
32 // Definitions
33 void WrapTTCueManagerClass(WrappedClassPtr c);
34 void WrappedCueManagerClass_new(TTPtr self, long argc, t_atom *argv);
35 void WrappedCueManageClass_free(TTPtr self);
36 
37 void cue_assist(TTPtr self, void *b, long msg, long arg, char *dst);
38 
39 void cue_return_value(TTPtr self, t_symbol *msg, long argc, t_atom *argv);
40 void cue_return_names(TTPtr self, t_symbol *msg, long argc, t_atom *argv);
41 
42 void cue_get(TTPtr self, t_symbol *msg, long argc, t_atom *argv);
43 void cue_set(TTPtr self, t_symbol *msg, long argc, t_atom *argv);
44 
45 void cue_read(TTPtr self, t_symbol *msg, long argc, t_atom *argv);
46 void cue_doread(TTPtr self, t_symbol *msg, long argc, t_atom *argv);
47 void cue_read_again(TTPtr self);
48 void cue_doread_again(TTPtr self);
49 
50 void cue_write(TTPtr self, t_symbol *msg, long argc, t_atom *argv);
51 void cue_dowrite(TTPtr self, t_symbol *msg, long argc, t_atom *argv);
52 void cue_write_again(TTPtr self);
53 void cue_dowrite_again(TTPtr self);
54 
55 void cue_dorecall(TTPtr self, t_symbol *msg, long argc, const t_atom *argv);
56 
57 void cue_edit(TTPtr self, t_symbol *msg, long argc, const t_atom *argv);
58 void cue_edclose(TTPtr self, char **text, long size);
59 void cue_doedit(TTPtr self);
60 
61 void cue_subscribe(TTPtr self);
62 
63 void cue_return_model_address(TTPtr self, t_symbol *msg, long argc, const t_atom *argv);
64 
65 t_max_err cue_get_relative(TTPtr self, TTPtr attr, long *ac, t_atom **av);
66 t_max_err cue_set_relative(TTPtr self, TTPtr attr, long ac, const t_atom *av);
67 
68 int C74_EXPORT main(void)
69 {
70  ModularSpec *spec = new ModularSpec;
71  spec->_wrap = &WrapTTCueManagerClass;
72  spec->_new = &WrappedCueManagerClass_new;
73  spec->_free = &WrappedCueManageClass_free;
74  spec->_any = NULL;
75 
76  return wrapTTModularClassAsMaxClass(kTTSym_CueManager, "j.cue", NULL, spec);
77 }
78 
79 void WrapTTCueManagerClass(WrappedClassPtr c)
80 {
81  class_addmethod(c->maxClass, (method)cue_assist, "assist", A_CANT, 0L);
82 
83  class_addmethod(c->maxClass, (method)cue_return_model_address, "return_model_address", A_CANT, 0);
84 
85  class_addmethod(c->maxClass, (method)cue_return_value, "return_value", A_CANT, 0);
86 
87  class_addmethod(c->maxClass, (method)cue_return_names, "return_names", A_CANT, 0);
88 
89  class_addmethod(c->maxClass, (method)cue_read, "cue_read", A_CANT, 0);
90  class_addmethod(c->maxClass, (method)cue_write, "cue_write", A_CANT, 0);
91 
92  class_addmethod(c->maxClass, (method)cue_edit, "dblclick", A_CANT, 0);
93  class_addmethod(c->maxClass, (method)cue_edclose, "edclose", A_CANT, 0);
94 
95  class_addmethod(c->maxClass, (method)cue_get, "get", A_GIMME, 0);
96  class_addmethod(c->maxClass, (method)cue_set, "set", A_GIMME, 0);
97 
98  class_addmethod(c->maxClass, (method)cue_read, "read", A_GIMME, 0);
99  class_addmethod(c->maxClass, (method)cue_write, "write", A_GIMME, 0);
100  class_addmethod(c->maxClass, (method)cue_edit, "edit", A_GIMME, 0);
101 
102  class_addmethod(c->maxClass, (method)cue_read_again, "read/again", 0);
103  class_addmethod(c->maxClass, (method)cue_write_again, "write/again", 0);
104 
105  CLASS_ATTR_LONG(c->maxClass, "relative", 0, WrappedModularInstance, index); // use index member to store relative
106  CLASS_ATTR_ACCESSORS(c->maxClass, "relative", cue_get_relative, cue_set_relative);
107  CLASS_ATTR_STYLE(c->maxClass, "relative", 0, "onoff");
108 }
109 
110 void WrappedCueManagerClass_new(TTPtr self, long argc, t_atom *argv)
111 {
113  t_symbol* name;
114  TTValue v, args;
115  TTObject aTextHandler;
116  long attrstart = attr_args_offset(argc, argv); // support normal arguments
117 
118  // create the cue manager
119  jamoma_cueManager_create((t_object*)x, x->wrappedObject);
120 
121  // read first argument to know if the cue binds a namespace
122  if (attrstart && argv) {
123 
124  if (atom_gettype(argv) == A_SYM) {
125 
126  name = atom_getsym(argv);
127  x->wrappedObject.set(kTTSym_namespace, TTSymbol(name->s_name));
128  }
129  else
130  object_error((t_object*)x, "argument not expected");
131  }
132 
133  // Make two outlets
134  x->outlets = (TTHandle)sysmem_newptr(sizeof(TTPtr) * 1);
135  x->outlets[line_out] = outlet_new(x, NULL); // anything outlet to output data
136 
137  // Prepare Internals hash to store TextHandler object
138  x->internals = new TTHash();
139 
140  // create internal TTTextHandler
141  aTextHandler = TTObject(kTTSym_TextHandler);
142  x->internals->append(kTTSym_TextHandler, aTextHandler);
143 
144  // Prepare extra data
145  x->extra = (t_extra*)malloc(sizeof(t_extra));
146  EXTRA->toEdit = new TTObject();
147  *EXTRA->toEdit = x->wrappedObject;
148  EXTRA->cueName = kTTSymEmpty;
149  EXTRA->text = NULL;
150  EXTRA->textEditor = NULL;
151 
152  // handle attribute args
153  attr_args_process(x, argc, argv);
154 }
155 
156 void WrappedCueManageClass_free(TTPtr self)
157 {
159 
160  delete EXTRA->toEdit;
161 
162  // the texthanler have to forget the cue manager object
163  TTValue o;
164  x->internals->lookup(kTTSym_TextHandler, o);
165  TTObject empty, aTextHandler = o[0];
166  aTextHandler.set(kTTSym_object, empty);
167 
168  free(EXTRA);
169 }
170 
171 void cue_subscribe(TTPtr self)
172 {
174  TTValue v;
175  TTAddress contextAddress = kTTAdrsEmpty;
176  TTAddress absoluteAddress, returnedAddress;
177  TTNodePtr returnedNode;
178  TTNodePtr returnedContextNode;
179  TTObject anObject, empty;
180 
182 
183  if (!jamoma_subscriber_create((t_object*)x, empty, kTTAdrsEmpty, x->subscriberObject, returnedAddress, &returnedNode, &returnedContextNode)) {
184 
185  // get the context address to make
186  // a receiver on the contextAddress/model:address attribute
187  x->subscriberObject.get("contextAddress", v);
188  contextAddress = v[0];
189  }
190 
191  // bind on the model:address attribute
192  if (contextAddress != kTTAdrsEmpty) {
193 
194  absoluteAddress = contextAddress.appendAddress(x->address);
195  x->wrappedObject.set(kTTSym_address, x->address);
196 
197  makeInternals_receiver(x, contextAddress, TTSymbol("/model:address"), gensym("return_model_address"), anObject, YES); // YES : we want to deferlow this method
198  }
199 
200  // while the context node is not registered : try to binds again :(
201  // (to -- this is not a good way todo. For binding we should make a subscription
202  // to a notification mechanism and each time an TTObjet subscribes to the namespace
203  // using jamoma_subscriber_create we notify all the externals which have used
204  // jamoma_subscriber_create with NULL object to bind)
205  else {
206 
207  // release the subscriber
208  x->subscriberObject = TTObject();
209 
210  // The following must be deferred because we have to interrogate our box,
211  // and our box is not yet valid until we have finished instantiating the object.
212  // Trying to use a loadbang method instead is also not fully successful (as of Max 5.0.6)
213  defer_low((t_object*)x, (method)cue_subscribe, NULL, 0, 0);
214  }
215 }
216 
217 void cue_return_model_address(TTPtr self, t_symbol *msg, long argc, const t_atom *argv)
218 {
220  TTAddress absoluteAddress;
221 
222  if (argc && argv) {
223 
224  // set address attribute of the wrapped Receiver object
225  absoluteAddress = TTAddress(atom_getsym(argv)->s_name).appendAddress(x->address);
226  x->wrappedObject.set(kTTSym_address, absoluteAddress);
227  }
228 }
229 
230 // Method for Assistance Messages
231 void cue_assist(TTPtr self, void *b, long msg, long arg, char *dst)
232 {
233  if (msg==1) // Inlets
234  strcpy(dst, "");
235  else { // Outlets
236  switch(arg) {
237  case line_out:
238  strcpy(dst, "cue output");
239  break;
240  case dump_out:
241  strcpy(dst, "dumpout");
242  break;
243  }
244  }
245 }
246 
247 void cue_return_value(TTPtr self, t_symbol *msg, long argc, t_atom *argv)
248 {
250 
251  // avoid blank before line
252  if (msg == _sym_nothing)
253  outlet_atoms(x->outlets[line_out], argc, argv);
254  else
255  outlet_anything(x->outlets[line_out], msg, argc, argv);
256 }
257 
258 void cue_return_names(TTPtr self, t_symbol *msg, long argc, t_atom *argv)
259 {
261  outlet_anything(x->outlets[dump_out], gensym("names"), argc, argv);
262 }
263 
264 void cue_get(TTPtr self, t_symbol *msg, long argc, t_atom *argv)
265 {
267  TTHashPtr allCues;
268  TTValue v;
269  TTSymbol name, attribute;
270  TTObject cue;
271  long ac = 0;
272  t_atom *av = NULL;
273 
274  if (argc == 2) {
275 
276  if (atom_gettype(argv) == A_SYM && atom_gettype(argv+1) == A_SYM) {
277 
278  attribute = TTSymbol((char*)atom_getsym(argv)->s_name);
279  name = TTSymbol((char*)atom_getsym(argv+1)->s_name);
280 
281  // get cue object table
282  x->wrappedObject.get("cues", v);
283  allCues = TTHashPtr((TTPtr)v[0]);
284 
285  if (allCues) {
286 
287  // get cue
288  if (!allCues->lookup(name, v)) {
289 
290  cue = v[0];
291  if (!cue.get(attribute, v)) {
292 
293  v.prepend(name);
294  jamoma_ttvalue_to_Atom(v, &ac, &av);
295 
296  object_obex_dumpout(self, atom_getsym(argv), ac, av);
297  }
298  else
299  object_error((t_object*)x, "%s attribute does'nt exist", atom_getsym(argv)->s_name);
300  }
301  else
302  object_error((t_object*)x, "%s cue does'nt exist", atom_getsym(argv+1)->s_name);
303  }
304  }
305  }
306 }
307 
308 void cue_set(TTPtr self, t_symbol *msg, long argc, t_atom *argv)
309 {
311  TTHashPtr allCues;
312  TTValue v;
313  TTSymbol name, attribute;
314  TTObject cue;
315 
316  if (argc >= 2) {
317 
318  if (atom_gettype(argv) == A_SYM && atom_gettype(argv+1) == A_SYM) {
319 
320  attribute = TTSymbol((char*)atom_getsym(argv)->s_name);
321  name = TTSymbol((char*)atom_getsym(argv+1)->s_name);
322 
323  // get cue object table
324  x->wrappedObject.get("cues", v);
325  allCues = TTHashPtr((TTPtr)v[0]);
326 
327  if (allCues) {
328 
329  // get cue
330  if (!allCues->lookup(name, v)) {
331 
332  cue = v[0];
333 
334  // prepare value to set
335  jamoma_ttvalue_from_Atom(v, _sym_nothing, argc-2, argv+2);
336 
337  if (cue.set(attribute, v))
338  object_error((t_object*)x, "%s attribute does'nt exist", atom_getsym(argv)->s_name);
339  }
340  else
341  object_error((t_object*)x, "%s cue does'nt exist", atom_getsym(argv+1)->s_name);
342  }
343  }
344  }
345 }
346 
347 void cue_read(TTPtr self, t_symbol *msg, long argc, t_atom *argv)
348 {
349  defer(self, (method)cue_doread, msg, argc, argv);
350 }
351 
352 void cue_doread(TTPtr self, t_symbol *msg, long argc, t_atom *argv)
353 {
355  TTValue o, v, none;
356  TTSymbol fullpath;
357  TTObject aTextHandler;
358  TTErr tterr;
359 
360  if (x->wrappedObject.valid()) {
361 
362  fullpath = jamoma_file_read((t_object*)x, argc, argv, (t_fourcc)'TEXT');
363  v.append(fullpath);
364 
365  tterr = x->internals->lookup(kTTSym_TextHandler, o);
366 
367  if (!tterr) {
368 
369  aTextHandler = o[0];
370 
371  aTextHandler.set(kTTSym_object, x->wrappedObject);
372 
373  critical_enter(0);
374  tterr = aTextHandler.send(kTTSym_Read, v, none);
375  critical_exit(0);
376 
377  if (!tterr)
378  object_obex_dumpout(self, _sym_read, argc, argv);
379  else
380  object_obex_dumpout(self, _sym_error, 0, NULL);
381  }
382  }
383 }
384 
385 void cue_read_again(TTPtr self)
386 {
387  defer(self, (method)cue_doread_again, NULL, 0, NULL);
388 }
389 
390 void cue_doread_again(TTPtr self)
391 {
393  TTValue o, v, none;
394  TTObject aTextHandler;
395  TTErr tterr;
396 
397  if (x->wrappedObject.valid()) {
398 
399  tterr = x->internals->lookup(kTTSym_TextHandler, o);
400 
401  if (!tterr) {
402 
403  aTextHandler = o[0];
404 
405  aTextHandler.set(kTTSym_object, x->wrappedObject);
406 
407  critical_enter(0);
408  tterr = aTextHandler.send(kTTSym_ReadAgain, v, none);
409  critical_exit(0);
410 
411  if (!tterr)
412  object_obex_dumpout(self, _sym_read, 0, NULL);
413  else
414  object_obex_dumpout(self, _sym_error, 0, NULL);
415  }
416  }
417 }
418 
419 void cue_write(TTPtr self, t_symbol *msg, long argc, t_atom *argv)
420 {
421  defer(self, (method)cue_dowrite, msg, argc, argv);
422 }
423 
424 void cue_dowrite(TTPtr self, t_symbol *msg, long argc, t_atom *argv)
425 {
427  char filename[MAX_FILENAME_CHARS];
428  TTSymbol fullpath;
429  TTValue o, v, none;
430  TTObject aTextHandler;
431  TTErr tterr;
432 
433  if (x->wrappedObject.valid()) {
434 
435  // Default TEXT File Name
436  snprintf(filename, MAX_FILENAME_CHARS, "untitled.cues.txt");
437 
438  fullpath = jamoma_file_write((t_object*)x, argc, argv, filename);
439  v.append(fullpath);
440 
441  tterr = x->internals->lookup(kTTSym_TextHandler, o);
442 
443  if (!tterr) {
444  aTextHandler = o[0];
445 
446  aTextHandler.set(kTTSym_object, x->wrappedObject);
447 
448  critical_enter(0);
449  tterr = aTextHandler.send(kTTSym_Write, v, none);
450  critical_exit(0);
451 
452  if (!tterr)
453  object_obex_dumpout(self, _sym_write, argc, argv);
454  else
455  object_obex_dumpout(self, _sym_error, 0, NULL);
456  }
457  }
458 }
459 
460 void cue_write_again(TTPtr self)
461 {
462  defer(self, (method)cue_dowrite_again, NULL, 0, NULL);
463 }
464 
465 void cue_dowrite_again(TTPtr self)
466 {
468  TTValue o, v, none;
469  TTObject aTextHandler;
470  TTErr tterr;
471 
472  if (x->wrappedObject.valid()) {
473 
474  tterr = x->internals->lookup(kTTSym_TextHandler, o);
475 
476  if (!tterr) {
477 
478  aTextHandler = o[0];
479 
480  aTextHandler.set(kTTSym_object, x->wrappedObject);
481 
482  critical_enter(0);
483  tterr = aTextHandler.send(kTTSym_WriteAgain, v, none);
484  critical_exit(0);
485 
486  if (!tterr)
487  object_obex_dumpout(self, _sym_write, 0, NULL);
488  else
489  object_obex_dumpout(self, _sym_error, 0, NULL);
490  }
491  }
492 }
493 
494 void cue_dorecall(TTPtr self, t_symbol *msg, long argc, const t_atom *argv)
495 {
497  TTValue v, none;
498  TTNodePtr contextNode;
499  TTObject o;
500  TTBoolean initialized;
501 
502  if (argc && argv) {
503  if (atom_gettype(argv) == A_SYM) {
504 
505  x->wrappedObject.send(kTTSym_Recall, TTSymbol(atom_getsym(argv)), none);
506  }
507 
508  // Check Context Node
509  if (x->subscriberObject.valid()) {
510 
511  x->subscriberObject.get("contextNode", v);
512  contextNode = TTNodePtr((TTPtr)v[0]);
513 
514  // If it is a none initialized Container : initialize it
515  o = contextNode->getObject();
516  if (o.valid()) {
517 
518  if (o.name() == kTTSym_Container) {
519 
520  o.get(kTTSym_initialized, v);
521  initialized = v[0];
522 
523  if (!initialized)
524  o.send(kTTSym_Init);
525  }
526  }
527  }
528  }
529 }
530 
531 void cue_edit(TTPtr self, t_symbol *msg, long argc, const t_atom *argv)
532 {
534  TTString *buffer;
535  char title[MAX_FILENAME_CHARS];
536  TTObject aTextHandler;
537  TTHashPtr allCues;
538  TTValue v, o, none;
539  TTSymbol name = kTTSymEmpty;
540  t_atom a;
541  TTErr tterr;
542 
543  // choose object to edit : default the cuelist
544  *EXTRA->toEdit = x->wrappedObject;
545  EXTRA->cueName = kTTSymEmpty;
546 
547  if (argc && argv)
548  {
549  if (atom_gettype(argv) == A_LONG)
550  {
551  TTUInt32 index = atom_getlong(argv);
552 
553  // get cues names
554  x->wrappedObject.get("names", v);
555 
556  if (index > 0 && index <= v.size())
557  v.get(index-1, name);
558  else
559  {
560  object_error((t_object*)x, "%d does'nt exist", atom_getlong(argv));
561  return;
562  }
563  }
564  else if (atom_gettype(argv) == A_SYM)
565  name = TTSymbol(atom_getsym(argv)->s_name);
566 
567  if (name != kTTSymEmpty)
568  {
569  // get cue object table
570  x->wrappedObject.get("cues", v);
571  allCues = TTHashPtr((TTPtr)v[0]);
572 
573  if (allCues)
574  {
575  // get cue to edit
576  if (!allCues->lookup(name, v))
577  {
578  // edit a cue
579  *EXTRA->toEdit = v[0];
580  EXTRA->cueName = name;
581  }
582  else
583  {
584  object_error((t_object*)x, "%s does'nt exist", atom_getsym(argv)->s_name);
585  return;
586  }
587  }
588  }
589  }
590 
591  // only one editor can be open in the same time
592  if (!EXTRA->textEditor) {
593 
594  EXTRA->textEditor = (t_object*)object_new(_sym_nobox, _sym_jed, x, 0);
595 
596  buffer = new TTString();
597 
598  // get the buffer handler
599  tterr = x->internals->lookup(kTTSym_TextHandler, o);
600 
601  if (!tterr) {
602 
603  aTextHandler = o[0];
604 
605  critical_enter(0);
606  aTextHandler.set(kTTSym_object, *EXTRA->toEdit);
607  tterr = aTextHandler.send(kTTSym_Write, (TTPtr)buffer, none);
608  critical_exit(0);
609  }
610 
611  // pass the buffer to the editor
612  object_method(EXTRA->textEditor, _sym_settext, buffer->c_str(), _sym_utf_8);
613  object_attr_setchar(EXTRA->textEditor, gensym("scratch"), 1);
614 
615  snprintf(title, MAX_FILENAME_CHARS, "cuelist editor");
616  object_attr_setsym(EXTRA->textEditor, _sym_title, gensym(title));
617 
618  // output a flag
619  atom_setsym(&a, gensym("opened"));
620  object_obex_dumpout(self, gensym("editor"), 1, &a);
621 
622  buffer->clear();
623  delete buffer;
624  buffer = NULL;
625  }
626 }
627 
628 void cue_edclose(TTPtr self, char **text, long size)
629 {
631 
632  EXTRA->text = new TTString(*text);
633  EXTRA->textEditor = NULL;
634 
635  defer_low((t_object*)x, (method)cue_doedit, NULL, 0, NULL);
636 }
637 
638 void cue_doedit(TTPtr self)
639 {
641  TTObject aTextHandler;
642  TTValue o, args, none;
643  t_atom a;
644  TTErr tterr;
645 
646  // get the buffer handler
647  tterr = x->internals->lookup(kTTSym_TextHandler, o);
648 
649  if (!tterr) {
650 
651  aTextHandler = o[0];
652 
653  critical_enter(0);
654  tterr = aTextHandler.send(kTTSym_Read, (TTPtr)EXTRA->text, none);
655  critical_exit(0);
656 
657  // output a flag
658  atom_setsym(&a, gensym("closed"));
659  object_obex_dumpout(self, gensym("editor"), 1, &a);
660 
661  if (tterr)
662  object_obex_dumpout(self, _sym_error, 0, NULL);
663  }
664 
665  delete EXTRA->text;
666  EXTRA->text = NULL;
667  EXTRA->textEditor = NULL;
668  *EXTRA->toEdit = x->wrappedObject;
669  EXTRA->cueName = kTTSymEmpty;
670 }
671 
672 t_max_err cue_get_relative(TTPtr self, TTPtr attr, long *ac, t_atom **av)
673 {
675 
676  if ((*ac)&&(*av)) {
677  //memory passed in, use it
678  } else {
679  //otherwise allocate memory
680  *ac = 1;
681  if (!(*av = (t_atom*)getbytes(sizeof(t_atom)*(*ac)))) {
682  *ac = 0;
683  return MAX_ERR_OUT_OF_MEM;
684  }
685  }
686 
687  atom_setlong(*av, x->index);
688 
689  return MAX_ERR_NONE;
690 }
691 
692 t_max_err cue_set_relative(TTPtr self, TTPtr attr, long ac, const t_atom *av)
693 {
695 
696  if (ac&&av) {
697  x->index = atom_getlong(av);
698 
699  if (x->index) {
700  // The following must be deferred because we have to interrogate our box,
701  // and our box is not yet valid until we have finished instantiating the object.
702  // Trying to use a loadbang method instead is also not fully successful (as of Max 5.0.6)
703  defer_low((t_object*)x, (method)cue_subscribe, NULL, 0, 0);
704  }
705 
706  } else {
707  // no args
708  x->index = 0;
709  }
710  return MAX_ERR_NONE;
711 }
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...
bool TTBoolean
Boolean flag, same as Boolean on the Mac.
Definition: TTBase.h:167
TTErr send(const TTSymbol aName)
Send a message to this object with no arguments.
Definition: TTObject.cpp:135
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
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, ...)
TTSymbol patcherClass
the patcher class in which the external is
TTErr JAMOMA_EXPORT jamoma_cueManager_create(t_object *x, TTObject &returnedCueManager)
Create a #TTCueManager object.
const char * c_str() const
Return a pointer to the internal C-string.
Definition: TTString.h:83
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
TTObject & getObject()
Get the object binded by this node.
Definition: TTNode.cpp:468
size_type size() const noexcept
Return the number of elements.
Data structure for storing extra data.
void * extra
used to keep very specific things
t_object * patcherPtr
the patcher in which the external is (ignoring subpatcher)
TTSymbol JAMOMA_EXPORT jamoma_file_read(t_object *x, long argc, const t_atom *argv, t_fourcc filetype)
Get BOOT style filepath from args or, if no args open a dialog to read a file.
TTHashPtr internals
An hash table to store any internal TTObjectBases (like TTData, TTViewer, ...)
Maintain a collection of TTValue objects indexed by TTSymbol pointers.
Definition: TTHash.h:36
void prepend(const TTValue &aValueToPrepend)
Insert another TTValue before the first element.
Definition: TTValue.h:162
void append(const T &anElementValueToAppend)
Insert a single TTElement at the end.
Definition: TTValue.h:243
void * TTPtr
A generic pointer.
Definition: TTBase.h:248
TTErr get(const TTSymbol aName, T &aReturnedValue) const
Get an attribute value for an object.
TTString * text
The text of the editor to read after edclose.
TTObject * toEdit
The object to edit (a preset or all the preset list).
void JAMOMA_EXPORT jamoma_ttvalue_to_Atom(const TTValue &v, long *argc, t_atom **argv)
Make an Atom array from a TTValue.
TTSymbol name() const
Return the name of this class.
Definition: TTObject.cpp:129
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
t_object * textEditor
The text editor window.
TTSymbol JAMOMA_EXPORT jamoma_file_write(t_object *x, long argc, const t_atom *argv, char *default_filename)
Get BOOT style filepath from args or, if no args open a dialog to write a file.
TTErr append(const TTSymbol key, const TTValue &value)
Insert an item into the hash table.
Definition: TTHash.cpp:70
void get(const TTUInt16 index, T &returnedElementValue) const
DEPRECATED.
Definition: TTValue.h:591
TTObject wrappedObject
The instance of the Jamoma object we are wrapping.
void JAMOMA_EXPORT jamoma_ttvalue_from_Atom(TTValue &v, t_symbol *msg, long argc, const t_atom *argv)
Make a TTValue from Atom array.
Data Structure for this object.
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.
std::uint32_t TTUInt32
32 bit unsigned integer
Definition: TTBase.h:178
TTSymbol patcherContext
the patcher context in which the external is (model, view)
TTSymbol patcherName
the patcher name in which the external is
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...
The TTString class is used to represent a string.
Definition: TTString.h:34
long index
index of the inlet used
int C74_EXPORT main(void)
Set up this class as a Max external the first time an object of this kind is instantiated.
TTBoolean valid() const
Determine if the object contained by this TTObject is truly ready for use.
Definition: TTObject.cpp:179
WrappedModularInstance * WrappedModularInstancePtr
Pointer to a wrapped instance of our object.
[doxygenAppendixC_copyExample]
Definition: TTValue.h:34