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
did someone try this already?
It's not possible to do that from Java. There's a specific kind of notification that you can listen to, in C though.
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.
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
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.
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)