querying pattr system

Jan 11, 2010 at 5:30am

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?

#47700
Jan 11, 2010 at 6:17am

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).

#171542
Jan 11, 2010 at 12:36pm

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.

Thanks

#171543
Jan 11, 2010 at 2:27pm

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.

#171544
Jan 11, 2010 at 3:20pm

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.

HTH

#171545
Jan 11, 2010 at 4:37pm

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?

#171546
Jan 11, 2010 at 7:21pm

The easy way is to do as you suggest, or use one of the ‘iterator’ objects in the SDK as a model.

Cheers

#171547

You must be logged in to reply to this topic.