querying pattr system
For some externals I’m planning, I would like to be able to query the values of named [pattr] objects and named UI objects that have been exposed to the pattr system by [autopattr]. I’m kind of lost on where to look for info on this (and with searching specific forums still broken on the new site, that hasn’t been much help).
In the "Preset Support" section of "Enhancements to Objects" in the Max5 API, there is mention of "more powerful and general state-saveing, use the pattr system described below" but no more pattr mentions after that. After browsing around the modules I came across places that suggested reading the PattrSDK from Max-4.5.5-SDK for more details, but as far as I can tell, that only has information on registering your objects with the pattr system (?). Is what I’m looking for documented anywhere? Or if not, does anyone have an example?
To clarify, I am specifically asking how my external can receive a notification when the value of an object bound to the pattr system changes. I’m guessing this could be done with object_attach(), but I’m not sure of the name_space involved.
Although it would also be useful to know how to query the value at a time of my choosing (which it sounded like I was asking in my first post).
To query an object’s attribute value use object_attr_getvalueof() and related functions.
To listen for notifications use object_attach() and then define a "notify" message for your object as described in the SDK.
I’ll correct the errant text you mention in the SDK documentation.
Is there documented pattern to the name_space of named [pattr] or named UI objects? Or is the best method to find them for attaching to search the linked list of jboxes in the appropriate jpatcher for the desired [pattr] (Or named UI object)?
P.S. If you are making edits to that page, you may also want to take care of the last thing on the page "buffer support~". Looks like some sort of heading for nothing.
Every object that you can create and use in a patcher is in the "box" namespace. There is also a "nobox" namespace which includes objects you can’t use in a patcher, like atomarray and linklist.
Thanks for the help with these newbie questions. I meant to edit my last post but ran out of time before I needed to leave for class.
I guess I am asking if there an easy way to find an object already found by an [autopattr] to attach to, or do I need to search the appropriate list of jboxes to find it by varname?
The easy way is to do as you suggest, or use one of the ‘iterator’ objects in the SDK as a model.