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.

127 lines
4.3 KiB

  1. // Copyright (c) 1998-1999 Microsoft Corporation
  2. // TempoTrk.h : Declaration of the CTempoTrack
  3. #ifndef __TEMPOTRK_H_
  4. #define __TEMPOTRK_H_
  5. #include "dmusici.h"
  6. #include "dmusicf.h"
  7. #include "..\dmstyle\tlist.h"
  8. struct PrivateTempo
  9. {
  10. double dblTempo;
  11. MUSIC_TIME mtTime;
  12. MUSIC_TIME mtDelta;
  13. bool fLast;
  14. PrivateTempo() : dblTempo(120.), mtTime(0), mtDelta(0), fLast(false) {}
  15. };
  16. DEFINE_GUID(GUID_PrivateTempoParam, 0xe8dbd832, 0xbcf0, 0x4c8c, 0xa0, 0x75, 0xa3, 0xf1, 0x5e, 0x67, 0xfd, 0x63);
  17. struct TempoStateData
  18. {
  19. IDirectMusicPerformance* pPerformance;
  20. IDirectMusicSegmentState* pSegState;
  21. DWORD dwVirtualTrackID;
  22. MUSIC_TIME mtPrevEnd;
  23. TListItem<DMUS_IO_TEMPO_ITEM>* pCurrentTempo;
  24. DWORD dwValidate;
  25. BOOL fActive;
  26. TempoStateData()
  27. {
  28. mtPrevEnd = 0;
  29. }
  30. };
  31. /////////////////////////////////////////////////////////////////////////////
  32. // CTempoTrack
  33. class CTempoTrack :
  34. public IPersistStream,
  35. public IDirectMusicTrack8
  36. {
  37. public:
  38. CTempoTrack();
  39. CTempoTrack(
  40. const CTempoTrack& rTrack, MUSIC_TIME mtStart, MUSIC_TIME mtEnd);
  41. ~CTempoTrack();
  42. // member variables
  43. protected:
  44. TList<DMUS_IO_TEMPO_ITEM> m_TempoEventList;
  45. long m_cRef;
  46. DWORD m_dwValidate; // used to validate state data
  47. CRITICAL_SECTION m_CrSec;
  48. BOOL m_fCSInitialized;
  49. BOOL m_fActive; // if FALSE, disable output and param support
  50. BOOL m_fStateSetBySetParam; // If TRUE, active flag was set by GUID. Don't override.
  51. public:
  52. // IUnknown
  53. STDMETHODIMP QueryInterface(const IID &iid, void **ppv);
  54. STDMETHODIMP_(ULONG) AddRef();
  55. STDMETHODIMP_(ULONG) Release();
  56. // IDirectMusicTrack methods
  57. STDMETHODIMP IsParamSupported(REFGUID rguid);
  58. STDMETHODIMP Init(IDirectMusicSegment *pSegment);
  59. STDMETHODIMP InitPlay(IDirectMusicSegmentState *pSegmentState,
  60. IDirectMusicPerformance *pPerformance,
  61. void **ppStateData,
  62. DWORD dwTrackID,
  63. DWORD dwFlags);
  64. STDMETHODIMP EndPlay(void *pStateData);
  65. STDMETHODIMP Play(void *pStateData,MUSIC_TIME mtStart,
  66. MUSIC_TIME mtEnd,MUSIC_TIME mtOffset,
  67. DWORD dwFlags,IDirectMusicPerformance* pPerf,
  68. IDirectMusicSegmentState* pSegSt,DWORD dwVirtualID);
  69. STDMETHODIMP GetParam(REFGUID rguid,MUSIC_TIME mtTime,MUSIC_TIME* pmtNext,void *pData);
  70. STDMETHODIMP SetParam(REFGUID rguid,MUSIC_TIME mtTime,void *pData);
  71. STDMETHODIMP AddNotificationType(REFGUID rguidNotification);
  72. STDMETHODIMP RemoveNotificationType(REFGUID rguidNotification);
  73. STDMETHODIMP Clone(MUSIC_TIME mtStart,MUSIC_TIME mtEnd,IDirectMusicTrack** ppTrack);
  74. // IDirectMusicTrack8
  75. STDMETHODIMP PlayEx(void* pStateData,REFERENCE_TIME rtStart,
  76. REFERENCE_TIME rtEnd,REFERENCE_TIME rtOffset,
  77. DWORD dwFlags,IDirectMusicPerformance* pPerf,
  78. IDirectMusicSegmentState* pSegSt,DWORD dwVirtualID) ;
  79. STDMETHODIMP GetParamEx(REFGUID rguidType,REFERENCE_TIME rtTime,
  80. REFERENCE_TIME* prtNext,void* pParam,void * pStateData, DWORD dwFlags) ;
  81. STDMETHODIMP SetParamEx(REFGUID rguidType,REFERENCE_TIME rtTime,void* pParam, void * pStateData, DWORD dwFlags) ;
  82. STDMETHODIMP Compose(IUnknown* pContext,
  83. DWORD dwTrackGroup,
  84. IDirectMusicTrack** ppResultTrack) ;
  85. STDMETHODIMP Join(IDirectMusicTrack* pNewTrack,
  86. MUSIC_TIME mtJoin,
  87. IUnknown* pContext,
  88. DWORD dwTrackGroup,
  89. IDirectMusicTrack** ppResultTrack) ;
  90. // IPersist functions
  91. STDMETHODIMP GetClassID( CLSID* pClsId );
  92. // IPersistStream functions
  93. STDMETHODIMP IsDirty();
  94. STDMETHODIMP Load( IStream* pIStream );
  95. STDMETHODIMP Save( IStream* pIStream, BOOL fClearDirty );
  96. STDMETHODIMP GetSizeMax( ULARGE_INTEGER FAR* pcbSize );
  97. protected:
  98. HRESULT Play(
  99. void *pStateData,
  100. MUSIC_TIME mtStart,
  101. MUSIC_TIME mtEnd,
  102. MUSIC_TIME mtOffset,
  103. REFERENCE_TIME rtOffset,
  104. DWORD dwFlags,
  105. IDirectMusicPerformance* pPerf,
  106. IDirectMusicSegmentState* pSegSt,
  107. DWORD dwVirtualID,
  108. BOOL fClockTime);
  109. HRESULT Seek(TempoStateData *pSD,MUSIC_TIME mtTime,BOOL fGetPrevious );
  110. void Construct(void);
  111. HRESULT JoinInternal(IDirectMusicTrack* pNewTrack,
  112. MUSIC_TIME mtJoin,
  113. DWORD dwTrackGroup);
  114. };
  115. #endif //__TEMPOTRK_H_