Path: utzoo!utgpu!watmath!att!tut.cis.ohio-state.edu!cs.utexas.edu!usc!apple!well!cbm From: cbm@well.UUCP (Chris Muir) Newsgroups: comp.sys.mac.programmer Subject: Re: MAC MIDI tools. Keywords: MIDI Message-ID: <13171@well.UUCP> Date: 16 Aug 89 20:39:19 GMT References: <2384@cbnewsc.ATT.COM> <89Aug14.190143edt.10865@ephemeral.ai.toronto.edu> Reply-To: cbm@well.UUCP (Chris Muir) Organization: Whole Earth 'Lectronic Link, Sausalito, CA Lines: 50 In message <89Aug14.190143edt.10865@ephemeral.ai.toronto.edu> dudek@ai.toronto.edu (Gregory Dudek) writes: > In lieu of actually getting the MIDI tools, I wonder if somebody >with the information might want to give us some idea >to what the details of using the package are like, for a programmers >point of view. In particular, what kind of calls do you >make to do the MIDI I/O? Is it easy to convert an existing MIDI >application that uses a raw SCC interface to the new package? I've just converted an application that was using the MacTutor (Kirk Austin) MIDI drivers to run under the MidiManager. The hardest part for me was that the MidiManager really wants to run at interrupt time, and all my code assumed that I was going to be polling the driver from my main event loop. This means that I had to play games to find my globals and that I couldn't move memory, etc. This is all standard driver/interrupt stuff, but I had never done it before. Basically the calls to the MidiManager are pretty simple. A call to Initialize, a call to "SignIn" your application, calls to add and subtract virtual ports, calls to find out about other applications ports and connect and connect to them, a call to write a packet, etc. Data comes and goes in MIDIPackets: MIDIPacket = packed record flags: BYTE; { what type of packet } len: BYTE; { length of packet including 6 byte header } tStamp: LONGINT; { in local time } data: packed array[0..250] of BYTE; end; MIDIPacketPtr = ^MIDIPacket; When you add an input port you pass the address of a "readHook", which is called at interrupt level when midi packets arrive. The MidiManager only reports completed packets. It also "completes" any packets sent with running status. You may write data to output ports at interrupt time or from the main event loop. The MidiManager comes with source for a few simple applications, some in Pascal, some in C. I'd be glad to answer any questions, if I can. -- _______________________________________________________________________________ Chris Muir | "There is no language in our lungs {hplabs,pacbell,ucbvax,apple} | to tell the world just how we feel" !well!cbm | - A. Partridge