/* * A test program for reading from /dev/midi. * Invoke it, and play something on the MIDI input keyboard. * Interrupt to terminate. */ #include #include #include main(argc,argv) int argc; char **argv; { int n, k; unsigned char buff[100]; long t; int fd; if ( argc > 1 ) fd = open(argv[1],O_RDONLY ); else fd = open("/dev/midi",O_RDONLY ); ioctl(fd,MIDIRESET,0); while ( 1 ) { if ( (n=read(fd,buff,sizeof(buff))) > 0 ) { ioctl(fd,MIDITIME,&t); printf("Time=%ld ",t); for ( k=0; k