Forums > Java

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

June 2, 2012 | 11:16 pm

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


June 6, 2012 | 9:09 am

did someone try this already?


June 13, 2012 | 10:16 am

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


June 13, 2012 | 6:16 pm

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.


June 13, 2012 | 6:19 pm

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


June 13, 2012 | 6:34 pm

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.


June 13, 2012 | 7:08 pm

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)


Viewing 7 posts - 1 through 7 (of 7 total)