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.

229 lines
7.0 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (c) 1998-1999 Microsoft Corporation
  6. //
  7. // File: styletrk.h
  8. //
  9. //--------------------------------------------------------------------------
  10. // StyleTrack.h : Declaration of the CStyleTrack
  11. #ifndef __STYLETRACK_H_
  12. #define __STYLETRACK_H_
  13. #include "PtrnTrk.h"
  14. #include "dmusici.h"
  15. #include "dmstylep.h"
  16. struct StyleTrackInfo : public PatternTrackInfo
  17. {
  18. StyleTrackInfo();
  19. StyleTrackInfo(const StyleTrackInfo* pInfo, MUSIC_TIME mtStart, MUSIC_TIME mtEnd)
  20. : PatternTrackInfo(pInfo, mtStart, mtEnd)
  21. {
  22. m_dwPatternTag = DMUS_PATTERN_STYLE;
  23. }
  24. ~StyleTrackInfo();
  25. virtual HRESULT STDMETHODCALLTYPE Init(
  26. /*[in]*/ IDirectMusicSegment* pSegment
  27. );
  28. virtual HRESULT STDMETHODCALLTYPE InitPlay(
  29. /*[in]*/ IDirectMusicTrack* pParentrack,
  30. /*[in]*/ IDirectMusicSegmentState* pSegmentState,
  31. /*[in]*/ IDirectMusicPerformance* pPerformance,
  32. /*[out]*/ void** ppStateData,
  33. /*[in]*/ DWORD dwTrackID,
  34. /*[in]*/ DWORD dwFlags
  35. );
  36. HRESULT LoadStyleRefList( IAARIFFStream* pIRiffStream, MMCKINFO* pckParent );
  37. HRESULT LoadStyleRef( IAARIFFStream* pIRiffStream, MMCKINFO* pckParent );
  38. HRESULT LoadReference(IStream *pStream,
  39. IAARIFFStream *pIRiffStream,
  40. MMCKINFO& ckParent,
  41. IDMStyle** ppStyle);
  42. };
  43. /////////////////////////////////////////////////////////////////////////////
  44. // CStyleTrack
  45. class CStyleTrack :
  46. public IDirectMusicTrack8,
  47. public IStyleTrack,
  48. public IPersistStream
  49. {
  50. friend struct StyleTrackState;
  51. public:
  52. CStyleTrack();
  53. CStyleTrack(const CStyleTrack& rTrack, MUSIC_TIME mtStart, MUSIC_TIME mtEnd);
  54. ~CStyleTrack();
  55. // IUnknown
  56. //
  57. virtual STDMETHODIMP QueryInterface(const IID &iid, void **ppv);
  58. virtual STDMETHODIMP_(ULONG) AddRef();
  59. virtual STDMETHODIMP_(ULONG) Release();
  60. // IStyleTrack
  61. public:
  62. // IStyleTrack Methods
  63. HRESULT STDMETHODCALLTYPE Init(
  64. /*[in]*/ IDirectMusicSegment* pSegment
  65. );
  66. HRESULT STDMETHODCALLTYPE InitPlay(
  67. /*[in]*/ IDirectMusicSegmentState* pSegmentState,
  68. /*[in]*/ IDirectMusicPerformance* pPerformance,
  69. /*[out]*/ void** ppStateData,
  70. /*[in]*/ DWORD dwTrackID,
  71. /*[in]*/ DWORD dwFlags
  72. );
  73. HRESULT STDMETHODCALLTYPE EndPlay(
  74. /*[in]*/ void* pStateData
  75. );
  76. HRESULT STDMETHODCALLTYPE Play(
  77. /*[in]*/ void* pStateData,
  78. /*[in]*/ MUSIC_TIME mtStart,
  79. /*[in]*/ MUSIC_TIME mtEnd,
  80. /*[in]*/ MUSIC_TIME mtOffset,
  81. DWORD dwFlags,
  82. IDirectMusicPerformance* pPerf,
  83. IDirectMusicSegmentState* pSegState,
  84. DWORD dwVirtualID
  85. );
  86. HRESULT STDMETHODCALLTYPE GetPriority(
  87. /*[out]*/ DWORD* pPriority
  88. );
  89. HRESULT STDMETHODCALLTYPE GetParam(
  90. REFGUID pCommandGuid,
  91. MUSIC_TIME mtTime,
  92. MUSIC_TIME* pmtNext,
  93. void *pData);
  94. HRESULT STDMETHODCALLTYPE SetParam(
  95. /* [in] */ REFGUID pCommandGuid,
  96. /* [in] */ MUSIC_TIME mtTime,
  97. /* [out] */ void __RPC_FAR *pData);
  98. HRESULT STDMETHODCALLTYPE AddNotificationType(
  99. /* [in] */ REFGUID pGuidNotify
  100. );
  101. HRESULT STDMETHODCALLTYPE RemoveNotificationType(
  102. /* [in] */ REFGUID pGuidNotify
  103. );
  104. HRESULT STDMETHODCALLTYPE Clone(
  105. MUSIC_TIME mtStart,
  106. MUSIC_TIME mtEnd,
  107. IDirectMusicTrack** ppTrack);
  108. HRESULT STDMETHODCALLTYPE IsParamSupported(
  109. /*[in]*/ REFGUID pGuid
  110. );
  111. // IDirectMusicTrack8 Methods
  112. STDMETHODIMP PlayEx(void* pStateData,REFERENCE_TIME rtStart,
  113. REFERENCE_TIME rtEnd,REFERENCE_TIME rtOffset,
  114. DWORD dwFlags,IDirectMusicPerformance* pPerf,
  115. IDirectMusicSegmentState* pSegSt,DWORD dwVirtualID) ;
  116. STDMETHODIMP GetParamEx(REFGUID rguidType,REFERENCE_TIME rtTime,
  117. REFERENCE_TIME* prtNext,void* pParam,void * pStateData, DWORD dwFlags) ;
  118. STDMETHODIMP SetParamEx(REFGUID rguidType,REFERENCE_TIME rtTime,void* pParam, void * pStateData, DWORD dwFlags) ;
  119. STDMETHODIMP Compose(IUnknown* pContext,
  120. DWORD dwTrackGroup,
  121. IDirectMusicTrack** ppResultTrack) ;
  122. STDMETHODIMP Join(IDirectMusicTrack* pNewTrack,
  123. MUSIC_TIME mtJoin,
  124. IUnknown* pContext,
  125. DWORD dwTrackGroup,
  126. IDirectMusicTrack** ppResultTrack) ;
  127. // IPersist methods
  128. HRESULT STDMETHODCALLTYPE GetClassID( LPCLSID pclsid );
  129. // IPersistStream methods
  130. HRESULT STDMETHODCALLTYPE IsDirty();
  131. HRESULT STDMETHODCALLTYPE Save( LPSTREAM pStream, BOOL fClearDirty );
  132. HRESULT STDMETHODCALLTYPE GetSizeMax( ULARGE_INTEGER* /*pcbSize*/ );
  133. HRESULT STDMETHODCALLTYPE Load( LPSTREAM pStream );
  134. // IStyleTrack methods
  135. STDMETHOD(GetStyle)(IUnknown** ppStyle);
  136. STDMETHOD(SetTrack)(IUnknown* pStyle);
  137. // internal methods
  138. protected:
  139. // used by both GetParam and GetParamEx
  140. HRESULT STDMETHODCALLTYPE GetParam(
  141. REFGUID pCommandGuid,
  142. MUSIC_TIME mtTime,
  143. MUSIC_TIME* pmtNext,
  144. void *pData,
  145. void* pStateData);
  146. HRESULT JoinInternal(
  147. IDirectMusicTrack* pNewTrack,
  148. MUSIC_TIME mtJoin,
  149. DWORD dwTrackGroup);
  150. // IStyleTrack data members
  151. protected:
  152. // attributes
  153. long m_cRef;
  154. CRITICAL_SECTION m_CriticalSection; // for load and playback
  155. BOOL m_fCSInitialized;
  156. PatternTrackInfo* m_pTrackInfo;
  157. BYTE m_bRequiresSave;
  158. };
  159. struct StyleTrackState : public PatternTrackState
  160. {
  161. StyleTrackState();
  162. ~StyleTrackState();
  163. // methods
  164. HRESULT Play(
  165. /*[in]*/ MUSIC_TIME mtStart,
  166. /*[in]*/ MUSIC_TIME mtEnd,
  167. /*[in]*/ MUSIC_TIME mtOffset,
  168. REFERENCE_TIME rtOffset,
  169. IDirectMusicPerformance* pPerformance,
  170. DWORD dwFlags,
  171. BOOL fClockTime
  172. );
  173. HRESULT GetNextPattern(DWORD dwFlags, MUSIC_TIME mtNow, MUSIC_TIME mtOffset, IDirectMusicPerformance* pPerformance, BOOL fSkipVariations = FALSE);
  174. MUSIC_TIME PartOffset(int nPartIndex);
  175. //CDirectMusicPattern* SelectPattern(bool fNewMode, TList<CDirectMusicPattern*>& rPatternList);
  176. // attributes
  177. MUSIC_TIME m_mtSectionOffset; // Elapsed time in the section
  178. MUSIC_TIME m_mtSectionOffsetTemp; // temporary value for m_mtSectionOffset
  179. MUSIC_TIME m_mtNextCommandTime; // when the next command begins
  180. MUSIC_TIME m_mtNextCommandTemp; // temporary values for m_mtNextCommandTime
  181. MUSIC_TIME m_mtNextStyleTime; // when the next style begins
  182. DMUS_COMMAND_PARAM_2 m_CommandData; // data about the current command
  183. // DMUS_RHYTHM_PARAM* m_pChordRhythm; // data about the current chord's rhythm
  184. // short m_nLongestPattern; // length of longest pattern in a style
  185. // DMUS_COMMAND_PARAM_2* m_pCommands; // array of commands (for pattern selection)
  186. // DWORD* m_pRhythms; // array of rhythms (for pattern selection)
  187. MUSIC_TIME m_mtOverlap; // section overlap caused by controlling segment
  188. TList<CDirectMusicPattern*> m_PlayedPatterns; // list of patterns already played that match current groove level
  189. };
  190. #endif //__STYLETRACK_H_