Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!husc6!uwvax!oddjob!gargoyle!ihnp4!cbosgd!osu-cis!osupyr!artsvax!talley
From: talley@artsvax.UUCP (James T. Talley)
Newsgroups: comp.sys.mac.hypercard
Subject: MIDI I/O from Hypercard
Message-ID: <209@artsvax.UUCP>
Date: Thu, 26-Nov-87 14:16:54 EST
Article-I.D.: artsvax.209
Posted: Thu Nov 26 14:16:54 1987
Date-Received: Sun, 29-Nov-87 18:15:50 EST
Organization: The Ohio State University, Computer-Based Instruction Group
Lines: 39
Keywords: MIDI XCMD XFCN hardware interrupt

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