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.

266 lines
8.4 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (c) 1998-1999 Microsoft Corporation
  6. //
  7. // File: audtrk.h
  8. //
  9. //--------------------------------------------------------------------------
  10. // AudTrk.h : Declaration of the CAuditionTrack
  11. #ifndef __AUDITIONTRACK_H_
  12. #define __AUDITIONTRACK_H_
  13. #include "Ptrntrk.h"
  14. struct AuditionTrackInfo : public PatternTrackInfo
  15. {
  16. AuditionTrackInfo();
  17. AuditionTrackInfo(const AuditionTrackInfo* pInfo, MUSIC_TIME mtStart, MUSIC_TIME mtEnd)
  18. : PatternTrackInfo(pInfo, mtStart, mtEnd),
  19. m_pPattern(NULL),
  20. m_pdwVariations(NULL),
  21. m_dwVariations(0),
  22. m_dwPart(0),
  23. m_fByGUID(TRUE)
  24. {
  25. memset(&m_guidPart, 0, sizeof(m_guidPart));
  26. m_dwPatternTag = DMUS_PATTERN_AUDITION;
  27. if (pInfo && pInfo->m_pPattern)
  28. {
  29. m_pPattern = pInfo->m_pPattern->Clone(mtStart, mtEnd, FALSE);
  30. PatternTrackInfo::InitTrackVariations(m_pPattern);
  31. }
  32. }
  33. ~AuditionTrackInfo();
  34. virtual HRESULT STDMETHODCALLTYPE Init(
  35. /*[in]*/ IDirectMusicSegment* pSegment
  36. );
  37. virtual HRESULT STDMETHODCALLTYPE InitPlay(
  38. /*[in]*/ IDirectMusicTrack* pParentrack,
  39. /*[in]*/ IDirectMusicSegmentState* pSegmentState,
  40. /*[in]*/ IDirectMusicPerformance* pPerformance,
  41. /*[out]*/ void** ppStateData,
  42. /*[in]*/ DWORD dwTrackID,
  43. /*[in]*/ DWORD dwFlags
  44. );
  45. HRESULT InitTrackVariations();
  46. CDirectMusicPattern* m_pPattern; // The audition track's pattern
  47. DWORD* m_pdwVariations; // Variations currently in use (one DWORD per part)
  48. DWORD m_dwVariations; // The variations to use for m_wPart
  49. DWORD m_dwPart; // The part to use m_dwVariations
  50. GUID m_guidPart; // GUID of the part to play with the selected variations
  51. BOOL m_fByGUID; // true if selecting parts by GUID, false if by PChannel
  52. };
  53. /////////////////////////////////////////////////////////////////////////////
  54. // CAuditionTrack
  55. class CAuditionTrack :
  56. public IAuditionTrack,
  57. public IDirectMusicPatternTrack,
  58. public IDirectMusicTrack8,
  59. public IPersistStream,
  60. public IPrivatePatternTrack
  61. {
  62. public:
  63. CAuditionTrack();
  64. CAuditionTrack(const CAuditionTrack& rTrack, MUSIC_TIME mtStart, MUSIC_TIME mtEnd);
  65. ~CAuditionTrack();
  66. // IUnknown
  67. //
  68. virtual STDMETHODIMP QueryInterface(const IID &iid, void **ppv);
  69. virtual STDMETHODIMP_(ULONG) AddRef();
  70. virtual STDMETHODIMP_(ULONG) Release();
  71. // IAuditionTrack
  72. public:
  73. // IDirectMusicTrack Methods
  74. HRESULT STDMETHODCALLTYPE Init(
  75. /*[in]*/ IDirectMusicSegment* pSegment
  76. );
  77. HRESULT STDMETHODCALLTYPE InitPlay(
  78. /*[in]*/ IDirectMusicSegmentState* pSegmentState,
  79. /*[in]*/ IDirectMusicPerformance* pPerformance,
  80. /*[out]*/ void** ppStateData,
  81. /*[in]*/ DWORD dwTrackID,
  82. /*[in]*/ DWORD dwFlags
  83. );
  84. HRESULT STDMETHODCALLTYPE EndPlay(
  85. /*[in]*/ void* pStateData
  86. );
  87. HRESULT STDMETHODCALLTYPE Play(
  88. /*[in]*/ void* pStateData,
  89. /*[in]*/ MUSIC_TIME mtStart,
  90. /*[in]*/ MUSIC_TIME mtEnd,
  91. /*[in]*/ MUSIC_TIME mtOffset,
  92. DWORD dwFlags,
  93. IDirectMusicPerformance* pPerf,
  94. IDirectMusicSegmentState* pSegState,
  95. DWORD dwVirtualID
  96. );
  97. HRESULT STDMETHODCALLTYPE GetPriority(
  98. /*[out]*/ DWORD* pPriority
  99. );
  100. HRESULT STDMETHODCALLTYPE GetParam(
  101. REFGUID pCommandGuid,
  102. MUSIC_TIME mtTime,
  103. MUSIC_TIME* pmtNext,
  104. void *pData);
  105. HRESULT STDMETHODCALLTYPE SetParam(
  106. /* [in] */ REFGUID pCommandGuid,
  107. /* [in] */ MUSIC_TIME mtTime,
  108. /* [out] */ void __RPC_FAR *pData);
  109. HRESULT STDMETHODCALLTYPE AddNotificationType(
  110. /* [in] */ REFGUID pGuidNotify
  111. );
  112. HRESULT STDMETHODCALLTYPE RemoveNotificationType(
  113. /* [in] */ REFGUID pGuidNotify
  114. );
  115. HRESULT STDMETHODCALLTYPE Clone(
  116. MUSIC_TIME mtStart,
  117. MUSIC_TIME mtEnd,
  118. IDirectMusicTrack** ppTrack);
  119. HRESULT STDMETHODCALLTYPE IsParamSupported(
  120. /*[in]*/ REFGUID pGuid
  121. );
  122. // IDirectMusicTrack8 Methods
  123. STDMETHODIMP PlayEx(void* pStateData,REFERENCE_TIME rtStart,
  124. REFERENCE_TIME rtEnd,REFERENCE_TIME rtOffset,
  125. DWORD dwFlags,IDirectMusicPerformance* pPerf,
  126. IDirectMusicSegmentState* pSegSt,DWORD dwVirtualID) ;
  127. STDMETHODIMP GetParamEx(REFGUID rguidType,REFERENCE_TIME rtTime,
  128. REFERENCE_TIME* prtNext,void* pParam,void * pStateData, DWORD dwFlags) ;
  129. STDMETHODIMP SetParamEx(REFGUID rguidType,REFERENCE_TIME rtTime,void* pParam, void * pStateData, DWORD dwFlags) ;
  130. STDMETHODIMP Compose(IUnknown* pContext,
  131. DWORD dwTrackGroup,
  132. IDirectMusicTrack** ppResultTrack) ;
  133. STDMETHODIMP Join(IDirectMusicTrack* pNewTrack,
  134. MUSIC_TIME mtJoin,
  135. IUnknown* pContext,
  136. DWORD dwTrackGroup,
  137. IDirectMusicTrack** ppResultTrack) ;
  138. // IPersist methods
  139. HRESULT STDMETHODCALLTYPE GetClassID( LPCLSID pclsid );
  140. // IPersistStream methods
  141. HRESULT STDMETHODCALLTYPE IsDirty();
  142. HRESULT STDMETHODCALLTYPE Save( LPSTREAM pStream, BOOL fClearDirty );
  143. HRESULT STDMETHODCALLTYPE GetSizeMax( ULARGE_INTEGER* /*pcbSize*/ );
  144. HRESULT STDMETHODCALLTYPE Load( LPSTREAM pStream );
  145. // IAuditionTrack methods
  146. HRESULT STDMETHODCALLTYPE CreateSegment(
  147. IDirectMusicStyle* pStyle, IDirectMusicSegment** ppSegment);
  148. HRESULT STDMETHODCALLTYPE SetPatternByName(IDirectMusicSegmentState* pSegState,
  149. WCHAR* wszName,
  150. IDirectMusicStyle* pStyle,
  151. DWORD dwPatternType,
  152. DWORD* pdwLength);
  153. HRESULT STDMETHODCALLTYPE SetVariation(
  154. IDirectMusicSegmentState* pSegState, DWORD dwVariationFlags, DWORD dwPart);
  155. // IPrivatePatternTrack Methods
  156. HRESULT STDMETHODCALLTYPE SetPattern(IDirectMusicSegmentState* pSegState, IStream* pStream, DWORD* pdwLength);
  157. HRESULT STDMETHODCALLTYPE SetVariationByGUID(
  158. IDirectMusicSegmentState* pSegState, DWORD dwVariationFlags, REFGUID rguidPart, DWORD dwPChannel);
  159. // obsolete method (dx7)
  160. HRESULT STDMETHODCALLTYPE SetVariation(
  161. IDirectMusicSegmentState* pSegState, DWORD dwVariationFlags, WORD wPart)
  162. {
  163. DWORD dwPart = (DWORD)wPart;
  164. return SetVariation(pSegState, dwVariationFlags, dwPart);
  165. }
  166. // other stuff
  167. HRESULT LoadPattern(IAARIFFStream* pIRiffStream, MMCKINFO* pckMain, DMStyleStruct* pNewStyle);
  168. HRESULT GetParam(
  169. REFGUID rCommandGuid,
  170. MUSIC_TIME mtTime,
  171. void * pStateData,
  172. MUSIC_TIME* pmtNext,
  173. void *pData);
  174. // IAuditionTrack data members
  175. protected:
  176. // new internal play method
  177. HRESULT STDMETHODCALLTYPE Play(
  178. /*[in]*/ void* pStateData,
  179. /*[in]*/ MUSIC_TIME mtStart,
  180. /*[in]*/ MUSIC_TIME mtEnd,
  181. /*[in]*/ MUSIC_TIME mtOffset,
  182. REFERENCE_TIME rtOffset,
  183. DWORD dwFlags,
  184. IDirectMusicPerformance* pPerf,
  185. IDirectMusicSegmentState* pSegState,
  186. DWORD dwVirtualID,
  187. BOOL fClockTime
  188. );
  189. // attributes
  190. long m_cRef;
  191. CRITICAL_SECTION m_CriticalSection; // for load and playback
  192. BOOL m_fCSInitialized;
  193. PatternTrackInfo* m_pTrackInfo;
  194. BYTE m_bRequiresSave;
  195. };
  196. struct AuditionTrackState : public PatternTrackState
  197. {
  198. AuditionTrackState();
  199. ~AuditionTrackState();
  200. // methods
  201. HRESULT Play(
  202. /*[in]*/ MUSIC_TIME mtStart,
  203. /*[in]*/ MUSIC_TIME mtEnd,
  204. /*[in]*/ MUSIC_TIME mtOffset,
  205. REFERENCE_TIME rtOffset,
  206. IDirectMusicPerformance* pPerformance,
  207. DWORD dwFlags,
  208. BOOL fClockTime
  209. );
  210. virtual DWORD Variations(DirectMusicPartRef& rPartRef, int nPartIndex);
  211. virtual BOOL PlayAsIs();
  212. HRESULT InitVariationInfo(DWORD dwVariations, DWORD dwPart, REFGUID rGuidPart, BOOL fByGuid);
  213. // attributes
  214. DWORD m_dwVariation; // Which variations to play
  215. DWORD m_dwPart; // PCHannel of the part to play with the selected variations
  216. GUID m_guidPart; // GUID of the part to play with the selected variations
  217. BOOL m_fByGUID; // true if selecting parts by GUID, false if by PChannel
  218. BOOL m_fTestVariations; // Are we testing individual variations?
  219. BYTE m_bVariationLock; // Variation Lock ID of the selected part
  220. MUSIC_TIME m_mtSectionOffset; // Elapsed time in the section (needed to calculate repeats)
  221. };
  222. #endif //__AUDITIONTRACK_H_