Leaked source code of windows server 2003
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.

167 lines
5.6 KiB

  1. // Copyright (c) 1998-1999 Microsoft Corporation
  2. // DMGraph.h : Declaration of the CGraph
  3. #ifndef __DMGRAPH_H_
  4. #define __DMGRAPH_H_
  5. #include "alist.h"
  6. #include "dmusici.h"
  7. #include "dmusicf.h"
  8. class CRiffParser;
  9. class CToolRef : public AListItem
  10. {
  11. public:
  12. CToolRef()
  13. {
  14. m_fSupportsClone = FALSE;
  15. m_pTool = NULL;
  16. m_dwQueue = 0;
  17. m_dwMTArraySize = 0;
  18. m_dwPCArraySize = 0;
  19. m_pdwMediaTypes = NULL;
  20. m_pdwPChannels = NULL;
  21. m_guidClassID = GUID_NULL;
  22. };
  23. // the memory for pdwTracks and pidType better have been allocated with
  24. // something compatible with delete!!!
  25. ~CToolRef()
  26. {
  27. if( m_pdwPChannels )
  28. {
  29. delete [] m_pdwPChannels;
  30. }
  31. if( m_pdwMediaTypes )
  32. {
  33. delete [] m_pdwMediaTypes;
  34. }
  35. if( m_pTool )
  36. {
  37. m_pTool->Release();
  38. }
  39. };
  40. CToolRef* GetNext()
  41. {
  42. return (CToolRef*)AListItem::GetNext();
  43. };
  44. GUID m_guidClassID; // Class ID of tool.
  45. BOOL m_fSupportsClone; // Indicates this is a DX8 tool with support for cloning.
  46. IDirectMusicTool* m_pTool;
  47. DWORD m_dwQueue; // type of queue the tool wants messages to be
  48. DWORD m_dwMTArraySize; // size of the pdwMediaTypes array
  49. DWORD* m_pdwMediaTypes; // types of media the tool supports
  50. DWORD m_dwPCArraySize; // size of the pdwPChannels array
  51. DWORD* m_pdwPChannels; // array of PChannel id's - messages stamped with these id's are
  52. // sent to the tool
  53. };
  54. class CGraph;
  55. //#undef INTERFACE
  56. //#define INTERFACE IGraphClone
  57. DECLARE_INTERFACE_(IGraphClone, IUnknown)
  58. {
  59. /* IUnknown */
  60. STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE;
  61. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  62. STDMETHOD_(ULONG,Release) (THIS) PURE;
  63. /* IGraphClone */
  64. STDMETHOD(Clone) (THIS_ IDirectMusicGraph **ppGraph) PURE;
  65. };
  66. DEFINE_GUID(IID_CGraph,0xb06c0c24, 0xd3c7, 0x11d3, 0x9b, 0xd1, 0x44, 0x45, 0x53, 0x54, 0x0, 0x0);
  67. DEFINE_GUID(IID_IGraphClone,0xb06c0c27, 0xd3c7, 0x11d3, 0x9b, 0xd1, 0x44, 0x45, 0x53, 0x54, 0x0, 0x0);
  68. /////////////////////////////////////////////////////////////////////////////
  69. // CGraph
  70. class CGraph :
  71. public IDirectMusicGraph8,
  72. public IPersistStream,
  73. public IDirectMusicObject,
  74. public IGraphClone,
  75. public AList,
  76. public AListItem
  77. {
  78. public:
  79. CGraph();
  80. ~CGraph();
  81. CToolRef* GetHead(){return (CToolRef*)AList::GetHead();};
  82. CToolRef* RemoveHead(){return (CToolRef*)AList::RemoveHead();};
  83. CToolRef* GetItem(LONG lIndex){return (CToolRef*) AList::GetItem(lIndex);};
  84. CGraph* GetNext() { return (CGraph*)AListItem::GetNext();}
  85. public:
  86. // IUnknown
  87. STDMETHODIMP QueryInterface(const IID &iid, void **ppv);
  88. STDMETHODIMP_(ULONG) AddRef();
  89. STDMETHODIMP_(ULONG) Release();
  90. // IDirectMusicGraph
  91. STDMETHODIMP InsertTool(IDirectMusicTool *pTool,DWORD *pdwPChannels,DWORD cPChannels,LONG lIndex);
  92. STDMETHODIMP GetTool(DWORD dwPosition,IDirectMusicTool** ppTool);
  93. STDMETHODIMP RemoveTool(IDirectMusicTool* pTool);
  94. STDMETHODIMP StampPMsg(DMUS_PMSG* pPMsg);
  95. // IGraphClone
  96. STDMETHODIMP Clone(IDirectMusicGraph **ppGraph);
  97. // IPersist functions
  98. STDMETHODIMP GetClassID( CLSID* pClsId );
  99. // IPersistStream functions
  100. STDMETHODIMP IsDirty();
  101. STDMETHODIMP Load( IStream* pIStream );
  102. STDMETHODIMP Save( IStream* pIStream, BOOL fClearDirty );
  103. STDMETHODIMP GetSizeMax( ULARGE_INTEGER FAR* pcbSize );
  104. // IDirectMusicObject
  105. STDMETHODIMP GetDescriptor(LPDMUS_OBJECTDESC pDesc);
  106. STDMETHODIMP SetDescriptor(LPDMUS_OBJECTDESC pDesc);
  107. STDMETHODIMP ParseDescriptor(LPSTREAM pStream, LPDMUS_OBJECTDESC pDesc);
  108. HRESULT GetObjectInPath( DWORD dwPChannel,REFGUID guidObject,
  109. DWORD dwIndex,REFGUID iidInterface, void ** ppObject);
  110. HRESULT Load(CRiffParser *pParser);
  111. protected:
  112. HRESULT BuildToolList(CRiffParser *pParser);
  113. HRESULT LoadTool(CRiffParser *pParser);
  114. HRESULT CreateTool(DMUS_IO_TOOL_HEADER ioDMToolHdr, IStream *pStream, DWORD *pdwPChannels);
  115. HRESULT STDMETHODCALLTYPE Shutdown();
  116. HRESULT InsertTool(IDirectMusicTool *pTool,DWORD *pdwPChannels,
  117. DWORD cPChannels,LONG lIndex, GUID *pguidClassID);
  118. inline BOOL CheckType( DWORD dwType, CToolRef* pToolRef );
  119. protected:
  120. CRITICAL_SECTION m_CrSec;
  121. long m_cRef;
  122. // DWORD m_fPartialLoad;
  123. // IDirectMusicObject variables
  124. DWORD m_dwValidData;
  125. GUID m_guidObject;
  126. FILETIME m_ftDate; /* Last edited date of object. */
  127. DMUS_VERSION m_vVersion; /* Version. */
  128. WCHAR m_wszName[DMUS_MAX_NAME]; /* Name of object. */
  129. WCHAR m_wszCategory[DMUS_MAX_CATEGORY]; /* Category for object */
  130. WCHAR m_wszFileName[DMUS_MAX_FILENAME]; /* File path. */
  131. public:
  132. DWORD m_dwLoadID; // Identifier, used when loaded as part of a song.
  133. };
  134. class CGraphList : public AList
  135. {
  136. public:
  137. void Clear();
  138. void AddHead(CGraph* pGraph) { AList::AddHead((AListItem*)pGraph);}
  139. void Insert(CGraph* pGraph);
  140. CGraph* GetHead(){return (CGraph*)AList::GetHead();}
  141. CGraph* GetItem(LONG lIndex){return (CGraph*)AList::GetItem(lIndex);}
  142. CGraph* RemoveHead() {return (CGraph *) AList::RemoveHead();}
  143. void Remove(CGraph* pGraph){AList::Remove((AListItem*)pGraph);}
  144. void AddTail(CGraph* pGraph){AList::AddTail((AListItem*)pGraph);}
  145. CGraph* GetTail(){ return (CGraph*)AList::GetTail();}
  146. };
  147. #endif //__DMGRAPH_H_