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.

122 lines
4.1 KiB

  1. // Copyright (c) 1998-1999 Microsoft Corporation
  2. // TSigTrk.h : Declaration of the CTimeSigTrack
  3. #ifndef __TSIGTRK_H_
  4. #define __TSIGTRK_H_
  5. #include "dmusici.h"
  6. #include "dmusicf.h"
  7. #include "alist.h"
  8. class CRiffParser;
  9. class CTimeSigItem : public AListItem
  10. {
  11. public:
  12. CTimeSigItem();
  13. CTimeSigItem* GetNext(){ return (CTimeSigItem*)AListItem::GetNext(); };
  14. DMUS_IO_TIMESIGNATURE_ITEM m_TimeSig;
  15. };
  16. class CTimeSigList : public AList
  17. {
  18. public:
  19. CTimeSigItem* GetHead() {return (CTimeSigItem*)AList::GetHead();};
  20. CTimeSigItem* RemoveHead() {return (CTimeSigItem*)AList::RemoveHead();};
  21. CTimeSigItem* GetItem(LONG lIndex) { return (CTimeSigItem*) AList::GetItem(lIndex);};
  22. };
  23. class CTimeSigStateData
  24. {
  25. public:
  26. CTimeSigStateData()
  27. {
  28. m_mtPrevEnd = 0;
  29. m_bBeat = 4;
  30. m_bBeatsPerMeasure = 4;
  31. m_mtTimeSig = 0;
  32. m_fActive = TRUE;
  33. /* don't need these since they are always initialized
  34. m_pPerformance = NULL;
  35. m_pSegState = NULL;
  36. m_dwVirtualTrackID = 0;
  37. */
  38. }
  39. CTimeSigItem * m_pCurrentTSig;
  40. IDirectMusicPerformance* m_pPerformance;
  41. IDirectMusicSegmentState* m_pSegState;
  42. DWORD m_dwVirtualTrackID;
  43. DWORD m_dwValidate; // used to validate state data
  44. MUSIC_TIME m_mtPrevEnd;
  45. MUSIC_TIME m_mtTimeSig; // previous time sig time
  46. BOOL m_fActive;
  47. BYTE m_bBeat; // previous beat
  48. BYTE m_bBeatsPerMeasure; // previous beats per measure
  49. };
  50. /////////////////////////////////////////////////////////////////////////////
  51. // CTimeSigTrack
  52. class CTimeSigTrack :
  53. public IPersistStream,
  54. public IDirectMusicTrack
  55. {
  56. public:
  57. CTimeSigTrack();
  58. CTimeSigTrack(CTimeSigTrack *pTrack, MUSIC_TIME mtStart, MUSIC_TIME mtEnd);
  59. ~CTimeSigTrack();
  60. // member variables
  61. protected:
  62. CTimeSigList m_TSigEventList;
  63. long m_cRef;
  64. DWORD m_dwValidate; // used to validate state data.
  65. CRITICAL_SECTION m_CrSec;
  66. BOOL m_fCSInitialized;
  67. BOOL m_fNotificationMeasureBeat;
  68. BOOL m_fActive; // Track is active for generating time signatures
  69. BOOL m_fStateSetBySetParam; // If TRUE, active flag was set by GUID. Don't override.
  70. public:
  71. // IUnknown
  72. STDMETHODIMP QueryInterface(const IID &iid, void **ppv);
  73. STDMETHODIMP_(ULONG) AddRef();
  74. STDMETHODIMP_(ULONG) Release();
  75. // IDirectMusicTrack methods
  76. STDMETHODIMP IsParamSupported(REFGUID rguid);
  77. STDMETHODIMP Init(IDirectMusicSegment *pSegment);
  78. STDMETHODIMP InitPlay(IDirectMusicSegmentState *pSegmentState,
  79. IDirectMusicPerformance *pPerformance,
  80. void **ppStateData,
  81. DWORD dwTrackID,
  82. DWORD dwFlags);
  83. STDMETHODIMP EndPlay(void *pStateData);
  84. STDMETHODIMP Play(void *pStateData,MUSIC_TIME mtStart,
  85. MUSIC_TIME mtEnd,MUSIC_TIME mtOffset,
  86. DWORD dwFlags,IDirectMusicPerformance* pPerf,
  87. IDirectMusicSegmentState* pSegSt,DWORD dwVirtualID);
  88. STDMETHODIMP GetParam(REFGUID rguid,MUSIC_TIME mtTime,MUSIC_TIME* pmtNext,void *pData);
  89. STDMETHODIMP SetParam(REFGUID rguid,MUSIC_TIME mtTime,void *pData);
  90. STDMETHODIMP AddNotificationType(REFGUID rguidNotification);
  91. STDMETHODIMP RemoveNotificationType(REFGUID rguidNotification);
  92. STDMETHODIMP Clone(MUSIC_TIME mtStart,MUSIC_TIME mtEnd,IDirectMusicTrack** ppTrack);
  93. // IPersist functions
  94. STDMETHODIMP GetClassID( CLSID* pClsId );
  95. // IPersistStream functions
  96. STDMETHODIMP IsDirty();
  97. STDMETHODIMP Load( IStream* pIStream );
  98. STDMETHODIMP Save( IStream* pIStream, BOOL fClearDirty );
  99. STDMETHODIMP GetSizeMax( ULARGE_INTEGER FAR* pcbSize );
  100. protected:
  101. HRESULT STDMETHODCALLTYPE Seek( void *pStateData,MUSIC_TIME mtTime,BOOL fGetPrevious);
  102. void Construct(void);
  103. void Clear();
  104. HRESULT LoadTimeSigList( CRiffParser *pParser, long lChunkSize );
  105. protected:
  106. MUSIC_TIME NotificationMeasureBeat( MUSIC_TIME mtStart, MUSIC_TIME mtEnd,
  107. CTimeSigStateData* pSD, MUSIC_TIME mtOffset );
  108. };
  109. #endif //__TSIGTRK_H_