[comp.sys.amiga.tech] Timing for MIDI

rokicki@polya.Stanford.EDU (Tomas G. Rokicki) (07/15/88)

In article <3229@druhi.ATT.COM>, mab@druhi.ATT.COM (Alan Bland) writes:
> What is the most accurate way to do millisecond-level timing on the
> Amiga?  I am working on a MIDI program that requires precise timing of
> incoming and outgoing MIDI data.  According to the ROM kernel reference,
> the timer.device seems to be accurate only within 5%, which doesn't seem
> to be very good.  There must be a better way.

First, if you really need it badly enough, there is some code in my
Manx Profiler on the fish disks to do fairly accurate timing.  But,
this is something any custom chip that has accessible hardware registers
should have on it in my opinion:  a free-running 64-bit counter running
off one of the fast system clocks.  That would make MIDI timestamping,
profiling, etc., everything that requires a fairly accurate time
standard, fairly easy.  64 bits at 1.8 MHz is about 320K years, so
perhaps 48 bits would do, but this should take an absolute minimum of
real-estate but be very useful.  Registers should latch on reading of
either least significant or most significant word.  On the other hand,
if I had to trade HAM for this, I probably wouldn't . . .

-tom