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.

130 lines
4.2 KiB

  1. //
  2. // bandinst.h
  3. //
  4. // Copyright (c) 1997-1999 Microsoft Corporation
  5. //
  6. // Note: Originally written by Robert K. Amenn
  7. //
  8. #ifndef BANDINST_H
  9. #define BANDINST_H
  10. #include "dmusicc.h"
  11. #include "alist.h"
  12. struct IDirectMusicPerformance;
  13. struct IDirectMusicPerformanceP;
  14. struct IDirectMusicAudioPath;
  15. class CBandInstrumentList;
  16. class CBand;
  17. class CBandTrk;
  18. class CDownloadedInstrument : public AListItem
  19. {
  20. public:
  21. CDownloadedInstrument()
  22. {
  23. m_pDLInstrument = NULL;
  24. m_pPort = NULL;
  25. m_cRef = 1;
  26. }
  27. ~CDownloadedInstrument();
  28. CDownloadedInstrument* GetNext(){return(CDownloadedInstrument*)AListItem::GetNext();}
  29. public:
  30. IDirectMusicDownloadedInstrument* m_pDLInstrument;
  31. IDirectMusicPort* m_pPort;
  32. long m_cRef;
  33. };
  34. class CDownloadList : public AList
  35. {
  36. public:
  37. CDownloadList(){}
  38. ~CDownloadList() { Clear(); }
  39. void Clear();
  40. CDownloadedInstrument* GetHead(){return(CDownloadedInstrument *)AList::GetHead();}
  41. CDownloadedInstrument* GetItem(LONG lIndex){return(CDownloadedInstrument*)AList::GetItem(lIndex);}
  42. CDownloadedInstrument* RemoveHead(){return(CDownloadedInstrument *)AList::RemoveHead();}
  43. void Remove(CDownloadedInstrument* pDownloadedInstrument){AList::Remove((AListItem *)pDownloadedInstrument);}
  44. void AddTail(CDownloadedInstrument* pDownloadedInstrument){AList::AddTail((AListItem *)pDownloadedInstrument);}
  45. };
  46. //////////////////////////////////////////////////////////////////////
  47. // Class CBandInstrument
  48. class CBandInstrument : public AListItem
  49. {
  50. friend CBand;
  51. friend CBandTrk;
  52. public:
  53. CBandInstrument();
  54. ~CBandInstrument();
  55. CBandInstrument* GetNext(){return(CBandInstrument*)AListItem::GetNext();}
  56. HRESULT Download(IDirectMusicPerformanceP *pPerformance,
  57. IDirectMusicAudioPath *pPath,
  58. DWORD dwMIDIMode);
  59. HRESULT Unload(IDirectMusicPerformanceP *pPerformance, IDirectMusicAudioPath *pPath);
  60. private:
  61. HRESULT DownloadAddRecord(IDirectMusicPort *pPort);
  62. HRESULT BuildNoteRangeArray(DWORD *pNoteRangeMap, DMUS_NOTERANGE **ppNoteRanges, DWORD *pdwNumNoteRanges);
  63. DWORD m_dwPatch; // Patch used with DLS Collection
  64. DWORD m_dwAssignPatch; // Patch used with Download overrides m_dwPatch
  65. DWORD m_dwChannelPriority;
  66. BYTE m_bPan;
  67. BYTE m_bVolume;
  68. short m_nTranspose;
  69. BOOL m_fGMOnly;
  70. BOOL m_fNotInFile;
  71. DWORD m_dwFullPatch; // if m_fGMOnly is true, this contains the original, premodified, m_dwPatch
  72. DWORD m_dwPChannel;
  73. DWORD m_dwFlags;
  74. DWORD m_dwNoteRanges[4];
  75. short m_nPitchBendRange;
  76. IDirectMusicCollection* m_pIDMCollection;
  77. CDownloadList m_DownloadList;
  78. };
  79. //////////////////////////////////////////////////////////////////////
  80. // Class CBandInstrumentList
  81. class CBandInstrumentList : public AList
  82. {
  83. public:
  84. CBandInstrumentList(){}
  85. ~CBandInstrumentList() { Clear(); }
  86. void Clear();
  87. CBandInstrument* GetHead(){return(CBandInstrument *)AList::GetHead();}
  88. CBandInstrument* GetItem(LONG lIndex){return(CBandInstrument*)AList::GetItem(lIndex);}
  89. CBandInstrument* RemoveHead(){return(CBandInstrument *)AList::RemoveHead();}
  90. void Remove(CBandInstrument* pBandInstrument){AList::Remove((AListItem *)pBandInstrument);}
  91. void AddTail(CBandInstrument* pBandInstrument){AList::AddTail((AListItem *)pBandInstrument);}
  92. };
  93. // CDestination keeps track of which performance or audiopath the band was downloaded to.
  94. class CDestination : public AListItem
  95. {
  96. public:
  97. CBandInstrument* GetNext(){return(CBandInstrument*)AListItem::GetNext();}
  98. IUnknown * m_pDestination; // Performance or audiopath this download was sent to. This is a weak reference, no AddRef.
  99. };
  100. class CDestinationList : public AList
  101. {
  102. public:
  103. CDestinationList(){}
  104. ~CDestinationList() { Clear(); }
  105. void Clear();
  106. CDestination* GetHead(){return(CDestination *)AList::GetHead();}
  107. CDestination* GetItem(LONG lIndex){return(CDestination*)AList::GetItem(lIndex);}
  108. CDestination* RemoveHead(){return(CDestination *)AList::RemoveHead();}
  109. void Remove(CDestination* pDestination){AList::Remove((AListItem *)pDestination);}
  110. void AddTail(CDestination* pDestination){AList::AddTail((AListItem *)pDestination);}
  111. };
  112. #endif // #ifndef BANDINST_H