On Sunday, September 6, 2009, Iain Duncan wrote:
How do you communicate to the gui loop when it should
update
itself based on audio activity?
The GUI loop reads events from some event queue, and distpatches these events
to the graphic widgets. A strategy very easy to implement is to create and
insert new events into the event queue (without waiting to be consumed), so
they would be processed asynchronously using the proper GUI context. How
exactly to do this depends on the GUI system. Some examples:
In MS Windows, PostMessage() puts an event into the event loop
http://msdn.microsoft.com/en-us/library/ms644944(VS.85).aspx
For Qt applications, the equivalence is QCoreApplication::postEvent()
http://doc.trolltech.com/4.5/qcoreapplication.html#postEvent
There are similar functions in Mac OSX. See NSApplication::postEvent(). Maybe
somebody can explain an equivalence for glib/gtk+, if there is one?
Regards,
Pedro