24 void WrapTTExplorerClass(WrappedClassPtr c);
25 void WrappedExplorerClass_new(
TTPtr self,
long argc, t_atom *argv);
26 void WrappedExplorerClass_free(
TTPtr self);
28 void nmspc_assist(
TTPtr self,
void *b,
long m,
long a,
char *s);
30 void nmspc_return_value(
TTPtr self, t_symbol *msg,
long argc, t_atom *argv);
32 void nmspc_return_selection(
TTPtr self, t_symbol *msg,
long argc, t_atom *argv);
34 void nmspc_bang(
TTPtr self);
35 void nmspc_symbol(
TTPtr self, t_symbol *msg,
long argc, t_atom *argv);
37 void nmspc_subscribe(
TTPtr self);
39 void nmspc_return_model_address(
TTPtr self, t_symbol *msg,
long argc, t_atom *argv);
41 t_max_err nmspc_get_format(
TTPtr self,
TTPtr attr,
long *ac, t_atom **av);
42 t_max_err nmspc_set_format(
TTPtr self,
TTPtr attr,
long ac, t_atom *av);
44 t_max_err nmspc_get_relative(
TTPtr self,
TTPtr attr,
long *ac, t_atom **av);
45 t_max_err nmspc_set_relative(
TTPtr self,
TTPtr attr,
long ac,
const t_atom *av);
57 ModularSpec *spec =
new ModularSpec;
58 spec->_wrap = &WrapTTExplorerClass;
59 spec->_new = &WrappedExplorerClass_new;
60 spec->_free = &WrappedExplorerClass_free;
66 void WrapTTExplorerClass(WrappedClassPtr c)
69 class_addmethod(c->maxClass, (method)nmspc_assist,
"assist", A_CANT, 0);
71 class_addmethod(c->maxClass, (method)nmspc_return_value,
"return_value", A_CANT, 0);
73 class_addmethod(c->maxClass, (method)nmspc_return_model_address,
"return_model_address", A_CANT, 0);
75 class_addmethod(c->maxClass, (method)nmspc_return_selection,
"return_selection", A_CANT, 0);
77 class_addmethod(c->maxClass, (method)nmspc_bang,
"bang", 0);
79 class_addmethod(c->maxClass, (method)nmspc_symbol,
"anything", A_GIMME, 0);
81 class_addmethod(c->maxClass, (method)nmspc_bang,
"explore", 0);
85 CLASS_ATTR_ENUM(c->maxClass,
"output", 0,
"descendants children brothers attributes");
88 CLASS_ATTR_ACCESSORS(c->maxClass,
"format", nmspc_get_format, nmspc_set_format);
89 CLASS_ATTR_ENUM(c->maxClass,
"format", 0,
"none umenu umenu_prefix jit.cellblock coll");
92 CLASS_ATTR_ACCESSORS(c->maxClass,
"relative", nmspc_get_relative, nmspc_set_relative);
93 CLASS_ATTR_STYLE(c->maxClass,
"relative", 0,
"onoff");
96 void WrappedExplorerClass_new(
TTPtr self,
long argc, t_atom *argv)
99 long attrstart = attr_args_offset(argc, argv);
108 if (attrstart && argv) {
110 if (atom_gettype(argv) == A_SYM) {
112 name = atom_getsym(argv);
116 object_error((t_object*)x,
"argument not expected");
120 x->
outlets = (TTHandle)sysmem_newptr(
sizeof(
TTPtr) * 2);
121 x->
outlets[size_out] = outlet_new(x, NULL);
122 x->
outlets[data_out] = outlet_new(x, NULL);
127 attr_args_process(x, argc, argv);
130 void WrappedExplorerClass_free(
TTPtr self)
136 void nmspc_assist(
TTPtr self,
void *b,
long msg,
long arg,
char *dst)
139 strcpy(dst,
"input");
143 strcpy(dst,
"result of exploration");
146 strcpy(dst,
"size of the result (after the result)");
149 strcpy(dst,
"dumpout");
155 void nmspc_subscribe(
TTPtr self)
160 TTAddress absoluteAddress, returnedAddress;
172 contextAddress = v[0];
176 if (contextAddress != kTTAdrsEmpty) {
181 makeInternals_receiver(x, contextAddress,
TTSymbol(
"/model:address"), gensym(
"return_model_address"), anObject, YES);
197 defer_low((t_object*)x, (method)nmspc_subscribe, NULL, 0, 0);
201 void nmspc_return_model_address(
TTPtr self, t_symbol *msg,
long argc, t_atom *argv)
219 void nmspc_return_value(
TTPtr self, t_symbol *msg,
long argc, t_atom *argv)
227 t_atom a[1], c[2], j[3];
241 if (x->msg == gensym(
"umenu") || x->msg == gensym(
"umenu_prefix")) {
244 outlet_anything(x->
outlets[data_out], _sym_clear, 0, NULL);
247 if (x->msg == gensym(
"umenu_prefix")) {
250 outlet_anything(x->
outlets[data_out], gensym(
"prefix_mode"), 1, a);
253 if (address.
getName() == S_SEPARATOR) {
257 if (output == kTTSym_attributes)
260 atom_setsym(a, gensym((
char*)prefix.data()));
265 if (output == kTTSym_children)
267 else if (output == kTTSym_brothers)
269 else if (output == kTTSym_attributes)
274 atom_setsym(a, gensym((
char*)prefix.data()));
277 outlet_anything(x->
outlets[data_out], gensym(
"prefix"), 1, a);
282 for (i = 0; i < argc; i++) {
283 s = atom_getsym(argv+i);
285 if (output == kTTSym_descendants && address.
getName() == S_SEPARATOR)
286 if (s->s_name[0] == C_SEPARATOR)
287 s = gensym(s->s_name+1);
289 if (output == kTTSym_attributes)
292 if (output == kTTSym_brothers && s == _sym_bang)
297 outlet_anything(x->
outlets[data_out], _sym_append, 1, a);
303 else if (x->msg == gensym(
"jit.cellblock")) {
306 atom_setsym(a, gensym(
"all"));
307 outlet_anything(x->
outlets[data_out], _sym_clear, 1, a);
310 atom_setlong(a, argc);
311 outlet_anything(x->
outlets[data_out], gensym(
"rows"), 1, a);
315 for (i = 0; i < argc; i++) {
316 s = atom_getsym(argv+i);
318 if (output == kTTSym_attributes)
321 if (output == kTTSym_brothers && s == _sym_bang)
326 atom_setlong(j+1, i);
328 outlet_anything(x->
outlets[data_out], _sym_set, 3, j);
334 else if (x->msg == gensym(
"coll")) {
337 outlet_anything(x->
outlets[data_out], _sym_clear, 0, NULL);
341 for (i=0; i<argc; i++) {
342 s = atom_getsym(argv+i);
344 if (output == kTTSym_attributes)
347 if (output == kTTSym_brothers && s == _sym_bang)
352 atom_setlong(c+1, 0);
353 outlet_anything(x->
outlets[data_out], _sym_store, 2, c);
359 else if (x->msg == gensym(
"none") || x->msg == _sym_nothing) {
361 outlet_atoms(x->
outlets[data_out], argc, argv);
362 else if (msg != _sym_nothing)
363 outlet_anything(x->
outlets[data_out], msg, argc, argv);
368 atom_setlong(a, argc);
369 outlet_anything(x->
outlets[size_out], _sym_int, 1, a);
372 void nmspc_return_selection(
TTPtr self, t_symbol *msg,
long argc, t_atom *argv)
389 if (x->msg == gensym(
"umenu") || x->msg == gensym(
"umenu_prefix")) {
392 outlet_anything(x->
outlets[data_out], gensym(
"clearchecks"), 0, NULL);
395 for (i = 0; i < (
TTUInt32) argc; i++) {
396 state = atom_getlong(argv+i);
398 atom_setlong(u+1, state);
399 outlet_anything(x->
outlets[data_out], gensym(
"checkitem"), 2, u);
404 else if (x->msg == gensym(
"jit.cellblock")) {
407 for (i = 0; i < (
TTUInt32) argc; i++) {
410 atom_setlong(j+1, i);
411 atom_setsym(j+2, gensym(
"brgb"));
413 state = atom_getlong(argv+i);
416 atom_setlong(j+3, 158);
417 atom_setlong(j+4, 0);
418 atom_setlong(j+5, 92);
421 atom_setlong(j+3, 0);
422 atom_setlong(j+4, 0);
423 atom_setlong(j+5, 0);
426 outlet_anything(x->
outlets[data_out], gensym(
"cell"), 6, j);
431 else if (x->msg == gensym(
"coll")) {
436 else if (x->msg == gensym(
"none") || x->msg == _sym_nothing)
437 outlet_anything(x->
outlets[data_out], gensym(
"selection"), argc, argv);
440 void nmspc_bang(
TTPtr self)
445 if (x->msg == gensym(
"umenu") || x->msg == gensym(
"umenu_prefix"))
446 outlet_anything(x->
outlets[data_out], _sym_clear, 0, NULL);
451 void nmspc_symbol(
TTPtr self, t_symbol *msg,
long argc, t_atom *argv)
467 v.
append(absoluteAddress);
470 object_error((t_object*)x,
"set relative attribute on before to send relative address");
478 if (x->msg == gensym(
"umenu") || x->msg == gensym(
"umenu_prefix"))
479 outlet_anything(x->
outlets[data_out], _sym_clear, 0, NULL);
535 t_max_err nmspc_get_format(
TTPtr self,
TTPtr attr,
long *ac, t_atom **av)
544 if (!(*av = (t_atom*)getbytes(
sizeof(t_atom)*(*ac)))) {
546 return MAX_ERR_OUT_OF_MEM;
550 atom_setsym(*av, x->msg);
555 t_max_err nmspc_set_format(
TTPtr self,
TTPtr attr,
long ac, t_atom *av)
560 x->msg = atom_getsym(av);
568 t_max_err nmspc_get_relative(
TTPtr self,
TTPtr attr,
long *ac, t_atom **av)
577 if (!(*av = (t_atom*)getbytes(
sizeof(t_atom)*(*ac)))) {
579 return MAX_ERR_OUT_OF_MEM;
583 atom_setlong(*av, x->
index);
588 t_max_err nmspc_set_relative(
TTPtr self,
TTPtr attr,
long ac,
const t_atom *av)
593 x->
index = atom_getlong(av);
599 defer_low((t_object*)x, (method)nmspc_subscribe, NULL, 0, 0);
TTAddress appendAddress(const TTAddress &toAppend)
Return a new TTAddress with the appended part.
TTObject subscriberObject
The instance of a TTSubscriber object used to register the wrapped object in the tree structure...
TTErr send(const TTSymbol aName)
Send a message to this object with no arguments.
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.
We build a directory of TTNodes, and you can request a pointer for any TTNode, or add an observer to ...
TTAddress address
sometime external needs to store an address (e.g. send, receive, view, ...)
TTSymbol patcherClass
the patcher class in which the external is
The TTAddress class is used to represent a string and efficiently pass and compare that string...
Create and use Jamoma object instances.
t_object * patcherPtr
the patcher in which the external is (ignoring subpatcher)
int C74_EXPORT main(void)
Set up this class as a Max external the first time an object of this kind is instantiated.
void append(const T &anElementValueToAppend)
Insert a single TTElement at the end.
void * TTPtr
A generic pointer.
TTErr get(const TTSymbol aName, T &aReturnedValue) const
Get an attribute value for an object.
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...
TTAddress patcherAddress
the patcher address in which the external is
TTObject wrappedObject
The instance of the Jamoma object we are wrapping.
this flag means that an address have a leading slash
const char * c_str() const
Return a pointer to the internal string as a C-string.
std::int32_t TTInt32
32 bit signed integer
Data Structure for this object.
TTAddressType getType()
Get the type.
Wraps Jamoma Core classes as objects for Max/MSP.
std::uint32_t TTUInt32
32 bit unsigned integer
TTSymbol patcherContext
the patcher context in which the external is (model, view)
TTSymbol patcherName
the patcher name in which the external is
The TTString class is used to represent a string.
long index
index of the inlet used
TTBoolean valid() const
Determine if the object contained by this TTObject is truly ready for use.
TTSymbol & getName()
Get the name part.
WrappedModularInstance * WrappedModularInstancePtr
Pointer to a wrapped instance of our object.
[doxygenAppendixC_copyExample]