home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / sys / mac / programm / 20423 < prev    next >
Encoding:
Text File  |  1992-12-30  |  2.4 KB  |  63 lines

  1. Path: sparky!uunet!cs.utexas.edu!sun-barr!olivea!apple!goofy!mumbo.apple.com!gallant.apple.com!NewsWatcher!user
  2. From: REEKES@applelink.apple.com (Jim Reekes)
  3. Newsgroups: comp.sys.mac.programmer
  4. Subject: Re: Async sound input: interruptRoutine
  5. Message-ID: <REEKES-301292003647@90.10.20.67>
  6. Date: 30 Dec 92 08:35:49 GMT
  7. References: <JELLINEK.92Dec29111534@rutabaga.adoc.xerox.com>
  8. Sender: news@gallant.apple.com
  9. Followup-To: comp.sys.mac.programmer
  10. Distribution: comp
  11. Organization: Apple Computer, Inc.
  12. Lines: 49
  13.  
  14. In article <JELLINEK.92Dec29111534@rutabaga.adoc.xerox.com>,
  15. jellinek@rutabaga.adoc.xerox.com (Herb Jellinek) wrote:
  16. > I'm writing an application that does asynchronous sound input, and I
  17. > want to use the optional interruptRoutine feature of input sound
  18. > parameter blocks.  I'm using Think C 5.0.4.
  19. > I've looked at the description of the interruptRoutine feature in
  20. > Inside Mac VI, and I think I'm doing things right, but my machine
  21. > hangs in the interrupt routine whenever it does anything other than
  22. > save and restore A5.  From looking at things with MacsBug, I see that
  23. > the value in A0 is wrong, accounting for the bad things that follow.
  24. > I've been looking for code examples, to no avail: the otherwise
  25. > excellent Async Sound Helper doesn't use this feature.
  26. > Here's the current version of the interrupt routine:
  27. > - - - - - - - - - - - - - - - - - - - - - - - - - - 
  28. > Boolean interrupted = false;
  29. > #pragma parameter recordingInterrupt(__a0,__a1,__d0,__d1)
  30. > void recordingInterrupt(SPBPtr spb, Ptr samples, long peak,
  31. >             Size byteCount) {
  32. >   long oldA5 = SetA5(spb->userLong);
  33. >   
  34. >   // interrupted = true;
  35. >   
  36. >   SetA5(oldA5);
  37. > }
  38. > ...
  39. > // (Fragmentary) code in init routine:
  40. >   mySPB.userLong = SetCurrentA5();
  41. >   mySPB.interruptRoutine = recordingInterrupt;
  42. > // Execute:
  43. >   myErr = SPBRecord(&mySPB, true);
  44.  
  45. #pragma parameter only works for inlines, not for your routines.  You'll
  46. need to write you own glue or inlines to obtain the values in the
  47. registers.
  48.  
  49. -----------------------------------------------------------------------
  50. Jim Reekes, Polterzeitgeist  |     Macintosh Toolbox Engineering
  51.                              |          Sound Manager Expert
  52. Apple Computer, Inc.         | "All opinions expressed are mine, and do
  53. 20525 Mariani Ave. MS: 81-KS |   not necessarily represent those of my
  54. Cupertino, CA 95014          |       employer, Apple Computer Inc."
  55.