Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cWaveACM.h
Go to the documentation of this file.
1 //
6 //
7 
8 #ifndef _INC_cWaveACM_H
9 #define _INC_cWaveACM_H
10 #ifndef NO_PRAGMA_ONCE
11 #pragma once
12 #endif
13 
14 #include "cWaveFormat.h"
15 
16 #if defined(_WIN32) && defined(_MSC_VER)
21 
22 #include <msacm.h>
23 
24 namespace Gray
25 {
26  template <> inline void cHandlePtr<HACMSTREAM>::CloseHandle(HACMSTREAM h) // static
27  {
28  ::acmStreamClose(h, 0);
29  }
30 }
31 
32 namespace GrayLib
33 {
34  class GRAYLIB_LINK cWaveACM
35  : public cSingleton<cWaveACM>
36  {
41  friend class cSingleton<cWaveACM>;
43 
44  private:
45  bool m_bGetVersion;
46 
47  public:
48 #ifdef UNDER_CE
49  typedef wchar_t CHAR_t;
50  typedef struct tACMFORMATTAGDETAILSW FORMATTAGDETAILS_t;
51 #else
52  typedef GChar_t CHAR_t;
53  typedef _GTN(::ACMFORMATTAGDETAILS) FORMATTAGDETAILS_t;
54 #endif
55 
56  protected:
57  cWaveACM();
58  ~cWaveACM();
59 
60  public:
61  bool isACMAttached() const noexcept
62  {
63  // Is init ? StartupACM
64  return m_bGetVersion ;
65  }
66 
67  // MUST call this before using the ACM API calls.
68  bool StartupACM();
69  void ShutdownACM();
70 
71 #ifndef UNDER_CE
72  int FormatDlg(HWND hwnd, cWaveFormat& Form, const CHAR_t* pszTitle, UINT dwEnum);
73 #endif
74 
75  HRESULT GetFormatDetails(const cWaveFormatEx* pForm, FORMATTAGDETAILS_t& details);
76 
77  UNITTEST_FRIEND(cWaveACM);
78  };
79 
80  class GRAYLIB_LINK cWaveACMInst : public cSoundBase
81  {
86 
87  public:
88  cHandlePtr<HACMSTREAM> m_hStream;
89 
90  cWaveFormat m_SrcForm;
91  cWaveFormat m_DstForm;
92 
93  // Async ACM Compression conversion.
94  // Progress in the stream.
95  WAVE_BLOCKS_t m_SrcIndex;
96  WAVE_BLOCKS_t m_DstIndex;
97  int m_iBuffers;
98  HRESULT m_hResStop;
99 
100  public:
101  cWaveACMInst();
102  ~cWaveACMInst();
103 
104  HRESULT StreamOpen();
105  void StreamClose();
106  };
107 
108  class GRAYLIB_LINK cWaveACMEnc : public cStreamOutput, public cWaveACMInst
109  {
111  };
112  class GRAYLIB_LINK cWaveACMDec : public cStreamInput, public cWaveACMInst
113  {
115  };
116 };
117 #endif // _WIN32
118 #endif // _INC_cWaveACM_H
#define GRAYLIB_LINK
Definition: GrayLibBase.h:35
Using X files without the sources and the makefile How to use you just create a debug directory e the sample3 directory must contain Sample3 Final Sample3 exe Sample3 Final Debug Sample3 Final Gfx OpenGL bmp Sample3 Final Gfx tiny_skin bmp Sample3 Final Gfx tiny_4anim x The source files have the DevCpp project file plus the makefile The demos use standard FreeGlut functions Technical details
Definition: Readme.txt:32
#define _GTN(c)
_WIN32 name has a A or W for UTF8 or UNICODE (like _FNF)
Definition: StrConst.h:28
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
#define CHEAPOBJECT_IMPL
Definition: cHeapObject.h:32
#define UNITTEST_FRIEND(n)
Define this in the class body to be unit tested. Allow the unit test to access private/protected stuf...
Definition: cUnitTestDecl.h:17
void CloseHandle()
Definition: cHandlePtr.h:79
Definition: cMesh.h:22
UINT WAVE_BLOCKS_t
Index in blocks (not bytes or samples) of current wave format in sound buffer.
Definition: cWaveFormat.h:67
< The main namespace for all Core functions.
Definition: GrayCore.cpp:14
class __DECL_IMPORT cStreamOutput
Definition: cString.h:27
char GChar_t
My version of TCHAR, _TCHAR.
Definition: StrConst.h:26
class __DECL_IMPORT cStreamInput
Definition: cString.h:26