home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / Tools / Preditor 2.0 / Preditor Folder / PCMD Source / Think C / SoundPlay.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-06-04  |  999 b   |  47 lines  |  [TEXT/TCEd]

  1. /************************************************************
  2.  
  3.     SoundPlay.c
  4.     Last Modified: Friday, May 31, 1991 at 9:46 PM
  5.     
  6.     Attempt to play all 'snd ' resources given text for each
  7.     line selected (or all text if no selection)
  8.  
  9.     © Copyright Evatac Software  1988-1990
  10.     All rights reserved
  11.  
  12. ************************************************************/
  13.  
  14. #include "PCMD.h"
  15. #include <ResourceMgr.h>
  16. #include <MemoryMgr.h>
  17. #include <SoundMgr.h>
  18.  
  19. #define NULL (0L)
  20.  
  21. main(
  22.     unsigned char        *sourceText,
  23.     long                sourceLength,
  24.     unsigned char        *destText,
  25.     long                *destSpace,
  26.     PCMDInfo            *info
  27.     )
  28. {
  29. #pragma unused(destText)
  30. #pragma unused(destSpace)
  31.  
  32.     Handle        theSound;
  33.     char        soundName[34];
  34.     
  35.     if (sourceLength > 31)
  36.         sourceLength = 31;
  37.     BlockMove(sourceText, soundName + 1, sourceLength);
  38.     *soundName = (char) sourceLength;
  39.     
  40.     theSound = GetNamedResource('snd ', soundName);
  41.     if (theSound != NULL) {
  42.         SndPlay(NULL, theSound, FALSE);
  43.         ReleaseResource(theSound);
  44.     }
  45.     return(kPCMDSuccess);
  46. }
  47.