home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / sys / mac / programm / 22074 < prev    next >
Encoding:
Internet Message Format  |  1993-01-24  |  1.6 KB

  1. Path: sparky!uunet!pageworks.com!world!eff!sol.ctr.columbia.edu!spool.mu.edu!olivea!charnel!rat!zeus!joule.elee.calpoly.edu!tjohnson
  2. From: tjohnson@joule.elee.calpoly.edu (Todd Johnson)
  3. Newsgroups: comp.sys.mac.programmer
  4. Subject: Problems with sound (again)
  5. Message-ID: <1993Jan24.192848.159533@zeus.calpoly.edu>
  6. Date: 24 Jan 93 19:28:48 GMT
  7. Sender: news@zeus.calpoly.edu
  8. Distribution: na
  9. Organization: California Polytechnic State University, San Luis Obispo
  10. Lines: 38
  11.  
  12. Newsgroups: comp.sys.mac.programmer
  13. Subject: Another sound problem
  14. Summary: System 6 barfs
  15. Followup-To: 
  16. Distribution: na
  17. Organization: California Polytechnic State University, San Luis Obispo
  18. Keywords: snd, System 6
  19.  
  20. I use the following function to play sounds:
  21.  
  22. void play_sound(short res_id)
  23. {
  24.   SndChannelPtr  aChannel;
  25.   OSErr          err;
  26.   Handle         itsSound;
  27.  
  28.   itsSound = GetResource('snd ', res_id);
  29.   if (itsSound != NULL)
  30.   {
  31.     aChannel = NULL;
  32.     err = SndNewChannel(&aChannel, sampledSynth, initMono, NULL);
  33.     if (err == noErr)
  34.       SndPlay(aChannel, itsSound, FALSE);
  35.     SndDisposeChannel(aChannel, FALSE);
  36.     ReleaseResource(itsSound);
  37.   }
  38. }
  39.  
  40.   This works fine as long as I run it under System 7. However, when I
  41. compile and run under System 6, it crashes the machine. Ideally, I
  42. would like to have a function to play sounds that works under both
  43. operating systems. What am I doing wrong?
  44.  
  45.  
  46. Todd Johnson                         tjohnson@joule.elee.calpoly.edu
  47. ####################################################################
  48. I love to go to the park and watch the kids run around and scream.
  49. Of course, they don't know I'm using blanks.     Emo Phillips
  50.