projects
/
sound-tools
/
ossmidi.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8a72003
)
read support tests
author
hackbard
<hackbard>
Tue, 11 Feb 2003 06:05:02 +0000
(06:05 +0000)
committer
hackbard
<hackbard>
Tue, 11 Feb 2003 06:05:02 +0000
(06:05 +0000)
midiio.c
patch
|
blob
|
history
diff --git
a/midiio.c
b/midiio.c
index
06f547c
..
dc4cd78
100644
(file)
--- a/
midiio.c
+++ b/
midiio.c
@@
-64,12
+64,19
@@
int note_off(int fd,int chan,int note,int vel) {
return 0;
}
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) {
#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]);
if(argc>1) {
note=atoi(argv[2]);
@@
-78,11
+85,18
@@
int main(int argc,char **argv) {
midi_fd=open("/dev/sound/midi",O_RDWR);
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);
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);
note_on(midi_fd,0,38,127);
sleep(1);
note_off(midi_fd,0,42,127);