[comp.sys.mac.hypercard] MIDI I/O from Hypercard

talley@artsvax.UUCP (James T. Talley) (11/26/87)

I'm considering writing the XCMD's and XFCN's necessary to do simple
MIDI data I/O from a Hypercard stack.  I don't need the power of a
full-fledged MIDI sequencer -- I just want to be able to play back
short segments of music and to accept user response from a MIDI
keyboard.  I have the basic MIDI drivers that are necessary to
accomplish this, but the drivers raise a few questions.  The drivers
need to fiddle with the SCC chip, the timer chip, and the timer
interrupts.  When they're done, they restore things to normal.

Now, I would like to set up the interface so that there is a
"startMidi" XCMD, a "stopMidi" XCMD, and various transmit and receive
commands and functions.  This would allow Hypercard to continue
operations while the MIDI is playing back.  However .  .  .  my fear
is that, if I return control to Hypercard with the chips and
interrupts in a unexpected state, I will cause Hypercard to die a
horrible death.  I would have to lock the interrupt handler down so
that it wouldn't move around, which may also cause problems.  On the
other hand, if I set up the MIDI interface in a single XCMD that
always restores things to normal before returning to Hypercard, I
loose a great deal of flexibility.

Does anyone out there have any information on how Hypercard will react
to an XCMD fiddling with the hardware and leaving code locked in the
heap?  I know that fiddling with the hardware directly is frowned upon
by official sources, but does anyone know of a better way of
accomplishing MIDI I/O in Hypercard?  (I notice that the preliminary
specs for the new ROM Sound Manager include some interesting traps
that might be part of a solution, but these traps don't seem to be
implemented on my Mac Plus.)  Wouldn't it be nice if midiKeyDown and
midiKeyUp were standard Hypercard events? :-) Any comments?

James


-- 
---------------------------James Talley-----------------------------
UUCP    : ...!cbosgd!osupyr!artsvax!talley (will disappear 12/14/87)
Internet: talley-j@osu-20.ohio-state.edu (may not be working yet)
Bitnet  : ts0183@ohstmvsa