home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cs.utexas.edu!sun-barr!olivea!apple!goofy!mumbo.apple.com!gallant.apple.com!NewsWatcher!user
- From: REEKES@applelink.apple.com (Jim Reekes)
- Newsgroups: comp.sys.mac.programmer
- Subject: Re: Async sound input: interruptRoutine
- Message-ID: <REEKES-301292003647@90.10.20.67>
- Date: 30 Dec 92 08:35:49 GMT
- References: <JELLINEK.92Dec29111534@rutabaga.adoc.xerox.com>
- Sender: news@gallant.apple.com
- Followup-To: comp.sys.mac.programmer
- Distribution: comp
- Organization: Apple Computer, Inc.
- Lines: 49
-
- In article <JELLINEK.92Dec29111534@rutabaga.adoc.xerox.com>,
- jellinek@rutabaga.adoc.xerox.com (Herb Jellinek) wrote:
- >
- > I'm writing an application that does asynchronous sound input, and I
- > want to use the optional interruptRoutine feature of input sound
- > parameter blocks. I'm using Think C 5.0.4.
- >
- > I've looked at the description of the interruptRoutine feature in
- > Inside Mac VI, and I think I'm doing things right, but my machine
- > hangs in the interrupt routine whenever it does anything other than
- > save and restore A5. From looking at things with MacsBug, I see that
- > the value in A0 is wrong, accounting for the bad things that follow.
- > I've been looking for code examples, to no avail: the otherwise
- > excellent Async Sound Helper doesn't use this feature.
- >
- > Here's the current version of the interrupt routine:
- >
- > - - - - - - - - - - - - - - - - - - - - - - - - - -
- > Boolean interrupted = false;
- >
- > #pragma parameter recordingInterrupt(__a0,__a1,__d0,__d1)
- > void recordingInterrupt(SPBPtr spb, Ptr samples, long peak,
- > Size byteCount) {
- > long oldA5 = SetA5(spb->userLong);
- >
- > // interrupted = true;
- >
- > SetA5(oldA5);
- > }
- >
- > ...
- >
- > // (Fragmentary) code in init routine:
- > mySPB.userLong = SetCurrentA5();
- > mySPB.interruptRoutine = recordingInterrupt;
- >
- > // Execute:
- > myErr = SPBRecord(&mySPB, true);
-
- #pragma parameter only works for inlines, not for your routines. You'll
- need to write you own glue or inlines to obtain the values in the
- registers.
-
- -----------------------------------------------------------------------
- Jim Reekes, Polterzeitgeist | Macintosh Toolbox Engineering
- | Sound Manager Expert
- Apple Computer, Inc. | "All opinions expressed are mine, and do
- 20525 Mariani Ave. MS: 81-KS | not necessarily represent those of my
- Cupertino, CA 95014 | employer, Apple Computer Inc."
-