SoundManager.h
上传用户:royluo
上传日期:2007-01-05
资源大小:1584k
文件大小:2k
源码类别:

游戏

开发平台:

Visual C++

  1. /*****************************************************************************
  2. *                                                                             
  3. *   SoundManager.h
  4. *                                                                             
  5. *   Electrical Engineering Faculty - Software Lab                             
  6. *   Spring semester 1998                                                      
  7. *                                                                             
  8. *   Tanks game                                                                
  9. *                                                                             
  10. *   Module description: Manages the DirectSound objects.
  11. *                       
  12. *                                                                             
  13. *   Authors: Eran Yariv - 28484475                                           
  14. *            Moshe Zur  - 24070856                                           
  15. *                                                                            
  16. *                                                                            
  17. *   Date: 23/09/98                                                           
  18. *                                                                            
  19. ******************************************************************************/
  20. #ifndef _SOUND_MANAGER_H_
  21. #define _SOUND_MANAGER_H_
  22. #include <dsound.h>
  23. class CSoundManager
  24. {
  25. public:
  26.     enum SoundType 
  27.     { 
  28.         FIRE_BULLET, 
  29.         FIRE_SHELL, 
  30.         SHELL_EXPLODE,
  31.         MINE_EXPLODE, 
  32.         TANK_EXPLODE,
  33.         DROP_BOMB,
  34.         PICK_BONUS,
  35.         GAME_OVER,
  36.         LAST_SOUND_TYPE
  37.     };
  38.     CSoundManager();
  39.     ~CSoundManager();
  40.     BOOL Init (HWND);
  41.     void Play (SoundType);
  42.     void SetMuteMode (BOOL bMuteMode) { m_bMuteMode = bMuteMode; }
  43. private:
  44.     // members:
  45.     LPDIRECTSOUND       m_pDirectSound;
  46.     LPDIRECTSOUNDBUFFER m_aSoundBuffers[LAST_SOUND_TYPE];
  47.     static LPCSTR       m_aszSoundFileNames[LAST_SOUND_TYPE];
  48.     BOOL                m_bMuteMode;
  49.     //methods:
  50.     void LoadWavToBuffer(SoundType);
  51. };
  52. #endif