From: hackbard Date: Wed, 12 Feb 2003 18:18:00 +0000 (+0000) Subject: - X-Git-Url: https://hackdaworld.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fmaster;p=sound-tools%2Fossmidi.git - --- diff --git a/midiio.c b/midiio.c index 8414a97..b4c1c48 100644 --- a/midiio.c +++ b/midiio.c @@ -68,27 +68,26 @@ int note_off(int fd,int chan,int note,int vel) { } int midi_read(int fd,char *buf) { - int bytes_read; - bytes_read=read(fd,buf,1); - return bytes_read; + return(read(fd,buf,1)); } int midi_read_msg(int fd,char *buf) { char tmp_buf; int i; - midi_read(fd,&tmp_buf); + midi_read(fd,tmp_buf); + printf("debug: %x\n",tmp_buf); buf[0]=tmp_buf; /* decide how much to read */ if(((buf[0]&MSB_MASK)==PROGRAM_CHANGE) || ((buf[0]&MSB_MASK)==CHANNEL_PRESSURE)) { printf("debug: program change or channel pressure event detected\n"); - midi_read(fd,&tmp_buf); + midi_read(fd,tmp_buf); buf[1]=tmp_buf; return 2; } else { printf("debug: none program change or channel pressure event detected\n"); for(i=0;i<2;i++) { - midi_read(fd,&tmp_buf); + midi_read(fd,tmp_buf); buf[i+1]=tmp_buf; } return 3; @@ -115,7 +114,7 @@ int main(int argc,char **argv) { printf("debug: midi_fd = %d\n",midi_fd); printf("reading ...\n"); - i=midi_read_msg(midi_fd,&my_buf[1]); + i=midi_read_msg(midi_fd,my_buf); printf("debug: i = %d\n",i); for(k=0;k=0;j--) printf("%s%d%s",(j==7?"|":""),