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.

68 lines
1.9 KiB

  1. // Copyright (c) 1999 Microsoft Corporation. All rights reserved.
  2. //
  3. // Declaration of CLyricTrack.
  4. //
  5. // This track type holds events that send DMUS_LYRIC_PMSG notifications at
  6. // specific points during playback of a segment.
  7. #pragma once
  8. #include "trackhelp.h"
  9. #include "tlist.h"
  10. #include "smartref.h"
  11. #include "dmusicf.h"
  12. //////////////////////////////////////////////////////////////////////
  13. // Types
  14. // Items in list of events
  15. struct LyricInfo
  16. {
  17. LyricInfo() : dwFlags(0), dwTimingFlags(0), lTriggerTime(0), lTimePhysical(0) {}
  18. HRESULT Clone(const LyricInfo &o, MUSIC_TIME mtStart)
  19. {
  20. *this = o;
  21. lTriggerTime -= mtStart;
  22. lTimePhysical -= mtStart;
  23. return S_OK;
  24. }
  25. DWORD dwFlags;
  26. DWORD dwTimingFlags;
  27. MUSIC_TIME lTriggerTime; // Logical time
  28. MUSIC_TIME lTimePhysical;
  29. SmartRef::WString wstrText;
  30. };
  31. //////////////////////////////////////////////////////////////////////
  32. // CLyricsTrack
  33. class CLyricsTrack;
  34. typedef CPlayingTrack<CLyricsTrack, LyricInfo> CLyricsTrackBase;
  35. class CLyricsTrack
  36. : public CLyricsTrackBase
  37. {
  38. public:
  39. // When the lyric track plays one of its items, it sends a Lyric PMsg through its segment state. If an invalidation occurs,
  40. // the PMsg is retracted by the performance. Then the track is played again (with the FLUSH bit set). The last pameter to
  41. // the CSegTriggerTrackBase is true, which instructs it to play the item a second time--to replace the retracted lyric.
  42. CLyricsTrack(HRESULT *pHr) : CLyricsTrackBase(&g_cComponent, CLSID_DirectMusicLyricsTrack, false, true) {}
  43. protected:
  44. HRESULT PlayItem(
  45. const LyricInfo &item,
  46. statedata &state,
  47. IDirectMusicPerformance *pPerf,
  48. IDirectMusicSegmentState* pSegSt,
  49. DWORD dwVirtualID,
  50. MUSIC_TIME mtOffset,
  51. REFERENCE_TIME rtOffset,
  52. bool fClockTime);
  53. HRESULT LoadRiff(SmartRef::RiffIter &ri, IDirectMusicLoader *pIDMLoader);
  54. private:
  55. HRESULT LoadLyric(SmartRef::RiffIter ri);
  56. };