[LAD] starting out with tux audio

Jens M Andreasen jens.andreasen at comhem.se
Tue Jun 17 17:14:43 UTC 2008


On Tue, 2008-06-17 at 16:50 +0200, Jens M Andreasen wrote:
> A virtual midi-keyboard would solve that, perhaps vkeybd?
> 

AlgoMantra,

In any case, the supplied kbhit() will not work if you haven't already
screwed up your Xterm, but this one will:

/* We will use the keyboard for musical input
 */
int kbhit()
{
    static const int STDIN = 0;
    static int initialized = 0;

    if (! initialized) {
        // Use termios to turn off line buffering
        struct termios term;
        tcgetattr(STDIN, &term);
        term.c_lflag &= ~ICANON;
        tcsetattr(STDIN, TCSANOW, &term);
        setbuf(stdin, NULL);
        initialized = 1;
    }

    int bytesWaiting;
    ioctl(STDIN, FIONREAD, &bytesWaiting);
    return bytesWaiting;
}






More information about the Linux-audio-dev mailing list