Re: [gtk-list] Re: Software design question (pthread or special widget)?
- From: Jake Donham <jake bitmechanic com>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re: Software design question (pthread or special widget)?
- Date: 05 Mar 1999 13:15:36 -0500
"David" == David J Topper <topper@virginia.edu> ruminates:
David> But I still need to fork (or pthread) off a new process to
David> do the MIDI polling. No?
No.
David> I was wondering if there's a way to link up with whatever
David> kind of poller/scheduler/event handler that GTK has ... but
David> for MIDI events instead of screen/X events. A GtkMIDI
David> widget would be pretty darn cool!
Exactly... that's what the previous posters were talking about with
gdk_input_add(). All you have to do is call
gdk_input_add(fd, GDK_INPUT_READ, (GdkInputFunction)handle_midi, data);
where fd is the file descriptor to your MIDI stream (e.g. /dev/midi or
/dev/music), handle_midi is a function wherein you can read from the
file descriptor and take action based on the MIDI data, and data is
arbitrary data to pass into the function (much like with signals).
The function will be called whenever data is ready on the file
descriptor. This magic is accomplished by GDK with the select() call.
--
Jake Donham
free and restless, growing and full of hope
http://www.bitmechanic.com/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]