[LAD] MIDI in jack

Pedro Lopez-Cabanillas pedro.lopez.cabanillas at gmail.com
Sun Jul 6 17:15:57 UTC 2014


On Sunday 06 July 2014 09:44:57 Len Ovens wrote:
> On Sun, 6 Jul 2014, Brett McCoy wrote:
> > You might want to take a look at some previous implementations of
> > similar ideas (using console keyboard for MIDI). They use the ALSA
> > sequencer, I believe
> > 
> > http://vmpk.sourceforge.net/
> > 
> > http://alsa.opensrc.org/Vkeybd
> 
> Some of that code will be useful, but both of these run in user space and
> use the Xorg keyboard inputs. This means that if I have a synth connected
> to virtual kb, as soon as I try to change the synth patch, I loose my
> virtual keyboard access because keyboard follows focus to the synth
> application (which is what we want almost always). That is why I have to
> run as a system user.

VMPK has an option (Edit->Preferences):
[x] Grab Computer Keyboard

If you enable this option, VMPK grabs keyboard events no matter which 
application has the focus. It will be temporarily disabled when you minimize 
VMPK's main window, and re-enabled when restoring it again. It is also 
disabled when you open a dialog. 

To do so in X11 applications you only need to invoke the XGrabKeyboard 
function: http://www.x.org/archive/X11R7.5/doc/man/man3/XGrabKeyboard.3.html
There may be problems using this function in your program while running other  
gtk+ based programs at the same time, because it is used by gtk+ menus as 
well.

Regards,
Pedro


More information about the Linux-audio-dev mailing list