Controlling GTK from MIDI?



Greetings GTK types,

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!

p.s. If you're a hardware type, think about building 
     USB-based button/slider/dial boxes!  That would rock.

--
Craig.              http://www.cs.washington.edu/homes/csk/
Counterfactuals: what would the world be like without them?





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