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

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!uwm.edu!biosci!parc!news!jellinek
  2. From: jellinek@rutabaga.adoc.xerox.com (Herb Jellinek)
  3. Newsgroups: comp.sys.mac.programmer
  4. Subject: Async sound input: interruptRoutine
  5. Message-ID: <JELLINEK.92Dec29111534@rutabaga.adoc.xerox.com>
  6. Date: 29 Dec 92 19:15:34 GMT
  7. Sender: news@parc.xerox.com
  8. Distribution: comp
  9. Organization: Xerox PARC, Palo Alto, CA
  10. Lines: 41
  11.  
  12. I'm writing an application that does asynchronous sound input, and I
  13. want to use the optional interruptRoutine feature of input sound
  14. parameter blocks.  I'm using Think C 5.0.4.
  15.  
  16. I've looked at the description of the interruptRoutine feature in
  17. Inside Mac VI, and I think I'm doing things right, but my machine
  18. hangs in the interrupt routine whenever it does anything other than
  19. save and restore A5.  From looking at things with MacsBug, I see that
  20. the value in A0 is wrong, accounting for the bad things that follow.
  21. I've been looking for code examples, to no avail: the otherwise
  22. excellent Async Sound Helper doesn't use this feature.
  23.  
  24. Here's the current version of the interrupt routine:
  25.  
  26. - - - - - - - - - - - - - - - - - - - - - - - - - - 
  27. Boolean interrupted = false;
  28.  
  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. ...
  40.  
  41. // (Fragmentary) code in init routine:
  42.   mySPB.userLong = SetCurrentA5();
  43.   mySPB.interruptRoutine = recordingInterrupt;
  44.  
  45. // Execute:
  46.   myErr = SPBRecord(&mySPB, true);
  47.  
  48. - - - - - - - - - - - - - - - - - - - - - - - - - - 
  49.  
  50. Thanks for any and all help you can provide.
  51.  
  52.         Herb
  53.