诸暨麻将添加redis
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

89 lines
3.0 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. // Copyright (C) 1998 by Jörg König
  3. // All rights reserved
  4. //
  5. // This file is part of the completely free tetris clone "CGTetris".
  6. //
  7. // This is free software.
  8. // You may redistribute it by any means providing it is not sold for profit
  9. // without the authors written consent.
  10. //
  11. // No warrantee of any kind, expressed or implied, is included with this
  12. // software; use at your own risk, responsibility for damages (if any) to
  13. // anyone resulting from the use of this software rests entirely with the
  14. // user.
  15. //
  16. // Send bug reports, bug fixes, enhancements, requests, flames, etc., and
  17. // I'll try to keep a version up to date. I can be reached as follows:
  18. // J.Koenig@adg.de (company site)
  19. // Joerg.Koenig@rhein-neckar.de (private site)
  20. /////////////////////////////////////////////////////////////////////////////
  21. // DirectSound.h: interface for the CDirectSound class.
  22. //
  23. //////////////////////////////////////////////////////////////////////
  24. #ifndef D_SOUND_HEAD_FILE
  25. #define D_SOUND_HEAD_FILE
  26. #if !defined(AFX_DIRECTSOUND_H__A20FE86F_118F_11D2_9AB3_0060B0CDC13E__INCLUDED_)
  27. #define AFX_DIRECTSOUND_H__A20FE86F_118F_11D2_9AB3_0060B0CDC13E__INCLUDED_
  28. #if _MSC_VER >= 1000
  29. #pragma once
  30. #endif // _MSC_VER >= 1000
  31. #include <mmsystem.h>
  32. #include <dsound.h>
  33. //#pragma message("linking with Microsoft's DirectSound library ...")
  34. #pragma comment(lib, "dsound.lib")
  35. class CDirectSound
  36. {
  37. public: // construction/destruction
  38. CDirectSound();
  39. virtual ~CDirectSound();
  40. // If the "pWnd" paramter is NULL, then AfxGetApp()->GetMainWnd() will be used.
  41. BOOL Create(LPCTSTR pszResource, CWnd * pWnd = 0);
  42. BOOL Create(UINT uResourceID, CWnd * pWnd = 0) {
  43. return Create(MAKEINTRESOURCE(uResourceID), pWnd);
  44. }
  45. // Alternativly you can specify the sound by yourself
  46. // Note that the class does not copy the entire data ! Instead
  47. // a pointer to the given data will be stored !
  48. // You can load an entire WAV file into memory and then call this
  49. // Create() method.
  50. BOOL Create(LPVOID pSoundData, CWnd * pWnd = 0);
  51. public: // operations
  52. BOOL IsValid() const;
  53. void Play(DWORD dwStartPosition = 0, BOOL bLoop = FALSE);
  54. void Stop();
  55. void Pause();
  56. void Continue();
  57. CDirectSound & EnableSound(BOOL bEnable = TRUE) {
  58. m_bEnabled = bEnable;
  59. if( ! bEnable )
  60. Stop();
  61. return * this;
  62. }
  63. BOOL IsEnabled() const { return m_bEnabled; }
  64. protected: // implementation
  65. BOOL SetSoundData(LPVOID pSoundData, DWORD dwSoundSize);
  66. BOOL CreateSoundBuffer(WAVEFORMATEX * pcmwf);
  67. BOOL GetWaveData(void * pRes, WAVEFORMATEX * & pWaveHeader, void * & pbWaveData, DWORD & cbWaveSize);
  68. private: // data member
  69. LPVOID m_pTheSound;
  70. DWORD m_dwTheSound;
  71. LPDIRECTSOUNDBUFFER m_pDsb;
  72. BOOL m_bEnabled;
  73. static LPDIRECTSOUND m_lpDirectSound;
  74. static DWORD m_dwInstances;
  75. };
  76. #endif // !defined(AFX_DIRECTSOUND_H__A20FE86F_118F_11D2_9AB3_0060B0CDC13E__INCLUDED_)
  77. #endif