25 void WrapTTExplorerClass(WrappedClassPtr c);
26 void WrappedExplorerClass_new(
TTPtr self,
long argc, t_atom *argv);
27 void WrappedExplorerClass_free(
TTPtr self);
29 void nmspc_assist(
TTPtr self,
void *b,
long m,
long a,
char *s);
31 void nmspc_return_value(
TTPtr self, t_symbol *msg,
long argc, t_atom *argv);
33 void nmspc_return_selection(
TTPtr self, t_symbol *msg,
long argc, t_atom *argv);
35 void nmspc_bang(
TTPtr self);
36 void nmspc_symbol(
TTPtr self, t_symbol *msg,
long argc, t_atom *argv);
38 void nmspc_subscribe(
TTPtr self);
40 void nmspc_return_model_address(
TTPtr self, t_symbol *msg,
long argc, t_atom *argv);
42 t_max_err nmspc_get_format(
TTPtr self,
TTPtr attr,
long *ac, t_atom **av);
43 t_max_err nmspc_set_format(
TTPtr self,
TTPtr attr,
long ac, t_atom *av);
45 t_max_err nmspc_get_relative(
TTPtr self,
TTPtr attr,
long *ac, t_atom **av);
46 t_max_err nmspc_set_relative(
TTPtr self,
TTPtr attr,
long ac, t_atom *av);
56 extern "C" void JAMOMA_EXPORT_MAXOBJ setup_j0x2enamespace(
void)
58 ModularSpec *spec =
new ModularSpec;
59 spec->_wrap = &WrapTTExplorerClass;
60 spec->_new = &WrappedExplorerClass_new;
61 spec->_free = &WrappedExplorerClass_free;
67 void WrapTTExplorerClass(WrappedClassPtr c)
70 eclass_addmethod(c->pdClass, (method)nmspc_assist,
"assist", A_CANT, 0);
72 eclass_addmethod(c->pdClass, (method)nmspc_return_value,
"return_value", A_CANT, 0);
74 eclass_addmethod(c->pdClass, (method)nmspc_return_model_address,
"return_model_address", A_CANT, 0);
76 eclass_addmethod(c->pdClass, (method)nmspc_return_selection,
"return_selection", A_CANT, 0);
78 eclass_addmethod(c->pdClass, (method)nmspc_bang,
"bang", A_NULL, 0);
80 eclass_addmethod(c->pdClass, (method)nmspc_symbol,
"anything", A_GIMME, 0);
82 eclass_addmethod(c->pdClass, (method)nmspc_bang,
"explore", A_NULL, 0);
84 eclass_addmethod(c->pdClass, (method)NULL,
"loadbang", A_NULL, 0);
92 CLASS_ATTR_ACCESSORS(c->pdClass,
"format", nmspc_get_format, nmspc_set_format);
96 CLASS_ATTR_ACCESSORS(c->pdClass,
"relative", nmspc_get_relative, nmspc_set_relative);
97 CLASS_ATTR_STYLE(c->pdClass,
"relative", 0,
"onoff");
100 void WrappedExplorerClass_new(
TTPtr self,
long argc, t_atom *argv)
103 long attrstart = attr_args_offset(argc, argv);
112 if (attrstart && argv) {
114 if (atom_gettype(argv) == A_SYM) {
116 name = atom_getsym(argv);
120 pd_error((t_object*)x,
"argument not expected");
124 x->
outlets = (TTHandle)sysmem_newptr(
sizeof(
TTPtr) * 2);
125 x->
outlets[size_out] = outlet_new((t_object*)x, NULL);
126 x->
outlets[data_out] = outlet_new((t_object*)x, NULL);
131 attr_args_process(x, argc, argv);
134 void WrappedExplorerClass_free(
TTPtr self)
140 void nmspc_assist(
TTPtr self,
void *b,
long msg,
long arg,
char *dst)
143 strcpy(dst,
"input");
147 strcpy(dst,
"result of exploration");
150 strcpy(dst,
"size of the result (after the result)");
153 strcpy(dst,
"dumpout");
159 void nmspc_subscribe(
TTPtr self)
164 TTAddress absoluteAddress, returnedAddress;
176 contextAddress = v[0];
180 if (contextAddress != kTTAdrsEmpty) {
185 makeInternals_receiver(x, contextAddress,
TTSymbol(
"/model:address"), gensym(
"return_model_address"), anObject, YES);
206 void nmspc_return_model_address(
TTPtr self, t_symbol *msg,
long argc, t_atom *argv)
224 void nmspc_return_value(
TTPtr self, t_symbol *msg,
long argc, t_atom *argv)
232 t_atom a[1], c[2], j[3];
246 if (x->msg == gensym(
"umenu") || x->msg == gensym(
"umenu_prefix")) {
249 outlet_anything((t_outlet*)x->
outlets[data_out], _sym_clear, 0, NULL);
252 if (x->msg == gensym(
"umenu_prefix")) {
255 outlet_anything((t_outlet*)x->
outlets[data_out], gensym(
"prefix_mode"), 1, a);
258 if (address.
getName() == S_SEPARATOR) {
262 if (output == kTTSym_attributes)
265 atom_setsym(a, gensym((
char*)prefix.data()));
270 if (output == kTTSym_children)
272 else if (output == kTTSym_brothers)
274 else if (output == kTTSym_attributes)
279 atom_setsym(a, gensym((
char*)prefix.data()));
282 outlet_anything((t_outlet*)x->
outlets[data_out], gensym(
"prefix"), 1, a);
287 for (i = 0; i < argc; i++) {
288 s = atom_getsym(argv+i);
290 if (output == kTTSym_descendants && address.
getName() == S_SEPARATOR)
291 if (s->s_name[0] == C_SEPARATOR)
292 s = gensym(s->s_name+1);
294 if (output == kTTSym_attributes)
297 if (output == kTTSym_brothers && s == _sym_bang)
302 outlet_anything((t_outlet*)x->
outlets[data_out], _sym_append, 1, a);
308 else if (x->msg == gensym(
"jit.cellblock")) {
311 atom_setsym(a, gensym(
"all"));
312 outlet_anything((t_outlet*)x->
outlets[data_out], _sym_clear, 1, a);
315 atom_setlong(a, argc);
316 outlet_anything((t_outlet*)x->
outlets[data_out], gensym(
"rows"), 1, a);
320 for (i = 0; i < argc; i++) {
321 s = atom_getsym(argv+i);
323 if (output == kTTSym_attributes)
326 if (output == kTTSym_brothers && s == _sym_bang)
331 atom_setlong(j+1, i);
333 outlet_anything((t_outlet*)x->
outlets[data_out], _sym_set, 3, j);
339 else if (x->msg == gensym(
"coll")) {
342 outlet_anything((t_outlet*)x->
outlets[data_out], _sym_clear, 0, NULL);
346 for (i=0; i<argc; i++) {
347 s = atom_getsym(argv+i);
349 if (output == kTTSym_attributes)
352 if (output == kTTSym_brothers && s == _sym_bang)
357 atom_setlong(c+1, 0);
358 outlet_anything((t_outlet*)x->
outlets[data_out], _sym_store, 2, c);
364 else if (x->msg == gensym(
"none") || x->msg == _sym_nothing) {
366 outlet_anything((t_outlet*)x->
outlets[data_out], _sym_nothing, argc, argv);
367 else if (msg != _sym_nothing)
368 outlet_anything((t_outlet*)x->
outlets[data_out], msg, argc, argv);
373 atom_setlong(a, argc);
374 outlet_anything((t_outlet*)x->
outlets[size_out], _sym_int, 1, a);
377 void nmspc_return_selection(
TTPtr self, t_symbol *msg,
long argc, t_atom *argv)
394 if (x->msg == gensym(
"umenu") || x->msg == gensym(
"umenu_prefix")) {
397 outlet_anything((t_outlet*)x->
outlets[data_out], gensym(
"clearchecks"), 0, NULL);
400 for (i = 0; i < (
TTUInt32) argc; i++) {
401 state = atom_getlong(argv+i);
403 atom_setlong(u+1, state);
404 outlet_anything((t_outlet*)x->
outlets[data_out], gensym(
"checkitem"), 2, u);
409 else if (x->msg == gensym(
"jit.cellblock")) {
412 for (i = 0; i < (
TTUInt32) argc; i++) {
415 atom_setlong(j+1, i);
416 atom_setsym(j+2, gensym(
"brgb"));
418 state = atom_getlong(argv+i);
421 atom_setlong(j+3, 158);
422 atom_setlong(j+4, 0);
423 atom_setlong(j+5, 92);
426 atom_setlong(j+3, 0);
427 atom_setlong(j+4, 0);
428 atom_setlong(j+5, 0);
431 outlet_anything((t_outlet*)x->
outlets[data_out], gensym(
"cell"), 6, j);
436 else if (x->msg == gensym(
"coll")) {
441 else if (x->msg == gensym(
"none") || x->msg == _sym_nothing)
442 outlet_anything((t_outlet*)x->
outlets[data_out], gensym(
"selection"), argc, argv);
445 void nmspc_bang(
TTPtr self)
450 if (x->msg == gensym(
"umenu") || x->msg == gensym(
"umenu_prefix"))
451 outlet_anything((t_outlet*)x->
outlets[data_out], _sym_clear, 0, NULL);
456 void nmspc_symbol(
TTPtr self, t_symbol *msg,
long argc, t_atom *argv)
472 v.
append(absoluteAddress);
475 pd_error((t_object*)x,
"set relative attribute on before to send relative address");
483 if (x->msg == gensym(
"umenu") || x->msg == gensym(
"umenu_prefix"))
484 outlet_anything((t_outlet*)x->
outlets[data_out], _sym_clear, 0, NULL);
540 t_max_err nmspc_get_format(
TTPtr self,
TTPtr attr,
long *ac, t_atom **av)
549 if (!(*av = (t_atom*)getbytes(
sizeof(t_atom)*(*ac)))) {
555 atom_setsym(*av, x->msg);
560 t_max_err nmspc_set_format(
TTPtr self,
TTPtr attr,
long ac, t_atom *av)
565 x->msg = atom_getsym(av);
573 t_max_err nmspc_get_relative(
TTPtr self,
TTPtr attr,
long *ac, t_atom **av)
582 if (!(*av = (t_atom*)getbytes(
sizeof(t_atom)*(*ac)))) {
588 atom_setlong(*av, x->
index);
593 t_max_err nmspc_set_relative(
TTPtr self,
TTPtr attr,
long ac, t_atom *av)
598 x->
index = atom_getlong(av);
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
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)
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
t_symbol JAMOMA_EXPORT * jamoma_TTName_To_PdName(TTSymbol TTName)
Convert a TTSymbol "MyObjectMessage" into a t_symbol *"my/object/message" or return NULL if the TTSym...
const char * c_str() const
Return a pointer to the internal string as a C-string.
std::int32_t TTInt32
32 bit signed integer
Wraps Jamoma Core classes as objects for PureData.
Data Structure for this object.
TTAddressType getType()
Get the type.
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]
TTErr wrapTTModularClassAsPdClass(TTSymbol &ttblueClassName, const char *pdClassName, WrappedClassPtr *c, ModularSpec *specificities)
Wrap a Jamoma class as a Pd class.