It sounds to me like a keylogger as the input + MIDI (Jack or ALSA) as
output. Maybe a ring buffer or something in between.
If a keylogger is the kind of input you wish:
https://www.thc.org/papers/writing-linux-kernel-keylogger.txt
Trying to guess a naive code implementation, I foresee two problems:
- If one press a key and keep it pressed, the computer keyboard
repeeeeeeeeeeeeeeeeeeeeat the key, generating several NOTE_ON midi
events.
- Without a high level API I don´t know if you will have a KEY_RELEASE
event to generate a NOTE_OFF event. If you have it you can solve the
former problem.
Cheers
Schiavoni
Em 06-07-2014 12:57, Len Ovens escreveu:
Hello new to this list but realized I was asking a lot
of development
questions in LAU that would probably be better here.
I am writing a program that takes some system input from the keyboard
and redirects it as midi. This is to allow:
- a second keyboard to be used as a midi control
- switching the system keyboard back and forth between normal and midi
controler
- using a potion of the system keyboard as a midi controler (the
numeric pad for example)
The advantage of this over keyboard short cuts is that this will work
the same no matter what the desktop focus may be.
I am (as many people do) writing this for my own use, but will make it
available for others who may have similar needs.
My question:
Where and how is the best place to put the MIDI port?
My first thought was to get it to create a jack midi port as this
would be the most direct. The problems I see with this are, 1) my
program will run as a different user than Jackd, 2) my program will
run before and perhaps after jackd.
SO then I thought I guess I have to use ALSA for my midi port. I need
to know if I do this, will jackd that is running a different backend
than alsa (firewire for example) still see the alsa midi ports? I am
guessing that a2jmidid would still work in any case, but not everyone
uses that.
Assuming I have to use alsa midi (unless some one can suggest how to
make this work with jack midi), I have noticed that some aplications
that use alsa midi do not leave a visible port in alsa and do all
connections internally which would be useless in this case. There are
some examples of code at
http://www.tldp.org/HOWTO/MIDI-HOWTO-9.html
and I was wondering if this method will leave visible midi ports. I am
also noticing it 2004 ish, is the info still valid, or is there a
better place to look?
The keyboard input and grabbing will be based on the code from actkbd
as it seems to already do all that stuff and is gpl2 (and besides the
code looks understandable to me)
--
Len Ovens
www.ovenwerks.net
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev(a)lists.linuxaudio.org
http://lists.linuxaudio.org/listinfo/linux-audio-dev