MirSound.h
上传用户:cydong117
上传日期:2009-11-10
资源大小:638k
文件大小:3k
源码类别:

模拟服务器

开发平台:

Visual C++

  1. // MirSound.h: interface for the CMirSound class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #if !defined(AFX_MIRSOUND_H__4F9FCB9C_4210_464E_81FF_F4BDEA07785B__INCLUDED_)
  5. #define AFX_MIRSOUND_H__4F9FCB9C_4210_464E_81FF_F4BDEA07785B__INCLUDED_
  6. #if _MSC_VER > 1000
  7. #pragma once
  8. #endif // _MSC_VER > 1000
  9. #define MAX_AMBIANCE_COUNT 9
  10. class CMirSound  
  11. {
  12. public:
  13. BOOL ChgPlayingSet(INT nWavIdx,INT nBufferIdx,INT Sx,INT Sy,INT Dx,INT Dy);
  14. BOOL FreeNotUseBuffer(VOID);
  15. BOOL InitMirSound(HWND hWnd);
  16. CSBuffer* FindBuffer(int nNum,BOOL ForLoad=TRUE);
  17. CSound* GetSoundObject(VOID){return m_pSound;}
  18. void StopAllSound(void);
  19. void StopSound(int nNum);
  20. void StopSound(int nNum,int BufIdx);
  21. void PlayAmbianceWav(int WavNum);
  22. void StopBkMusicMp3(void);
  23. void PlayBkMusicMp3(BOOL Looped,INT nIndex);
  24. void PlayMagicEffect(POINT Target,POINT Chr,int Wavnum);
  25. INT PlayActorWav(INT Sx,INT Sy,INT Dx,INT Dy,int Wavnum,INT lVolume=100,BOOL bLooping=FALSE); // lVolume = 100% ~ 1%   
  26. BOOL BGMFadeOut(LONG lTime=(5000)/*5檬*/,LONG lMinVol=(-5000)); 
  27. BOOL BGMFadeIn(LONG lMaxVol=-100);
  28. VOID EndFading(INT nState);
  29. VOID SetInWarMode(VOID);
  30. VOID SetInPeaceMode(VOID);
  31. BOOL SetMasterVol(INT nVolume);
  32. BOOL SetBGMVol(INT nVolume);
  33. BOOL SetWavVol(INT nVolume);
  34. HRESULT MessageProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
  35. CMirSound();
  36. virtual ~CMirSound();
  37. ///////////////////////////////////////////////////////////////////
  38. VOID SetDisableBGM(VOID); // Can't play BGM
  39. VOID SetEnableBGM(VOID); // Can Play BGM
  40. VOID SetDisablePlay(VOID); // Can't play Wav
  41. VOID SetEnablePlay(VOID); // Can play Wav
  42. VOID SetDisableAmbiance(VOID); // can't play Ambiance
  43. VOID SetEnableAmbiance(INT nMapNum,INT nCount); // can play Ambiance
  44. VOID Enable3D(VOID); // Using 3D effect
  45. CBMMp3* m_pMp3; // Object of BGM(Mp3)
  46. CSBuffer* m_pAmbianceBuffer[MAX_AMBIANCE_COUNT]; // Only Ambiance's Buffer
  47. BOOL m_bRunningTimer;
  48. LONG m_lWavMaxVol;
  49. LONG m_lMp3MaxVol;
  50. INT m_nAmbienceNum;
  51. INT m_nAmbianceCount;
  52. private:
  53. HWND m_hWnd;
  54. BOOL m_bPlay; // Sound啊 唱客档 蹬绰芭?
  55. BOOL m_bBGMPlay; // BGM 捞 Play 登绢档 蹬绰啊?
  56. BOOL m_bAmbiance; // Ambiance Wave啊 Play 登绢档 蹬绰啊?
  57. BOOL m_3DEnable; // 3D Sound Effect Enable
  58. INT m_nUseCount; // 荤侩 蹬绊 乐绰 Sound(Wav) Buffer Count
  59. CSound* m_pSound; // Object of Sound
  60. CSBuffer** m_ppBuffer; // Object of Sound Buffer
  61. CSBuffer m_CommonWavBuffer; // Common use Wave Buffer
  62. BOOL m_bIsWarMode;
  63. WAVELISTHEADER* m_pWavListHeader;
  64. WAVELIST** m_ppWavList;
  65. char* SeekFileName(int wavnum);
  66. void ReadWavFileList(char* fName);
  67. int CalsVolume(int Dis);
  68. int CalsPan(int Dir,int Dis);
  69. float CalsDistanceX(POINT Src,POINT Chr);
  70. float CalsDistanceY(POINT Src,POINT Chr);
  71. INT CalsDistance(POINT Src,POINT Chr);
  72. INT CalsDirection(POINT Src,POINT Chr);
  73. };
  74. #endif // !defined(AFX_MIRSOUND_H__4F9FCB9C_4210_464E_81FF_F4BDEA07785B__INCLUDED_)