[comp.sys.atari.st] Re : Midi Problem.

tulp@klipper.UUCP (03/26/87)

In article <14085@cca.CCA.COM>, Keith Hedger writes:
> I am trying to read data from the midi in port on the 520 ST and
> am having a problem...
>

Keith,  your problem *is* that you don't have enough real time  to 
do much screen output. I learned it the hard way too (though I did 
find  the  cause  in an hour or so).  What Ron  Goodman  has  been 
writing  simply cannot be true since if you do a 'conin(3)'  (bios 
number  2) call,  the operating system suspends execution of  your 
program  until a byte is available (both of you do  use  conin(3), 
don't you ?).  And I am absolutely positive about this,  I had  my 
program  'hanging' when it tried to read more bytes then my  ESQ-1 
sent.  If you don't use conin(3) but just look at the buffer,  the 
speed  of the computer may be too high (still,  if your  sequencer 
also  sends  velocity,  after touch and what  all  messages,  that 
sounds unlikely to me).

Drive and synthesize carefully,

Eduard Tulp  tulp@cs.vu.nl

------------------------------------------------------------------
Did you see Alex Leavens grinning all the time ? I think there's a 
coat-hanger stuck in his mouth !
------------------------------------------------------------------

rgoodman@cit-vax.UUCP (03/28/87)

In article <700@klipper.cs.vu.nl> tulp@cs.vu.nl (Tulp E) writes:
>In article <14085@cca.CCA.COM>, Keith Hedger writes:
>> I am trying to read data from the midi in port on the 520 ST and
>> am having a problem...
>Keith,  your problem *is* that you don't have enough real time  to 
>do much screen output. I learned it the hard way too (though I did 
>find  the  cause  in an hour or so).  What Ron  Goodman  has  been 
>writing  simply cannot be true since if you do a 'conin(3)'  (bios 

Perhaps there is a problem with too much screen I/O but this is not
the problem with the MIDI program described.  He said that he has
a while loop that says basically while status of MIDI is more data, continue
reading and printing.  Then he says his program ends prematurely.
Obviously his program ends because the program reads the status
of the MIDI port and gets a 0 (i.e. no data waiting).

Two things can cause this.  One, if the song spews out a lot of data too
fast and overflows the buffer, then some data will be lost.  Two, if the
computer tries to read data so fast that at some point when the buffer is
empty, his program checks status before the next MIDI byte is there.

  The sequencer sends
out data as it goes, so, if the song is still playing when the program
ends (certainly likely after only several lines have been printed unless
this is a very short sequence) it is obviously not because the sequencer
sent the data too fast and the ST lost some of it.  There is more data coming
while the sequencer is going and data would be printed until the song 
ended and for 128 bytes more.  This does not sound like what happened at
all, right?  Therefore it seems to me that he is reading data too fast.
I too have experienced this problem in a program I am writing.  This
is what was wrong.  It is certainly a problem to just read data until
no data is waiting in a MIDI environment.  This is not a file you are
reading from after all!  Things work a little differently.

Ron Goodman


-- 
rgoodman@cit-vax.caltech.edu    _______ _________ _________       |
rgoodman@cit-vax.bitnet        /           \#/       \#/          |   Pasadena
rgoodman@cit-vax.uucp         |alifornia    |nstitute |echnology  | California
                               \_______ ___/#\___ of  |           |   U. S. A.