[EMAIL PROTECTED] writes:

 > I'd like to consider using this to send the sound manager events of
 > interest, but a protocol for message passing must be reached.

Jon sent me some ideas by private mail, and they look workable -- it
really comes down to a judgement call about how frequently the
messages will be used.  If they're relatively infrequent (say, less
than a few every second, as seems the case), then we should optimize
for ease of coding rather than performance.

For low-volume messages, I very much like the Listener/Event model
used by JavaBeans, and would recommend something like it for JSBSim
and FlightGear.  Basically, Listeners implement an interface something
like this:

  class FDMEventListener
  {
  public:
    void fdmEvent (const FDMEvent &ev) = 0;
  };

where FDMEvent probably extends a common FGEvent base class.  The
class implementing FDMEventListener then registers itself with the
event provider, as in

  fdm->addEventListener(this);

When an event is ready, the event provider then runs down the list and
invokes the fdmEvent method of every event listener.  You could add
some granularity by naming event types:

  fdm->addEventListener("gear", this);

The sound manager would simply register itself with the FDM to receive
event notifications of things it's interested in, as would other
subsystems (including the GUI).

An alternative for FlightGear is a single, central event manager,
where the event provider notifies the manager, and the manager queues
up the events and informs the listeners.


All the best,


David

-- 
David Megginson
[EMAIL PROTECTED]


_______________________________________________
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel

Reply via email to