Source code of Windows XP (NT5)
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.

104 lines
2.9 KiB

  1. #ifndef _BASE_TOOL_
  2. #define _BASE_TOOL_
  3. #include "dmusici.h"
  4. #include "medparam.h"
  5. extern long g_cComponent;
  6. class CBaseTool : public IDirectMusicTool8
  7. {
  8. public:
  9. CBaseTool()
  10. {
  11. m_cRef = 1; // set to 1 so one call to Release() will free this
  12. m_pParams = NULL;
  13. InitializeCriticalSection(&m_CrSec);
  14. // Note: on pre-Blackcomb OS's, this call can raise an exception; if it
  15. // ever pops in stress, we can add an exception handler and retry loop.
  16. InterlockedIncrement(&g_cComponent);
  17. }
  18. ~CBaseTool()
  19. {
  20. if (m_pParams)
  21. {
  22. m_pParams->Release();
  23. }
  24. DeleteCriticalSection(&m_CrSec);
  25. InterlockedDecrement(&g_cComponent);
  26. }
  27. void CreateParams()
  28. {
  29. }
  30. void CloneParams()
  31. {
  32. }
  33. // IUnknown
  34. STDMETHODIMP QueryInterface(const IID &iid, void **ppv) PURE;
  35. STDMETHODIMP_(ULONG) AddRef() PURE;
  36. STDMETHODIMP_(ULONG) Release() PURE;
  37. /*// IPersist functions
  38. STDMETHODIMP GetClassID(CLSID* pClassID) PURE;
  39. // IPersistStream functions
  40. STDMETHODIMP IsDirty() PURE;
  41. STDMETHODIMP Load(IStream* pStream) PURE;
  42. STDMETHODIMP Save(IStream* pStream, BOOL fClearDirty) PURE;
  43. STDMETHODIMP GetSizeMax(ULARGE_INTEGER* pcbSize) PURE;*/
  44. // IDirectMusicTool
  45. STDMETHODIMP Init(IDirectMusicGraph* pGraph) {return E_NOTIMPL;}
  46. STDMETHODIMP GetMsgDeliveryType(DWORD* pdwDeliveryType ) {return E_NOTIMPL;}
  47. STDMETHODIMP GetMediaTypeArraySize(DWORD* pdwNumElements ) {return E_NOTIMPL;}
  48. STDMETHODIMP GetMediaTypes(DWORD** padwMediaTypes, DWORD dwNumElements) {return E_NOTIMPL;}
  49. STDMETHODIMP ProcessPMsg(IDirectMusicPerformance* pPerf, DMUS_PMSG* pDMUS_PMSG) PURE;
  50. STDMETHODIMP Flush(IDirectMusicPerformance* pPerf, DMUS_PMSG* pDMUS_PMSG, REFERENCE_TIME rt) {return E_NOTIMPL;}
  51. // IDirectMusicTool8
  52. STDMETHODIMP Clone( IDirectMusicTool ** ppTool) PURE;
  53. protected:
  54. long m_cRef; // reference counter
  55. CRITICAL_SECTION m_CrSec; // to make SetEchoNum() and SetDelay() thread-safe
  56. IMediaParams * m_pParams; // Helper object that manages IMediaParams.
  57. };
  58. class CToolFactory : public IClassFactory
  59. {
  60. public:
  61. // IUnknown
  62. //
  63. STDMETHODIMP QueryInterface(const IID &iid, void **ppv);
  64. STDMETHODIMP_(ULONG) AddRef();
  65. STDMETHODIMP_(ULONG) Release();
  66. // Interface IClassFactory
  67. //
  68. STDMETHODIMP CreateInstance(IUnknown* pUnknownOuter, const IID& iid, void** ppv);
  69. STDMETHODIMP LockServer(BOOL bLock);
  70. // Constructor
  71. //
  72. CToolFactory(DWORD dwToolType);
  73. // Destructor
  74. ~CToolFactory();
  75. private:
  76. long m_cRef;
  77. DWORD m_dwToolType;
  78. };
  79. // We use one class factory to create all tool classes. We need an identifier for each
  80. // type so the class factory knows what it is creating.
  81. #define TOOL_ECHO 1
  82. #define TOOL_TRANSPOSE 2
  83. #define TOOL_SWING 3
  84. #define TOOL_QUANTIZE 4
  85. #define TOOL_VELOCITY 5
  86. #define TOOL_DURATION 6
  87. #define TOOL_TIMESHIFT 7
  88. #endif // _BASE_TOOL_