home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / source / luschsrc.sit / noise.c < prev    next >
Text File  |  1990-05-23  |  871b  |  50 lines

  1. /********************************************************************************
  2.  *    noise.c
  3.  *
  4.  *    Noise Playing Package
  5.  *
  6.  *    Written by Paco Xander Nathan
  7.  *    ⌐1990, Motorola Inc.  Public domain source code.
  8.  ********************************************************************************/
  9.  
  10. #include "applic.h"
  11. #include "noise.h"
  12. #include <SoundMgr.h>
  13. #include <OSUtil.h>
  14.  
  15.  
  16. /* External Data Structures
  17.  */
  18. Boolean
  19.     noiseDone = FALSE;
  20.  
  21.  
  22. /* Local Data Structures
  23.  */
  24. static Boolean
  25.     noiseStarted = FALSE;
  26.  
  27. static SndChannelPtr
  28.     noiseChan;
  29.  
  30.  
  31. /* Play the specified piece of noise
  32.  */
  33. void
  34. NoisePlay (theNoise) 
  35.     register short theNoise;
  36. {
  37.     register Handle noiseHdl;
  38.  
  39.     if (laMachine.hasSound) {
  40.         if (noiseHdl = GetResource('snd ', theNoise)) {
  41.             if (!noiseStarted)
  42.                 SndPlay(NULL, noiseHdl, TRUE);
  43.             
  44.             ReleaseResource((Handle) noiseHdl);
  45.         }
  46.     }
  47.     else
  48.         SysBeep(5);
  49. }
  50.