m204help@cca.UUCP (04/06/87)
Recently, I posted a note asking for help with reading the midi port inside a c program, written with the MEGAMAX C development system. I received a lot of replies for which I am grateful. I also noticed that there seemed to be a discussion going on between a couple of you out there as to whay I might have been having the problem I was having. Someone suggested that perhaps since I had built a loop which ran as long as there was input at the midi port, that perhaps the machine was so fast that it checked the port before data showed up and that was causing the problem. Well through some really sloppy programming non-methodology, I have been able to make my program work, but I don't know what I did to fix it ! In the process, however, I did find out one thing.....the function that I am using to read the midi port (Bconin(3)) BLOCKS UNTIL a midi byte appears at the port. I have tested this function by changing the address to that of the keyboard and it worked fine....as I said my program now works and uses this function. So for the person who thought this might be the problem, and anyone who read it, I just wanted to let you know that this function DOES work and WILL block until data appears at the midi port. I should say however, that I think that this was a pretty good guess as to why my program may not have been working. Anyway, thanks again for all of your help, Keith
rgoodman@cit-vax.UUCP (04/07/87)
In article <14748@cca.CCA.COM> m204help@cca.CCA.COM (Keith Hedger) writes: >Recently, I posted a note asking for help with reading the midi port inside a >c program, written with the MEGAMAX C development system. > >In the process, however, I did find out one thing.....the function that I >am using to read the midi port (Bconin(3)) BLOCKS UNTIL a midi byte appears >at the port. I have tested this function by changing the address to that of the >keyboard and it worked fine....as I said my program now works and uses this >function. >Keith Using Bconin(3) is fine, and is in fact the correct way to read data. It is not, however, the correct way to test for end of data! As you correctly point out, it will wait until data appears . . . even if it never appears. For testing that you must use Bconstat(3). If you want a program to ever end then it is not valid to simply do Bconin after Bconin. Ron Goodman -- rgoodman@cit-vax.caltech.edu _______ _________ _________ | rgoodman@cit-vax.bitnet / \#/ \#/ | Pasadena rgoodman@cit-vax.uucp |alifornia |nstitute |echnology | California \_______ ___/#\___ of | | U. S. A.