instantiating and accessing abstraction inlets/outlets
(These questions might keep coming. looks like I’ll be a noob for a minute.)
I’m instantiating abstractions with the included code. I’m looking to create a static object that lets you access a single abstraction from a number of named objects. (similar to buffer~ or coll.) I’m thinking this could make the oo.* objects very useful.
my tasks are
A) counting the inlets and outlets so that I can give the wrapper object the same number of inlets and outlets. (I know this is stored in t_object but it’s "subject to change")
B) sending incoming messages to specific inlets in the abstraction
C) listening to specific outlets of the abstraction
I’ve figured out how to make a centralized struct that’s shared amongst objects. And I stole the following code from the scriptto example. But I’m unsure where to look in the documentation for the rest of this information
Any fingers pointing in the right direction would be much appreciated.
t_dictionary *d = dictionary_new(); char parsebuf; t_atom a; long ac = 0; t_atom *av = NULL; // create a patcher without scroll bars and a toolbar sprintf(parsebuf,"@defrect 0 0 300 400 @title scripto @enablehscroll 0 @enablevscroll 0 @presentation 0 @toolbarid """); atom_setparse(&ac,&av,parsebuf); attr_args_dictionary(d,ac,av); atom_setobj(&a,d); sysmem_freeptr(av); myData->s_patcher=(t_object *)object_new_typed(CLASS_NOBOX,atom_getsym(argv+1),1, &a); freeobject((t_object *)d); // we created this dictionary and we don't need it anymore object_method(myData->s_patcher,gensym("vis")); object_attach_byptr_register(x, myData->s_patcher, CLASS_NOBOX);// attach our UI object to us
UG!!! That hour I'll never get back! I've just noticed that the tables of patcher and box attributes run off the edge of the page in the PDF version. The HTML version is complete.
Thanks for your clue!
As for B/C it looks like I'll have to put my static object inside a static patcher, count the inlets and outlets and script little mat.static.in/out objects.
I have. In fact I use them a lot. The goal here is different. I’d like to be able to access a single data structure from anywhere in any patcher hierarchy. I also think the patching is going to be more elegant. Here’s a sketch of what I’m thinking in pseudocode. Adding a refer message would be off the hook too.
-- Pasted Max Patch, click to expand. --Copy all of the following text. Then, in Max, select New From Clipboard.----------begin_max5_patcher---------- 1312.3oc4ZsraiaCEcs8WAg.5p5FvW5U20cs.CPWzosKJFLP1l0QCrdTI5LI cv7uWwGxQiiUBEkLkS5FaHZJ5KO5bO2GheY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DkP1KznSTzh7seUWIXu3gt9CKpnK7M QAc8CLHaIJAudqKqezHz55qvyHbXTBLSBqQEyBGZcpMn4Te4h9hEHeSVeV7Z EPNQpYru8RR2FhaQs1nfW+8AyWlvQnwmuFR2zcsPpE4j2zu6OCDZUWsNhMGA hqmfyi5jbclRjB5dTrrRN4+EAjZKE.YcDoQ4aI+W71mle5Q3UZphw+Vvqt3P 0l18a6g3A7nwtkUySykBNcljncQclzsoa2xx6VJ21zZQ0ca6uU.lZOm7W0i8 D4L6Q7t1GO9jktsrnI0v5isqJVTHfuer5vmDJ6J5IWhzBR5IKu7QCY51gQWW L.jQ1Czc1iILRj6XjlPHoty+vDvI1cxGDSHOtCd7gFXO9tydjJmnWh83Nmch IN6mnAeQoyTCvGRjasG3Uj8fL44ki4yuH93P9brI3CxcOuLQ+g3N8YhIASoP 2ZOHSddgbi8DXf8fcq47ROtBbWpXl3cQbm8XB53NsGipbxcJyFXMtKtExn7T cXQNlPc7utLGjsg0UMoHor7NVUsdMklhWVxmJpDWFrRdYZt5R4J5UwtKsc9Q KEq1WW9e.Wxc9cA -----------end_max5_patcher-----------
It works with both abstractions and C objects. Now you can even switch between named structures like coll!
The only thing I can’t quite get working is a double click function that would open the internal object.
Right now it opens the patcher that contains the internal object which is kind of ghetto. Also if you close that window, the patcher is freed for some reason which makes the external unstable.
is there a way to determine if an object has a subpatcher inside it and also a way to get that subpatcher?
Give it a shot. I can upload the xcode project if you want it.
See if it this compiles (or if it’s even written correctly) It’s working nicely for me for what it’s worth.
I don’t know what’s Max 5 or 6 API or 10.4 or 10.6. I don’t even know how to reliably change the compile location :-)
I just realized that’s fairly uncommented. I can do that. If you’re actually interested in picking it apart let me know.
See what you think. I’ve heavily commented this and included a help file. It’s already been super helpful in patching. I don’t think I’m doing anything over the line here but then again I don’t know where the line is.
Forums > Dev