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.

208 lines
4.4 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (c) 1998-1999 Microsoft Corporation
  6. //
  7. // File: iodmcomp.h
  8. //
  9. //--------------------------------------------------------------------------
  10. #ifndef PERSONALITYRIFF_H
  11. #define PERSONALITYRIFF_H
  12. // runtime chunks
  13. #define FOURCC_PERSONALITY mmioFOURCC('D','M','P','R')
  14. #define FOURCC_IOPERSONALITY mmioFOURCC('p','e','r','h')
  15. #define DM_FOURCC_GUID_CHUNK mmioFOURCC('g','u','i','d')
  16. #define DM_FOURCC_INFO_LIST mmioFOURCC('I','N','F','O')
  17. #define DM_FOURCC_VERSION_CHUNK mmioFOURCC('v','e','r','s')
  18. #define FOURCC_SUBCHORD mmioFOURCC('c','h','d','t')
  19. #define FOURCC_CHORDENTRY mmioFOURCC('c','h','e','h')
  20. #define FOURCC_SUBCHORDID mmioFOURCC('s','b','c','n')
  21. #define FOURCC_IONEXTCHORD mmioFOURCC('n','c','r','d')
  22. #define FOURCC_NEXTCHORDSEQ mmioFOURCC('n','c','s','q')
  23. #define FOURCC_IOSIGNPOST mmioFOURCC('s','p','s','h')
  24. #define FOURCC_CHORDNAME mmioFOURCC('I','N','A','M')
  25. // runtime list chunks
  26. #define FOURCC_LISTCHORDENTRY mmioFOURCC('c','h','o','e')
  27. #define FOURCC_LISTCHORDMAP mmioFOURCC('c','m','a','p')
  28. #define FOURCC_LISTCHORD mmioFOURCC('c','h','r','d')
  29. #define FOURCC_LISTCHORDPALETTE mmioFOURCC('c','h','p','l')
  30. #define FOURCC_LISTCADENCE mmioFOURCC('c','a','d','e')
  31. #define FOURCC_LISTSIGNPOSTITEM mmioFOURCC('s','p','s','t')
  32. #define FOURCC_SIGNPOSTLIST mmioFOURCC('s','p','s','q')
  33. // constants
  34. const int MaxSubChords = 4;
  35. // simple riff read/writers
  36. inline HRESULT ReadWord(IAARIFFStream* pIRiffStream, WORD& val)
  37. {
  38. assert(pIRiffStream);
  39. IStream* pIStream = pIRiffStream->GetStream();
  40. assert(pIStream);
  41. if(pIStream)
  42. {
  43. HRESULT hr = pIStream->Read(&val, sizeof(WORD), 0);
  44. pIStream->Release();
  45. return hr;
  46. }
  47. else
  48. {
  49. return E_FAIL;
  50. }
  51. }
  52. class ReadChunk
  53. {
  54. MMCKINFO m_ck;
  55. MMCKINFO* m_pckParent;
  56. IAARIFFStream* m_pRiffStream;
  57. HRESULT m_hr;
  58. public:
  59. ReadChunk(IAARIFFStream* pRiffStream, MMCKINFO* pckParent) : m_pRiffStream(pRiffStream)
  60. {
  61. m_pckParent = pckParent;
  62. m_hr = pRiffStream->Descend( &m_ck, m_pckParent, 0 );
  63. }
  64. ~ReadChunk()
  65. {
  66. if(m_hr == 0)
  67. {
  68. m_hr = m_pRiffStream->Ascend(&m_ck, 0);
  69. }
  70. }
  71. HRESULT State(MMCKINFO* pck=0)
  72. {
  73. if(pck)
  74. {
  75. memcpy(pck, &m_ck, sizeof(MMCKINFO));
  76. }
  77. return m_hr;
  78. }
  79. FOURCC Id()
  80. {
  81. if(m_ck.ckid = FOURCC_LIST)
  82. {
  83. return m_ck.fccType;
  84. }
  85. else
  86. {
  87. return m_ck.ckid;
  88. }
  89. }
  90. };
  91. // run time data structs
  92. struct ioPersonality
  93. {
  94. char szLoadName[20];
  95. DWORD dwScalePattern;
  96. DWORD dwFlags;
  97. };
  98. struct ioSubChord
  99. {
  100. DWORD dwChordPattern;
  101. DWORD dwScalePattern;
  102. DWORD dwInvertPattern;
  103. BYTE bChordRoot;
  104. BYTE bScaleRoot;
  105. WORD wCFlags;
  106. DWORD dwLevels; // parts or which subchord levels this chord supports
  107. };
  108. struct ioChordEntry
  109. {
  110. DWORD dwFlags;
  111. WORD wConnectionID; // replaces runtime "pointer to this"
  112. };
  113. struct ioNextChord
  114. {
  115. DWORD dwFlags;
  116. WORD nWeight;
  117. WORD wMinBeats;
  118. WORD wMaxBeats;
  119. WORD wConnectionID; // points to an ioChordEntry
  120. };
  121. struct ioSignPost
  122. {
  123. DWORD dwChords; // 1bit per group
  124. DWORD dwFlags;
  125. };
  126. /*
  127. RIFF
  128. (
  129. 'DMPR'
  130. <perh-ck> // Personality header chunk
  131. [<guid-ck>] // guid chunk
  132. [<vers-ck>] // version chunk (two DWORDS)
  133. <INFO-list> // standard MS Info chunk
  134. <chdt-ck> // subchord database
  135. <chpl-list> // chord palette
  136. <cmap-list> // chord map
  137. <spst-list> // signpost list
  138. [<ceed-ck>] // optional chordmap position data
  139. )
  140. <chdt> ::= chdt(<cbChordSize::WORD> <ioSubChord> ... )
  141. <chpl-list> ::= LIST('chpl'
  142. <chrd-list> ... // chord definition
  143. )
  144. <chrd-list> ::= LIST('chrd'
  145. <INAM-ck> // name of chord in wide char format
  146. <sbcn-ck> // list of subchords composing chord
  147. [<ched-ck>] // optional chord edit flags
  148. )
  149. <cmap-list> ::= LIST('cmap' <choe-list> )
  150. <choe-list> ::= LIST('choe'
  151. <cheh-ck> // chord entry data
  152. <chrd-list> // chord definition
  153. <ncsq-ck> // connecting(next) chords
  154. )
  155. <spst-list> ::= LIST('spst'
  156. <spsh-ck>
  157. <chrd-list>
  158. [<cade-list>]
  159. )
  160. <cade-list> ::= LIST('cade' <chrd-list> ...)
  161. <sbcn-ck> ::= sbcn(<cSubChordID:WORD>)
  162. <ceed-ck> ::= ceed(ioChordEntryEdit)
  163. <ched-ck> ::= ched(DMChordEdit)
  164. <cheh-ck> ::= cheh(i<ioChordEntry>)
  165. <ncrd-ck> ::= ncrd(<ioNextChord>)
  166. <ncsq-ck> ::= ncsq(<wNextChordSize:WORD> <ioNextChord>...)
  167. <spsh-ck> ::= spsh(<ioSignPost>)
  168. */
  169. struct ioDMSignPost
  170. {
  171. MUSIC_TIME m_mtTime;
  172. DWORD m_dwChords;
  173. WORD m_wMeasure;
  174. };
  175. #endif