Re: Controlling GTK from MIDI?



"Craig S. Kaplan" wrote:

I just bought a Peavey PC1600x, a programmable button/slider
box that generates MIDI events.  My big brainwave is that
I'd like to be able to use these MIDI events to control
widgets and behaviour in a GTK application.  Wouldn't it
be wonderful to right-click on a slider in GTK and tell it
to obtain its position from slider #7 of the slider box?
Just thinking about it gets me all misty-eyed.

The problem is that I'm not sure about the best way to go
about doing this.  Let's consider the simplest case --
MIDI events are somehow translated into new GdkEvents and
fed into the event pipe with everything else.  How would
you go about doing this?

 * The app could open /dev/midi and start parsing events,
   waiting on MIDI input using gdk_input_add, but doesn't
   that mean that only one such app can be open at a time?
   And how would you send events to the correct widget?

 * It seems like the ideal setup would be to create a bridge
   (in the form of a daemon) that processes MIDI events and
   hands them over to X.  Then GTK wouldn't have to change
   at all.  I don't know much about programming X, but it seems
   that this won't work without specifying a new XInput device
   and registering it in my XF86Config, which seems rather
   heavyhanded (and dangerous if it breaks!).

Anyway, this is sort of an open-ended question and I'm
interested in all your ideas on building a bridge from this
device to my application.  Thanks all for any help!


The daemon idea sounds quite neat, but I don't think I'd bother
with XInput - at least not in the short term. If you wrote the
daemon and GTK+ client with a CORBA interface, you could write
an elegant interface for each widget on the Peavey. A client
could register its interest in a particular widget on the box,
amd then the daemon could notify the client of changes.

Chris
--
protracted full-body tweezer depiliation




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]