Re: [LAD] starting out with tux audio

From: Jens M Andreasen <jens.andreasen@email-addr-hidden>
Date: Tue Jun 17 2008 - 20:14:43 EEST

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;
}

_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-dev
Received on Wed Jun 18 00:15:01 2008

This archive was generated by hypermail 2.1.8 : Wed Jun 18 2008 - 00:15:01 EEST