On Fri, 30 Nov 2001 23:52, Mark Hahn wrote:
> > have all your realtime code running in the same thread as you gui
>
> How do you do this?  I thought the ruby thread with fltk had to be sitting
> at the Fltk::run call.  How can you run any other code in that thread?

	Fltk::add_timeout, Fltk::add_idle, and a few others (if they are wrapped) 
allow you to have a block of ruby code executed from within Fltk::run

	All I'm doing is using a 1 millisecond timeout that call my drive() 
function. This function does the following (all written in ruby-c):

	* polls any open midi in ports with select
	* parses any data coming in the ports into ruby classes
	* trigger a series of callbacks related to the event 
	* executes any scheduled tasks with date <= currentTime

	I''m using a scheduler based on one described in "Realtime Schedulers and 
Computer Accompaniment" by Roger Dannenberg in "Elements of Computer Music".

	If you want accurate timing using fltk 1.0x you will need to hack the select 
calls to reduce the timeouts (it defaults to 10ms). Fltk 1.1 has apparently 
done a big re-design of the timing subsection, so this is not needed, and I 
see that Takaaki has updated the ruby-fltk cvs with my changes for fltk 1.1 
and a lot more besides.

Lorien Dunn