I'd like to use PyGTK as the basis for a cross-platform (Win/Mac/Linux)
controller for MIDI keyboards, but there's no built-in MIDI support, so
I'll need to write my own, which will of course involve writing three
different C modules, one for each platform. What I'd like to know is how
to deal with the issue of making asynchronously received data present
itself as some sort of event.

In Linux, this is pretty easy, because the MIDI input has a file
descriptor, which one can monitor with gdk_input_add. But neither MacOS or
Windows represent MIDI devices by file handles which can be monitored this
way. MacOS uses a callback function which is executed in the context of
some other thread, and Windows can use a callback function or can send
MIDI messages to a window or thread.

I suppose a callback could write the data to a pipe that is monitored at
the other end with gdk_input_add, which might handle the MacOS case, but I
have a sneaking suspicion that that isn't well-supported in Windows, since
there is no kernel function analogous to poll() or select() for anything
but sockets.

So does anyone have any experience trying to shoehorn non-standard forms
of asynchronously arriving input data into the GTK or PyGTK event loop, on
the Mac or Windows?

-- 

Ciao,               Paul D. DeRocco
Paul                mailto:[email protected] 
 

_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to