[linux-audio-dev] Howto grab keys?

Pamplemousse_mk2 pamplemousse_mk2 at netcourrier.com
Fri Aug 20 10:56:00 UTC 2004


Hello,

I'm using PortAudio library to try to program a loop-sampler software 
under Linux (and perhaps Windows). Actually, I would like to make a 
console-based software. I would like to know how could I manage entries 
from keyboards. I think that ncurses lib is a good choice. But my 
problem is in algorithm term.

I think that making a code in the main() like this:

while (true) {
   if (key is pressed)  {
     switch (value of the key)  {
       case 'A':
         proceed to FFT ;
         break;
       case 'B':
         proceed to time stretch
         break;
       case 'C:
         reduce volume
         break;
      ...
      ...
    }
   }
   wait for a certain time;
}

is not a good idea. I know that with MFC there is event management with 
WM messages. I don't know what is there under Linux, especially in 
console-based apps. With GUI libs like GTK, no problems I think. But 
what about console-based apps?

Does anybody knows some internet sites, or some other libraries, or some 
methods (perhaps multithreads? seems to be heavy for just event 
managements...). I have look at ncurses docs but they shows an example 
with a kind of loop like the one I just talk about above. Any advice is 
welcome

Bye.




More information about the Linux-audio-dev mailing list