Message Manager


#1

Hi,

I want to send messages from a class A to a class B. My class B contains a audioDeviceCallback function where I want to send messages to my class A. For example the class A needs to know some audio information to update a VU Meter, or when the audio callback has stopped.
Both class herits from MessageListener. I know I have to use a MessageManager to make it work, but I don’t know how and I didn’t find anything about it. Could someone show me an example, or explain me the way to make it work? Thanks a lot.

Leskimo


#2

you’re probably better off using changeListeners or actionListeners.

Make one class a listener, and the other a broadcaster, then when instantiating them register the listener class with the broadcaster class by using

myBroadcasterObject.addActionListener(myListenerObject);

Then the the broadcaster class can simply call sendActionMessage() when it thinks something interesting has happened.

For change listeners, use change instead of action in the exampe above


#3

thanks, that’s exactly what I needed :smiley:

Leskimo


#4