How can I use MessageReceiver interface/classe for listening attributes change ?

Jun 2, 2012 at 11:16pm

How can I use MessageReceiver interface/classe for listening attributes change ?

Hi mates,

I’m looking for a way to listen some attributes changing.
Especially, I’d like to track some objects OB3D position in space and some will move on their own.

instead of polling them every time or to make them sending their position every time (which is similar to permanent polling), can I use MessageReceiver ?

Or should I implement one MXJ with one jitterListener in each object ?

The real question is, what would be the most efficient way

thanks a lot for your help

#55975
Jun 6, 2012 at 9:09am

did someone try this already?

#201113
Jun 13, 2012 at 10:16am

It’s not possible to do that from Java. There’s a specific kind of notification that you can listen to, in C though.

#201114
Jun 13, 2012 at 6:16pm

at least in javascript, you can get a notification message when attributes of an object are changed (something like attr_modified) however it doesn’t give you any info about which attr.

#201115
Jun 13, 2012 at 6:19pm

I got it.
requesting values by using (getXXXXX) messages triggered by the global qmetro can do that.
I guess it is another design pattern I can use

#201116
Jun 13, 2012 at 6:34pm

If you use pattr and pattrstorage you can use the latter to provide notifications. I believe you would need to set pattrstorage’s @outputmode attribute properly for this to work.

If I remember correctly, pattrtorage does not interrogate a jitter object’s internal attributes, so you’d have to set up various GUI objects (i.e. int or float number boxes) to feed messages appropriately, and then track those GUI objects using pattr. But since you’re driving much of this from a Java core this should not be hard to place into the patcher flow.

#201117
Jun 13, 2012 at 7:08pm

Jesse, I needed that because in my design, I thought I’ll “observe” parameters/attributes.
finally, I’m now using global matrices and requesting my params from them (on events or scheduled)

#201118

You must be logged in to reply to this topic.