home *** CD-ROM | disk | FTP | other *** search
/ NEXT Generation 27 / NEXT27.iso / pc / demos / emperor / dx3.exe / SDK / SAMPLES / IKLOWNS / CGSOUND.H < prev    next >
C/C++ Source or Header  |  1996-08-28  |  3KB  |  88 lines

  1. /*===========================================================================*\
  2. |
  3. |  File:        cgsound.h
  4. |
  5. |  Description: 
  6. |       
  7. |-----------------------------------------------------------------------------
  8. |
  9. |  Copyright (C) 1995-1996 Microsoft Corporation.  All Rights Reserved.
  10. |
  11. |  Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation
  12. |
  13. \*===========================================================================*/
  14. /**************************************************************************
  15.  
  16.     (C) Copyright 1995-1996 Microsoft Corp.  All rights reserved.
  17.  
  18.     You have a royalty-free right to use, modify, reproduce and 
  19.     distribute the Sample Files (and/or any modified version) in 
  20.     any way you find useful, provided that you agree that 
  21.     Microsoft has no warranty obligations or liability for any 
  22.     Sample Application Files which are modified. 
  23.  
  24.     we do not recomend you base your game on IKlowns, start with one of
  25.     the other simpler sample apps in the GDK
  26.  
  27.  **************************************************************************/
  28.  
  29. #ifndef _CGSOUND_H
  30. #define _CGSOUND_H
  31.  
  32. #include <mmreg.h>
  33. #include <msacm.h>
  34. extern "C" {
  35.     #include "dsound.h"
  36. };
  37.  
  38. #define USE_DSOUND  0
  39. #define USE_WAVEOUT 1
  40. #define USE_SNDPLAY 2
  41.  
  42. // Master wave information structure -- one for each unique
  43. // sound (not each instance).
  44. typedef struct _WAVE_ENTRY
  45. {
  46.     LPSTR           mpFileName;
  47.     DSBUFFERDESC        *dsbd;
  48.     LPDIRECTSOUNDBUFFER lpDirectSoundBuffer;
  49.     LPWAVEFORMATEX      pwfxInfo;
  50.     LPWAVEHDR       pWaveHdr;
  51.     DWORD           hObjectId;
  52.     int         WaveMode;
  53.     int         mRefCount;
  54. } WAVE_ENTRY, *LPWAVE_ENTRY;
  55.  
  56.  
  57. class CSoundEffect
  58. {
  59. private:
  60.     LPWAVE_ENTRY    pWaveInfo;  // ptr to master wav info
  61.     DSBUFFERDESC    *dsbd;      // instance DS buffer
  62.     LPDIRECTSOUNDBUFFER lpDirectSoundBuffer;
  63.     int     WaveMode;   // method for playing
  64.     int     curVolume;  // 0-127
  65.     int     curPan;     // 0=left, 127=right
  66.     BOOL        fLoop;
  67.     BOOL        fPlaying;
  68.     BOOL        fMuted;
  69.     int     curChannel;
  70.  
  71. public:
  72.     CSoundEffect(LPSTR WaveFile, DWORD UniqueId=0, BOOL fLoopIt=FALSE
  73.     , int Mode=USE_DSOUND); 
  74.     ~CSoundEffect();
  75.  
  76.     void Play();
  77.     void Stop();
  78.     void SetPan(int PanFactor);
  79.     void SetVolume(int Volume);
  80.     void SetMute(BOOL);
  81.     void SetFreq();
  82.  
  83.     friend LPWAVEHDR LoadWaveData(CSoundEffect *, LPSTR, int);
  84.     friend void SetSilence(BOOL);   
  85. };
  86.  
  87. #endif
  88.