return 0;
}
+int midi_read_msg(int fd,char *buf) {
+ int bytes_read;
+ bytes_read=read(fd,buf,10);
+ return bytes_read;
+}
+
#ifdef TEST_API
/* test the io api ... */
int main(int argc,char **argv) {
- int note,channel,i;
+ int note,channel,i,j;
+ char my_buf[10]="MIDIMIDI";
if(argc>1) {
note=atoi(argv[2]);
midi_fd=open("/dev/sound/midi",O_RDWR);
+ printf("reading ...\n");
+ i=midi_read_msg(midi_fd,my_buf);
+ for(j=0;j<i;j++) printf("%x ",my_buf[j]);
+ printf("\n");
+
all_stop(midi_fd);
sleep(2);
for(i=0;i<4;i++) {
note_off(midi_fd,0,38,127);
+ note_off(midi_fd,0,42,127);
+ note_on(midi_fd,0,42,127);
note_on(midi_fd,0,38,127);
sleep(1);
note_off(midi_fd,0,42,127);