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.

1178 lines
36 KiB

  1. /************************************************************************
  2. * *
  3. * dmusicf.h -- This module defines the DirectMusic file formats *
  4. * *
  5. * Copyright (c) 1998, Microsoft Corp. All rights reserved. *
  6. * *
  7. ************************************************************************/
  8. #ifndef _DMUSICF_
  9. #define _DMUSICF_
  10. #include <windows.h>
  11. #define COM_NO_WINDOWS_H
  12. #include <objbase.h>
  13. #include <mmsystem.h>
  14. #include <pshpack8.h>
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. interface IDirectMusicCollection;
  19. #ifndef __cplusplus
  20. typedef interface IDirectMusicCollection IDirectMusicCollection;
  21. #endif
  22. /* Common chunks */
  23. #define DMUS_FOURCC_GUID_CHUNK mmioFOURCC('g','u','i','d')
  24. #define DMUS_FOURCC_INFO_LIST mmioFOURCC('I','N','F','O')
  25. #define DMUS_FOURCC_UNFO_LIST mmioFOURCC('U','N','F','O')
  26. #define DMUS_FOURCC_UNAM_CHUNK mmioFOURCC('U','N','A','M')
  27. #define DMUS_FOURCC_UART_CHUNK mmioFOURCC('U','A','R','T')
  28. #define DMUS_FOURCC_UCOP_CHUNK mmioFOURCC('U','C','O','P')
  29. #define DMUS_FOURCC_USBJ_CHUNK mmioFOURCC('U','S','B','J')
  30. #define DMUS_FOURCC_UCMT_CHUNK mmioFOURCC('U','C','M','T')
  31. #define DMUS_FOURCC_CATEGORY_CHUNK mmioFOURCC('c','a','t','g')
  32. #define DMUS_FOURCC_VERSION_CHUNK mmioFOURCC('v','e','r','s')
  33. /* The following structures are used by the Tracks, and are the packed structures */
  34. /* that are passed to the Tracks inside the IStream. */
  35. typedef struct _DMUS_IO_SEQ_ITEM
  36. {
  37. MUSIC_TIME mtTime;
  38. MUSIC_TIME mtDuration;
  39. DWORD dwPChannel;
  40. short nOffset;
  41. BYTE bStatus;
  42. BYTE bByte1;
  43. BYTE bByte2;
  44. } DMUS_IO_SEQ_ITEM;
  45. typedef struct _DMUS_IO_CURVE_ITEM
  46. {
  47. MUSIC_TIME mtStart;
  48. MUSIC_TIME mtDuration;
  49. MUSIC_TIME mtResetDuration;
  50. DWORD dwPChannel;
  51. short nOffset;
  52. short nStartValue;
  53. short nEndValue;
  54. short nResetValue;
  55. BYTE bType;
  56. BYTE bCurveShape;
  57. BYTE bCCData;
  58. BYTE bFlags;
  59. } DMUS_IO_CURVE_ITEM;
  60. typedef struct _DMUS_IO_TEMPO_ITEM
  61. {
  62. MUSIC_TIME lTime;
  63. double dblTempo;
  64. } DMUS_IO_TEMPO_ITEM;
  65. typedef struct _DMUS_IO_SYSEX_ITEM
  66. {
  67. MUSIC_TIME mtTime;
  68. DWORD dwPChannel;
  69. DWORD dwSysExLength;
  70. } DMUS_IO_SYSEX_ITEM;
  71. typedef struct _DMUS_IO_TIMESIGNATURE_ITEM
  72. {
  73. MUSIC_TIME lTime;
  74. BYTE bBeatsPerMeasure; /* beats per measure (top of time sig) */
  75. BYTE bBeat; /* what note receives the beat (bottom of time sig.) */
  76. /* we can assume that 0 means 256th note */
  77. WORD wGridsPerBeat; /* grids per beat */
  78. } DMUS_IO_TIMESIGNATURE_ITEM;
  79. /* PARAM structures, used by GetParam() and SetParam() */
  80. typedef struct _DMUS_COMMAND_PARAM
  81. {
  82. BYTE bCommand;
  83. BYTE bGrooveLevel;
  84. BYTE bGrooveRange;
  85. } DMUS_COMMAND_PARAM;
  86. typedef struct _DMUS_COMMAND_PARAM_2
  87. {
  88. MUSIC_TIME mtTime;
  89. BYTE bCommand;
  90. BYTE bGrooveLevel;
  91. BYTE bGrooveRange;
  92. } DMUS_COMMAND_PARAM_2;
  93. typedef DMUS_CHORD_KEY DMUS_CHORD_PARAM; /* DMUS_CHORD_KEY defined in dmusici.h */
  94. typedef struct _DMUS_RHYTHM_PARAM
  95. {
  96. DMUS_TIMESIGNATURE TimeSig;
  97. DWORD dwRhythmPattern;
  98. } DMUS_RHYTHM_PARAM;
  99. typedef struct _DMUS_TEMPO_PARAM
  100. {
  101. MUSIC_TIME mtTime;
  102. double dblTempo;
  103. } DMUS_TEMPO_PARAM;
  104. typedef struct _DMUS_MUTE_PARAM
  105. {
  106. DWORD dwPChannel;
  107. DWORD dwPChannelMap;
  108. BOOL fMute;
  109. } DMUS_MUTE_PARAM;
  110. /* Style chunks */
  111. #define DMUS_FOURCC_STYLE_FORM mmioFOURCC('D','M','S','T')
  112. #define DMUS_FOURCC_STYLE_CHUNK mmioFOURCC('s','t','y','h')
  113. #define DMUS_FOURCC_PART_LIST mmioFOURCC('p','a','r','t')
  114. #define DMUS_FOURCC_PART_CHUNK mmioFOURCC('p','r','t','h')
  115. #define DMUS_FOURCC_NOTE_CHUNK mmioFOURCC('n','o','t','e')
  116. #define DMUS_FOURCC_CURVE_CHUNK mmioFOURCC('c','r','v','e')
  117. #define DMUS_FOURCC_PATTERN_LIST mmioFOURCC('p','t','t','n')
  118. #define DMUS_FOURCC_PATTERN_CHUNK mmioFOURCC('p','t','n','h')
  119. #define DMUS_FOURCC_RHYTHM_CHUNK mmioFOURCC('r','h','t','m')
  120. #define DMUS_FOURCC_PARTREF_LIST mmioFOURCC('p','r','e','f')
  121. #define DMUS_FOURCC_PARTREF_CHUNK mmioFOURCC('p','r','f','c')
  122. #define DMUS_FOURCC_STYLE_PERS_REF_LIST mmioFOURCC('p', 'r', 'r', 'f')
  123. #define DMUS_FOURCC_MOTIFSETTINGS_CHUNK mmioFOURCC('m', 't', 'f', 's')
  124. /* Flags used by variations: these make up the DWORDs in dwVariationChoices. */
  125. /* These flags determine the types of chords supported by a given variation in DirectMusic */
  126. /* mode. The first seven flags (bits 1-7) are set if the variation supports major chords */
  127. /* rooted in scale positions, so, e.g., if bits 1, 2, and 4 are set, the variation */
  128. /* supports major chords rooted in the tonic, second, and fourth scale positions. The */
  129. /* next seven flags serve the same purpose, but for minor chords, and the following seven */
  130. /* flags serve the same purpose for chords that are not major or minor (e.g., SUS 4 */
  131. /* chords). Bits 22, 23, and 24 are set if the variation supports chords rooted in the */
  132. /* scale, chords rooted sharp of scale tones, and chords rooted flat of scale tones, */
  133. /* respectively. For example, to support a C# minor chord in the scale of C Major, */
  134. /* bits 8 (for tonic minor) and 24 (for sharp) need to be set. Bits 25, 26, an 27 handle */
  135. /* chords that are triads, 6th or 7th chords, and chords with extensions, respectively. */
  136. /* bits 28 and 29 handle chords that are followed by tonic and dominant chords, */
  137. /* respectively. */
  138. #define DMUS_VARIATIONF_MAJOR 0x0000007F /* Seven positions in the scale - major chords. */
  139. #define DMUS_VARIATIONF_MINOR 0x00003F80 /* Seven positions in the scale - minor chords. */
  140. #define DMUS_VARIATIONF_OTHER 0x001FC000 /* Seven positions in the scale - other chords. */
  141. #define DMUS_VARIATIONF_ROOT_SCALE 0x00200000 /* Handles chord roots in the scale. */
  142. #define DMUS_VARIATIONF_ROOT_FLAT 0x00400000 /* Handles flat chord roots (based on scale notes). */
  143. #define DMUS_VARIATIONF_ROOT_SHARP 0x00800000 /* Handles sharp chord roots (based on scale notes). */
  144. #define DMUS_VARIATIONF_TYPE_TRIAD 0x01000000 /* Handles simple chords - triads. */
  145. #define DMUS_VARIATIONF_TYPE_6AND7 0x02000000 /* Handles simple chords - 6 and 7. */
  146. #define DMUS_VARIATIONF_TYPE_COMPLEX 0x04000000 /* Handles complex chords. */
  147. #define DMUS_VARIATIONF_DEST_TO1 0x08000000 /* Handles transitions to 1 chord. */
  148. #define DMUS_VARIATIONF_DEST_TO5 0x10000000 /* Handles transitions to 5 chord. */
  149. /* The top three bits of the variation flags are the Mode bits. If all are 0, it's IMA. */
  150. /* If the smallest is 1, it's Direct Music. */
  151. #define DMUS_VARIATIONF_MODES 0xE0000000
  152. #define DMUS_VARIATIONF_IMA25_MODE 0x00000000
  153. #define DMUS_VARIATIONF_DMUS_MODE 0x20000000
  154. #pragma pack(2)
  155. typedef struct _DMUS_IO_TIMESIG
  156. {
  157. /* Time signatures define how many beats per measure, which note receives */
  158. /* the beat, and the grid resolution. */
  159. BYTE bBeatsPerMeasure; /* beats per measure (top of time sig) */
  160. BYTE bBeat; /* what note receives the beat (bottom of time sig.) */
  161. /* we can assume that 0 means 256th note */
  162. WORD wGridsPerBeat; /* grids per beat */
  163. } DMUS_IO_TIMESIG;
  164. typedef struct _DMUS_IO_STYLE
  165. {
  166. DMUS_IO_TIMESIG timeSig; /* Styles have a default Time Signature */
  167. double dblTempo;
  168. } DMUS_IO_STYLE;
  169. typedef struct _DMUS_IO_VERSION
  170. {
  171. DWORD dwVersionMS; /* Version # high-order 32 bits */
  172. DWORD dwVersionLS; /* Version # low-order 32 bits */
  173. } DMUS_IO_VERSION;
  174. typedef struct _DMUS_IO_PATTERN
  175. {
  176. DMUS_IO_TIMESIG timeSig; /* Patterns can override the Style's Time sig. */
  177. BYTE bGrooveBottom; /* bottom of groove range */
  178. BYTE bGrooveTop; /* top of groove range */
  179. WORD wEmbellishment; /* Fill, Break, Intro, End, Normal, Motif */
  180. WORD wNbrMeasures; /* length in measures */
  181. } DMUS_IO_PATTERN;
  182. typedef struct _DMUS_IO_STYLEPART
  183. {
  184. DMUS_IO_TIMESIG timeSig; /* can override pattern's */
  185. DWORD dwVariationChoices[32]; /* MOAW choice bitfield */
  186. GUID guidPartID; /* identifies the part */
  187. WORD wNbrMeasures; /* length of the Part */
  188. BYTE bPlayModeFlags; /* see PLAYMODE flags */
  189. BYTE bInvertUpper; /* inversion upper limit */
  190. BYTE bInvertLower; /* inversion lower limit */
  191. } DMUS_IO_STYLEPART;
  192. typedef struct _DMUS_IO_PARTREF
  193. {
  194. GUID guidPartID; /* unique ID for matching up with parts */
  195. WORD wLogicalPartID; /* corresponds to port/device/midi channel */
  196. BYTE bVariationLockID; /* parts with the same ID lock variations. */
  197. /* high bit is used to identify master Part */
  198. BYTE bSubChordLevel; /* tells which sub chord level this part wants */
  199. BYTE bPriority; /* 256 priority levels. Parts with lower priority */
  200. /* aren't played first when a device runs out of */
  201. /* notes */
  202. BYTE bRandomVariation; /* when set, matching variations play in random order */
  203. /* when clear, matching variations play sequentially */
  204. } DMUS_IO_PARTREF;
  205. typedef struct _DMUS_IO_STYLENOTE
  206. {
  207. MUSIC_TIME mtGridStart; /* when this note occurs */
  208. DWORD dwVariation; /* variation bits */
  209. MUSIC_TIME mtDuration; /* how long this note lasts */
  210. short nTimeOffset; /* offset from mtGridStart */
  211. WORD wMusicValue; /* Position in scale. */
  212. BYTE bVelocity; /* Note velocity. */
  213. BYTE bTimeRange; /* Range to randomize start time. */
  214. BYTE bDurRange; /* Range to randomize duration. */
  215. BYTE bVelRange; /* Range to randomize velocity. */
  216. BYTE bInversionID; /* Identifies inversion group to which this note belongs */
  217. BYTE bPlayModeFlags; /* Can override part */
  218. } DMUS_IO_STYLENOTE;
  219. typedef struct _DMUS_IO_STYLECURVE
  220. {
  221. MUSIC_TIME mtGridStart; /* when this curve occurs */
  222. DWORD dwVariation; /* variation bits */
  223. MUSIC_TIME mtDuration; /* how long this curve lasts */
  224. MUSIC_TIME mtResetDuration;/* how long after the end of the curve to reset the curve */
  225. short nTimeOffset; /* offset from mtGridStart */
  226. short nStartValue; /* curve's start value */
  227. short nEndValue; /* curve's end value */
  228. short nResetValue; /* the value to which to reset the curve */
  229. BYTE bEventType; /* type of curve */
  230. BYTE bCurveShape; /* shape of curve */
  231. BYTE bCCData; /* CC# */
  232. BYTE bFlags; /* Bit 1=TRUE means to send nResetValue. Otherwise, don't.
  233. Other bits are reserved. */
  234. } DMUS_IO_STYLECURVE;
  235. typedef struct _DMUS_IO_MOTIFSETTINGS
  236. {
  237. DWORD dwRepeats; /* Number of repeats. By default, 0. */
  238. MUSIC_TIME mtPlayStart; /* Start of playback. By default, 0. */
  239. MUSIC_TIME mtLoopStart; /* Start of looping portion. By default, 0. */
  240. MUSIC_TIME mtLoopEnd; /* End of loop. Must be greater than mtLoopStart. By default equal to length of motif. */
  241. DWORD dwResolution; /* Default resolution. */
  242. } DMUS_IO_MOTIFSETTINGS;
  243. #pragma pack()
  244. /*
  245. RIFF
  246. (
  247. 'DMST' // Style
  248. <styh-ck> // Style header chunk
  249. <guid-ck> // Every Style has a GUID
  250. [<UNFO-list>] // Name, author, copyright info., comments
  251. [<vers-ck>] // version chunk
  252. <part-list>... // List of parts in the Style, used by patterns
  253. <pttn-list>... // List of patterns in the Style
  254. <DMBD-form>... // List of bands in the Style
  255. [<motf-list>] // List of motifs in the Style
  256. [<prrf-list>] // List of chord map references in the Style
  257. )
  258. // <styh-ck>
  259. styh
  260. (
  261. <DMUS_IO_STYLE>
  262. )
  263. // <guid-ck>
  264. guid
  265. (
  266. <GUID>
  267. )
  268. // <vers-ck>
  269. vers
  270. (
  271. <DMUS_IO_VERSION>
  272. )
  273. // <part-list>
  274. LIST
  275. (
  276. 'part'
  277. <prth-ck> // Part header chunk
  278. [<UNFO-list>]
  279. [<note-ck>] // List of notes in Part
  280. [<crve-ck>] // List of curves in Part
  281. )
  282. // <orth-ck>
  283. prth
  284. (
  285. <DMUS_IO_STYLEPART>
  286. )
  287. // <note-ck>
  288. 'note'
  289. (
  290. // sizeof DMUS_IO_STYLENOTE:DWORD
  291. <DMUS_IO_STYLENOTE>...
  292. )
  293. // <crve-ck>
  294. 'crve'
  295. (
  296. // sizeof DMUS_IO_STYLECURVE:DWORD
  297. <DMUS_IO_STYLECURVE>...
  298. )
  299. // <pttn-list>
  300. LIST
  301. (
  302. 'pttn'
  303. <ptnh-ck> // Pattern header chunk
  304. <rhtm-ck> // List of rhythms for chord matching
  305. [<UNFO-list>]
  306. [<mtfs-ck>] // Motif settings chunk
  307. <pref-list>... // List of part reference id's
  308. )
  309. // <ptnh-ck>
  310. ptnh
  311. (
  312. <DMUS_IO_PATTERN>
  313. )
  314. // <rhtm-ck>
  315. 'rhtm'
  316. (
  317. // DWORD's representing rhythms for chord matching based on number
  318. // of measures in the pattern
  319. )
  320. // pref-list
  321. LIST
  322. (
  323. 'pref'
  324. <prfc-ck> // part ref chunk
  325. )
  326. // <prfc-ck>
  327. prfc
  328. (
  329. <DMUS_IO_PARTREF>
  330. )
  331. // <mtfs-ck>
  332. mtfs
  333. (
  334. <DMUS_IO_MOTIFSETTINGS>
  335. )
  336. // <prrf-list>
  337. LIST
  338. (
  339. 'prrf'
  340. // some number of <DMRF>
  341. )
  342. */
  343. /* Chord and command file formats */
  344. #define DMUS_FOURCC_CHORDTRACK_LIST mmioFOURCC('c','o','r','d')
  345. #define DMUS_FOURCC_CHORDTRACKHEADER_CHUNK mmioFOURCC('c','r','d','h')
  346. #define DMUS_FOURCC_CHORDTRACKBODY_CHUNK mmioFOURCC('c','r','d','b')
  347. #define DMUS_FOURCC_COMMANDTRACK_CHUNK mmioFOURCC('c','m','n','d')
  348. typedef struct _DMUS_IO_CHORD
  349. {
  350. WCHAR wszName[16]; /* Name of the chord */
  351. MUSIC_TIME mtTime; /* Time of this chord */
  352. WORD wMeasure; /* Measure this falls on */
  353. BYTE bBeat; /* Beat this falls on */
  354. } DMUS_IO_CHORD;
  355. typedef struct _DMUS_IO_SUBCHORD
  356. {
  357. DWORD dwChordPattern; /* Notes in the subchord */
  358. DWORD dwScalePattern; /* Notes in the scale */
  359. DWORD dwInversionPoints; /* Where inversions can occur */
  360. DWORD dwLevels; /* Which levels are supported by this subchord */
  361. BYTE bChordRoot; /* Root of the subchord */
  362. BYTE bScaleRoot; /* Root of the scale */
  363. } DMUS_IO_SUBCHORD;
  364. typedef struct _DMUS_IO_COMMAND
  365. {
  366. MUSIC_TIME mtTime; /* Time of this command */
  367. WORD wMeasure; /* Measure this falls on */
  368. BYTE bBeat; /* Beat this falls on */
  369. BYTE bCommand; /* Command type (see #defines below) */
  370. BYTE bGrooveLevel; /* Groove level (0 if command is not a groove) */
  371. BYTE bGrooveRange; /* Groove range */
  372. } DMUS_IO_COMMAND;
  373. /*
  374. // <cord-list>
  375. LIST
  376. (
  377. 'cord'
  378. <crdh-ck>
  379. <crdb-ck> // Chord body chunk
  380. )
  381. // <crdh-ck>
  382. crdh
  383. (
  384. // Scale: dword (upper 8 bits for root, lower 24 for scale)
  385. )
  386. // <crdb-ck>
  387. crdb
  388. (
  389. // sizeof DMUS_IO_CHORD:dword
  390. <DMUS_IO_CHORD>
  391. // # of DMUS_IO_SUBCHORDS:dword
  392. // sizeof DMUS_IO_SUBCHORDS:dword
  393. // a number of <DMUS_IO_SUBCHORD>
  394. )
  395. // <cmnd-list>
  396. 'cmnd'
  397. (
  398. //sizeof DMUS_IO_COMMAND: DWORD
  399. <DMUS_IO_COMMAND>...
  400. )
  401. */
  402. /* File io for DirectMusic Tool and ToolGraph objects
  403. */
  404. /* RIFF ids: */
  405. #define DMUS_FOURCC_TOOLGRAPH_FORM mmioFOURCC('D','M','T','G')
  406. #define DMUS_FOURCC_TOOL_LIST mmioFOURCC('t','o','l','l')
  407. #define DMUS_FOURCC_TOOL_FORM mmioFOURCC('D','M','T','L')
  408. #define DMUS_FOURCC_TOOL_CHUNK mmioFOURCC('t','o','l','h')
  409. /* io structures: */
  410. typedef struct _DMUS_IO_TOOL_HEADER
  411. {
  412. GUID guidClassID; /* Class id of tool. */
  413. long lIndex; /* Position in graph. */
  414. DWORD cPChannels; /* Number of items in channels array. */
  415. FOURCC ckid; /* chunk ID of tool's data chunk if 0 fccType valid. */
  416. FOURCC fccType; /* list type if NULL ckid valid. */
  417. DWORD dwPChannels[1]; /* Array of PChannels, size determined by cPChannels. */
  418. } DMUS_IO_TOOL_HEADER;
  419. /*
  420. RIFF
  421. (
  422. 'DMTG' // DirectMusic ToolGraph chunk
  423. [<guid-ck>] // GUID for ToolGraph
  424. [<vers-ck>] // Optional version info
  425. [<UNFO-list>] // Name, author, copyright info., comments
  426. <toll-list> // List of Tools
  427. )
  428. // <guid-ck>
  429. 'guid'
  430. (
  431. <GUID>
  432. )
  433. // <vers-ck>
  434. vers
  435. (
  436. <DMUS_IO_VERSION>
  437. )
  438. // <toll-list>
  439. LIST
  440. (
  441. 'toll' // List of tools
  442. <DMTL-form>... // Each tool is encapsulated in a RIFF chunk
  443. )
  444. // <DMTL-form> // Tools can be embedded in a graph or stored as separate files.
  445. RIFF
  446. (
  447. 'DMTL'
  448. <tolh-ck>
  449. [<guid-ck>] // Optional GUID for tool object instance (not to be confused with Class id in track header)
  450. [<vers-ck>] // Optional version info
  451. [<UNFO-list>] // Optional name, author, copyright info., comments
  452. [<data>] // Tool data. Must be a RIFF readable chunk.
  453. )
  454. // <tolh-ck> // Tool header chunk
  455. (
  456. 'tolh'
  457. <DMUS_IO_TOOL_HEADER> // Tool header
  458. )
  459. */
  460. /* File io for DirectMusic Band Track object */
  461. /* RIFF ids: */
  462. #define DMUS_FOURCC_BANDTRACK_FORM mmioFOURCC('D','M','B','T')
  463. #define DMUS_FOURCC_BANDTRACK_CHUNK mmioFOURCC('b','d','t','h')
  464. #define DMUS_FOURCC_BANDS_LIST mmioFOURCC('l','b','d','l')
  465. #define DMUS_FOURCC_BAND_LIST mmioFOURCC('l','b','n','d')
  466. #define DMUS_FOURCC_BANDITEM_CHUNK mmioFOURCC('b','d','i','h')
  467. /* io structures */
  468. typedef struct _DMUS_IO_BAND_TRACK_HEADER
  469. {
  470. BOOL bAutoDownload; /* Determines if Auto-Download is enabled. */
  471. } DMUS_IO_BAND_TRACK_HEADER;
  472. typedef struct _DMUS_IO_BAND_ITEM_HEADER
  473. {
  474. MUSIC_TIME lBandTime; /* Position in track list. */
  475. } DMUS_IO_BAND_ITEM_HEADER;
  476. /*
  477. RIFF
  478. (
  479. 'DMBT' // DirectMusic Band Track form-type
  480. [<bdth-ck>] // Band track header
  481. [<guid-ck>] // GUID for band track
  482. [<vers-ck>] // Optional version info
  483. [<UNFO-list>] // Name, author, copyright info., comments
  484. <lbdl-list> // List of Band Lists
  485. )
  486. // <bnth-ck>
  487. 'bdth'
  488. (
  489. <DMUS_IO_BAND_TRACK_HEADER>
  490. )
  491. // <guid-ck>
  492. 'guid'
  493. (
  494. <GUID>
  495. )
  496. // <vers-ck>
  497. vers
  498. (
  499. <DMUS_IO_VERSION>
  500. )
  501. // <lbdl-list>
  502. LIST
  503. (
  504. 'lbdl' // List of bands
  505. <lbnd-list> // Each band is encapsulated in a list
  506. )
  507. // <lbnd-list>
  508. LIST
  509. (
  510. 'lbnd'
  511. <bdih-ck>
  512. <DMBD-form> // Band
  513. )
  514. // <bdih-ck> // band item header
  515. (
  516. <DMUS_IO_BAND_ITEM_HEADER> // Band item header
  517. )
  518. */
  519. /* File io for DirectMusic Band object
  520. */
  521. /* RIFF ids: */
  522. #define DMUS_FOURCC_BAND_FORM mmioFOURCC('D','M','B','D')
  523. #define DMUS_FOURCC_INSTRUMENTS_LIST mmioFOURCC('l','b','i','l')
  524. #define DMUS_FOURCC_INSTRUMENT_LIST mmioFOURCC('l','b','i','n')
  525. #define DMUS_FOURCC_INSTRUMENT_CHUNK mmioFOURCC('b','i','n','s')
  526. /* Flags for DMUS_IO_INSTRUMENT
  527. */
  528. #define DMUS_IO_INST_PATCH (1 << 0) /* dwPatch is valid. */
  529. #define DMUS_IO_INST_BANKSELECT (1 << 1) /* dwPatch contains a valid Bank Select MSB and LSB part */
  530. #define DMUS_IO_INST_ASSIGN_PATCH (1 << 3) /* dwAssignPatch is valid */
  531. #define DMUS_IO_INST_NOTERANGES (1 << 4) /* dwNoteRanges is valid */
  532. #define DMUS_IO_INST_PAN (1 << 5) /* bPan is valid */
  533. #define DMUS_IO_INST_VOLUME (1 << 6 ) /* bVolume is valid */
  534. #define DMUS_IO_INST_TRANSPOSE (1 << 7) /* nTranspose is valid */
  535. #define DMUS_IO_INST_GM (1 << 8) /* Instrument is from GM collection */
  536. #define DMUS_IO_INST_GS (1 << 9) /* Instrument is from GS collection */
  537. #define DMUS_IO_INST_XG (1 << 10) /* Instrument is from XG collection */
  538. #define DMUS_IO_INST_CHANNEL_PRIORITY (1 << 11) /* dwChannelPriority is valid */
  539. #define DMUS_IO_INST_USE_DEFAULT_GM_SET (1 << 12) /* Always use the default GM set for this patch, */
  540. /* don't rely on the synth caps stating GM or GS in hardware. */
  541. /* io structures */
  542. typedef struct _DMUS_IO_INSTRUMENT
  543. {
  544. DWORD dwPatch; /* MSB, LSB and Program change to define instrument */
  545. DWORD dwAssignPatch; /* MSB, LSB and Program change to assign to instrument when downloading */
  546. DWORD dwNoteRanges[4]; /* 128 bits; one for each MIDI note instrument needs to able to play */
  547. DWORD dwPChannel; /* PChannel instrument plays on */
  548. DWORD dwFlags; /* DMUS_IO_INST_ flags */
  549. BYTE bPan; /* Pan for instrument */
  550. BYTE bVolume; /* Volume for instrument */
  551. short nTranspose; /* Number of semitones to transpose notes */
  552. DWORD dwChannelPriority; /* Channel priority */
  553. } DMUS_IO_INSTRUMENT;
  554. /*
  555. // <DMBD-form> bands can be embedded in other forms
  556. RIFF
  557. (
  558. 'DMBD' // DirectMusic Band chunk
  559. [<guid-ck>] // GUID for band
  560. [<vers-ck>] // Optional version info
  561. [<UNFO-list>] // Name, author, copyright info., comments
  562. <lbil-list> // List of Instruments
  563. )
  564. // <guid-ck>
  565. 'guid'
  566. (
  567. <GUID>
  568. )
  569. // <vers-ck>
  570. vers
  571. (
  572. <DMUS_IO_VERSION>
  573. )
  574. // <lbil-list>
  575. LIST
  576. (
  577. 'lbil' // List of instruments
  578. <lbin-list> // Each instrument is encapsulated in a list
  579. )
  580. // <lbin-list>
  581. LIST
  582. (
  583. 'lbin'
  584. <bins-ck>
  585. [<DMRF-list>] // Optional reference to DLS Collection file.
  586. )
  587. // <bins-ck> // Instrument chunk
  588. (
  589. 'bins'
  590. <DMUS_IO_INSTRUMENT> // Instrument header
  591. )
  592. */
  593. /* File io for DirectMusic Segment object */
  594. /* RIFF ids: */
  595. #define DMUS_FOURCC_SEGMENT_FORM mmioFOURCC('D','M','S','G')
  596. #define DMUS_FOURCC_SEGMENT_CHUNK mmioFOURCC('s','e','g','h')
  597. #define DMUS_FOURCC_TRACK_LIST mmioFOURCC('t','r','k','l')
  598. #define DMUS_FOURCC_TRACK_FORM mmioFOURCC('D','M','T','K')
  599. #define DMUS_FOURCC_TRACK_CHUNK mmioFOURCC('t','r','k','h')
  600. /* io structures:*/
  601. typedef struct _DMUS_IO_SEGMENT_HEADER
  602. {
  603. DWORD dwRepeats; /* Number of repeats. By default, 0. */
  604. MUSIC_TIME mtLength; /* Length, in music time. */
  605. MUSIC_TIME mtPlayStart; /* Start of playback. By default, 0. */
  606. MUSIC_TIME mtLoopStart; /* Start of looping portion. By default, 0. */
  607. MUSIC_TIME mtLoopEnd; /* End of loop. Must be greater than dwPlayStart. By default equal to length. */
  608. DWORD dwResolution; /* Default resolution. */
  609. } DMUS_IO_SEGMENT_HEADER;
  610. typedef struct _DMUS_IO_TRACK_HEADER
  611. {
  612. GUID guidClassID; /* Class id of track. */
  613. DWORD dwPosition; /* Position in track list. */
  614. DWORD dwGroup; /* Group bits for track. */
  615. FOURCC ckid; /* chunk ID of track's data chunk if 0 fccType valid. */
  616. FOURCC fccType; /* list type if NULL ckid valid */
  617. } DMUS_IO_TRACK_HEADER;
  618. /*
  619. RIFF
  620. (
  621. 'DMSG' // DirectMusic Segment chunk
  622. <segh-ck> // Segment header chunk
  623. [<guid-ck>] // GUID for segment
  624. [<vers-ck>] // Optional version info
  625. [<UNFO-list>] // Name, author, copyright info., comments
  626. <trkl-list> // List of Tracks
  627. [<DMTG-form>] // Optional ToolGraph
  628. )
  629. // <segh-ck>
  630. 'segh'
  631. (
  632. <DMUS_IO_SEGMENT_HEADER>
  633. )
  634. // <guid-ck>
  635. 'guid'
  636. (
  637. <GUID>
  638. )
  639. // <vers-ck>
  640. vers
  641. (
  642. <DMUS_IO_VERSION>
  643. )
  644. // <trkl-list>
  645. LIST
  646. (
  647. 'trkl' // List of tracks
  648. <DMTK-form>... // Each track is encapsulated in a RIFF chunk
  649. )
  650. // <DMTK-form> // Tracks can be embedded in a segment or stored as separate files.
  651. RIFF
  652. (
  653. 'DMTK'
  654. <trkh-ck>
  655. [<guid-ck>] // Optional GUID for track object instance (not to be confused with Class id in track header)
  656. [<vers-ck>] // Optional version info
  657. [<UNFO-list>] // Optional name, author, copyright info., comments
  658. [<data>] // Track data. Must be a RIFF readable chunk.
  659. )
  660. // <trkh-ck> // Track header chunk
  661. (
  662. 'trkh'
  663. <DMUS_IO_TRACK_HEADER> // Track header
  664. )
  665. */
  666. /* File io for DirectMusic reference chunk.
  667. This is used to embed a reference to an object.
  668. */
  669. /* RIFF ids: */
  670. #define DMUS_FOURCC_REF_LIST mmioFOURCC('D','M','R','F')
  671. #define DMUS_FOURCC_REF_CHUNK mmioFOURCC('r','e','f','h')
  672. #define DMUS_FOURCC_DATE_CHUNK mmioFOURCC('d','a','t','e')
  673. #define DMUS_FOURCC_NAME_CHUNK mmioFOURCC('n','a','m','e')
  674. #define DMUS_FOURCC_FILE_CHUNK mmioFOURCC('f','i','l','e')
  675. typedef struct _DMUS_IO_REFERENCE
  676. {
  677. GUID guidClassID; /* Class id is always required. */
  678. DWORD dwValidData; /* Flags. */
  679. } DMUS_IO_REFERENCE;
  680. /*
  681. LIST
  682. (
  683. 'DMRF' // DirectMusic Reference chunk
  684. <refh-ck> // Reference header chunk
  685. [<guid-ck>] // Optional object GUID.
  686. [<date-ck>] // Optional file date.
  687. [<name-ck>] // Optional name.
  688. [<file-ck>] // Optional file name.
  689. [<catg-ck>] // Optional category name.
  690. [<vers-ck>] // Optional version info.
  691. )
  692. // <refh-ck>
  693. 'refh'
  694. (
  695. <DMUS_IO_REFERENCE>
  696. )
  697. // <guid-ck>
  698. 'guid'
  699. (
  700. <GUID>
  701. )
  702. // <date-ck>
  703. date
  704. (
  705. <FILETIME>
  706. )
  707. // <name-ck>
  708. name
  709. (
  710. // Name, stored as NULL terminated string of WCHARs
  711. )
  712. // <file-ck>
  713. file
  714. (
  715. // File name, stored as NULL terminated string of WCHARs
  716. )
  717. // <catg-ck>
  718. catg
  719. (
  720. // Category name, stored as NULL terminated string of WCHARs
  721. )
  722. // <vers-ck>
  723. vers
  724. (
  725. <DMUS_IO_VERSION>
  726. )
  727. */
  728. /* Chord Maps */
  729. /* runtime chunks */
  730. #define DMUS_FOURCC_CHORDMAP_FORM mmioFOURCC('D','M','P','R')
  731. #define DMUS_FOURCC_IOCHORDMAP_CHUNK mmioFOURCC('p','e','r','h')
  732. #define DMUS_FOURCC_SUBCHORD_CHUNK mmioFOURCC('c','h','d','t')
  733. #define DMUS_FOURCC_CHORDENTRY_CHUNK mmioFOURCC('c','h','e','h')
  734. #define DMUS_FOURCC_SUBCHORDID_CHUNK mmioFOURCC('s','b','c','n')
  735. #define DMUS_FOURCC_IONEXTCHORD_CHUNK mmioFOURCC('n','c','r','d')
  736. #define DMUS_FOURCC_NEXTCHORDSEQ_CHUNK mmioFOURCC('n','c','s','q')
  737. #define DMUS_FOURCC_IOSIGNPOST_CHUNK mmioFOURCC('s','p','s','h')
  738. #define DMUS_FOURCC_CHORDNAME_CHUNK mmioFOURCC('I','N','A','M')
  739. /* runtime list chunks */
  740. #define DMUS_FOURCC_CHORDENTRY_LIST mmioFOURCC('c','h','o','e')
  741. #define DMUS_FOURCC_CHORDMAP_LIST mmioFOURCC('c','m','a','p')
  742. #define DMUS_FOURCC_CHORD_LIST mmioFOURCC('c','h','r','d')
  743. #define DMUS_FOURCC_CHORDPALETTE_LIST mmioFOURCC('c','h','p','l')
  744. #define DMUS_FOURCC_CADENCE_LIST mmioFOURCC('c','a','d','e')
  745. #define DMUS_FOURCC_SIGNPOSTITEM_LIST mmioFOURCC('s','p','s','t')
  746. #define DMUS_FOURCC_SIGNPOST_LIST mmioFOURCC('s','p','s','q')
  747. /* values for dwChord field of DMUS_IO_PERS_SIGNPOST */
  748. /* DMUS_SIGNPOSTF_ flags are also used in templates (DMUS_IO_SIGNPOST) */
  749. #define DMUS_SIGNPOSTF_A 1
  750. #define DMUS_SIGNPOSTF_B 2
  751. #define DMUS_SIGNPOSTF_C 4
  752. #define DMUS_SIGNPOSTF_D 8
  753. #define DMUS_SIGNPOSTF_E 0x10
  754. #define DMUS_SIGNPOSTF_F 0x20
  755. #define DMUS_SIGNPOSTF_LETTER (DMUS_SIGNPOSTF_A | DMUS_SIGNPOSTF_B | DMUS_SIGNPOSTF_C | DMUS_SIGNPOSTF_D | DMUS_SIGNPOSTF_E | DMUS_SIGNPOSTF_F)
  756. #define DMUS_SIGNPOSTF_1 0x100
  757. #define DMUS_SIGNPOSTF_2 0x200
  758. #define DMUS_SIGNPOSTF_3 0x400
  759. #define DMUS_SIGNPOSTF_4 0x800
  760. #define DMUS_SIGNPOSTF_5 0x1000
  761. #define DMUS_SIGNPOSTF_6 0x2000
  762. #define DMUS_SIGNPOSTF_7 0x4000
  763. #define DMUS_SIGNPOSTF_ROOT (DMUS_SIGNPOSTF_1 | DMUS_SIGNPOSTF_2 | DMUS_SIGNPOSTF_3 | DMUS_SIGNPOSTF_4 | DMUS_SIGNPOSTF_5 | DMUS_SIGNPOSTF_6 | DMUS_SIGNPOSTF_7)
  764. #define DMUS_SIGNPOSTF_CADENCE 0x8000
  765. /* values for dwChord field of DMUS_IO_PERS_SIGNPOST */
  766. #define DMUS_SPOSTCADENCEF_1 2 /* Use the first cadence chord. */
  767. #define DMUS_SPOSTCADENCEF_2 4 /* Use the second cadence chord. */
  768. /* run time data structs */
  769. typedef struct _DMUS_IO_CHORDMAP
  770. {
  771. WCHAR wszLoadName[20];
  772. DWORD dwScalePattern;
  773. DWORD dwFlags;
  774. } DMUS_IO_CHORDMAP;
  775. typedef struct _DMUS_IO_CHORDMAP_SUBCHORD
  776. {
  777. DWORD dwChordPattern;
  778. DWORD dwScalePattern;
  779. DWORD dwInvertPattern;
  780. BYTE bChordRoot;
  781. BYTE bScaleRoot;
  782. WORD wCFlags;
  783. DWORD dwLevels; /* parts or which subchord levels this chord supports */
  784. } DMUS_IO_CHORDMAP_SUBCHORD;
  785. /* Legacy name... */
  786. typedef DMUS_IO_CHORDMAP_SUBCHORD DMUS_IO_PERS_SUBCHORD;
  787. typedef struct _DMUS_IO_CHORDENTRY
  788. {
  789. DWORD dwFlags;
  790. WORD wConnectionID; /* replaces runtime "pointer to this" */
  791. } DMUS_IO_CHORDENTRY;
  792. typedef struct _DMUS_IO_NEXTCHORD
  793. {
  794. DWORD dwFlags;
  795. WORD nWeight;
  796. WORD wMinBeats;
  797. WORD wMaxBeats;
  798. WORD wConnectionID; /* points to an ioChordEntry */
  799. } DMUS_IO_NEXTCHORD;
  800. typedef struct _DMUS_IO_CHORDMAP_SIGNPOST
  801. {
  802. DWORD dwChords; /* 1bit per group */
  803. DWORD dwFlags;
  804. } DMUS_IO_CHORDMAP_SIGNPOST;
  805. /* Legacy name... */
  806. typedef DMUS_IO_CHORDMAP_SIGNPOST DMUS_IO_PERS_SIGNPOST;
  807. /*
  808. RIFF
  809. (
  810. 'DMPR'
  811. <perh-ck> // Chord map header chunk
  812. [<guid-ck>] // guid chunk
  813. [<vers-ck>] // version chunk (two DWORDS)
  814. [<UNFO-list>] // Unfo chunk
  815. <chdt-ck> // subchord database
  816. <chpl-list> // chord palette
  817. <cmap-list> // chord map
  818. <spsq-list> // signpost list
  819. )
  820. <cmap-list> ::= LIST('cmap' <choe-list> )
  821. <choe-list> ::= LIST('choe'
  822. <cheh-ck> // chord entry data
  823. <chrd-list> // chord definition
  824. <ncsq-ck> // connecting(next) chords
  825. )
  826. <chrd-list> ::= LIST('chrd'
  827. <INAM-ck> // name of chord in wide char format
  828. <sbcn-ck> // list of subchords composing chord
  829. )
  830. <chpl-list> ::= LIST('chpl'
  831. <chrd-list> ... // chord definition
  832. )
  833. <spsq-list> ::== LIST('spsq' <spst-list> ... )
  834. <spst-list> ::= LIST('spst'
  835. <spsh-ck>
  836. <chrd-list>
  837. [<cade-list>]
  838. )
  839. <cade-list> ::= LIST('cade' <chrd-list> ...)
  840. <perh-ck> ::= perh(<DMUS_IO_CHORDMAP>)
  841. <chdt-ck> ::= chdt(<cbChordSize::WORD>
  842. <DMUS_IO_PERS_SUBCHORD> ... )
  843. <cheh-ck> ::= cheh(<DMUS_IO_CHORDENTRY>)
  844. <sbcn-ck> ::= sbcn(<cSubChordID:WORD> ...)
  845. <ncsq-ck> ::= ncsq(<wNextChordSize:WORD>
  846. <DMUS_IO_NEXTCHORD>...)
  847. <spsh-ck> ::= spsh(<DMUS_IO_PERS_SIGNPOST>)
  848. */
  849. /* Signpost tracks */
  850. #define DMUS_FOURCC_SIGNPOST_TRACK_CHUNK mmioFOURCC( 's', 'g', 'n', 'p' )
  851. typedef struct _DMUS_IO_SIGNPOST
  852. {
  853. MUSIC_TIME mtTime;
  854. DWORD dwChords;
  855. WORD wMeasure;
  856. } DMUS_IO_SIGNPOST;
  857. /*
  858. // <sgnp-list>
  859. 'sgnp'
  860. (
  861. //sizeof DMUS_IO_SIGNPOST: DWORD
  862. <DMUS_IO_SIGNPOST>...
  863. )
  864. */
  865. #define DMUS_FOURCC_MUTE_CHUNK mmioFOURCC('m','u','t','e')
  866. typedef struct _DMUS_IO_MUTE
  867. {
  868. MUSIC_TIME mtTime;
  869. DWORD dwPChannel;
  870. DWORD dwPChannelMap;
  871. } DMUS_IO_MUTE;
  872. /*
  873. // <mute-list>
  874. 'mute'
  875. (
  876. //sizeof DMUS_IO_MUTE:DWORD
  877. <DMUS_IO_MUTE>...
  878. )
  879. */
  880. /* Used for both style and chord map tracks */
  881. #define DMUS_FOURCC_TIME_STAMP_CHUNK mmioFOURCC('s', 't', 'm', 'p')
  882. /* Style tracks */
  883. #define DMUS_FOURCC_STYLE_TRACK_LIST mmioFOURCC('s', 't', 't', 'r')
  884. #define DMUS_FOURCC_STYLE_REF_LIST mmioFOURCC('s', 't', 'r', 'f')
  885. /*
  886. // <sttr-list>
  887. LIST('sttr'
  888. (
  889. // some number of <strf-list>
  890. )
  891. // <strf-list>
  892. LIST('strf'
  893. (
  894. <stmp-ck>
  895. <DMRF>
  896. )
  897. // <stmp-ck> defined in ..\dmcompos\dmcompp.h
  898. */
  899. /* Chord map tracks */
  900. #define DMUS_FOURCC_PERS_TRACK_LIST mmioFOURCC('p', 'f', 't', 'r')
  901. #define DMUS_FOURCC_PERS_REF_LIST mmioFOURCC('p', 'f', 'r', 'f')
  902. /*
  903. // <pftr-list>
  904. LIST('pftr'
  905. (
  906. // some number of <pfrf-list>
  907. )
  908. // <pfrf-list>
  909. LIST('pfrf'
  910. (
  911. <stmp-ck>
  912. <DMRF>
  913. )
  914. // <stmp-ck>
  915. 'stmp'
  916. (
  917. // time:DWORD
  918. )
  919. */
  920. #define DMUS_FOURCC_TEMPO_TRACK mmioFOURCC('t','e','t','r')
  921. /*
  922. // tempo list
  923. 'tetr'
  924. (
  925. // sizeof DMUS_IO_TEMPO_ITEM: DWORD
  926. <DMUS_IO_TEMPO_ITEM>...
  927. )
  928. */
  929. #define DMUS_FOURCC_SEQ_TRACK mmioFOURCC('s','e','q','t')
  930. #define DMUS_FOURCC_SEQ_LIST mmioFOURCC('e','v','t','l')
  931. #define DMUS_FOURCC_CURVE_LIST mmioFOURCC('c','u','r','l')
  932. /*
  933. // sequence track
  934. 'seqt'
  935. (
  936. // sequence list
  937. 'evtl'
  938. (
  939. // sizeof DMUS_IO_SEQ_ITEM: DWORD
  940. <DMUS_IO_SEQ_ITEM>...
  941. )
  942. // curve list
  943. 'curl'
  944. (
  945. // sizeof DMUS_IO_CURVE_ITEM: DWORD
  946. <DMUS_IO_CURVE_ITEM>...
  947. )
  948. )
  949. */
  950. #define DMUS_FOURCC_SYSEX_TRACK mmioFOURCC('s','y','e','x')
  951. /*
  952. // sysex track
  953. 'syex'
  954. (
  955. // list of:
  956. // {
  957. // <DMUS_IO_SYSEX_ITEM>
  958. // sys-ex: data
  959. // }...
  960. )
  961. */
  962. #define DMUS_FOURCC_TIMESIGNATURE_TRACK mmioFOURCC('t','i','m','s')
  963. /*
  964. // time signature track
  965. 'tims'
  966. (
  967. // size of DMUS_IO_TIMESIGNATURE_ITEM : DWORD
  968. <DMUS_IO_TIMESIGNATURE_ITEM>...
  969. )
  970. */
  971. #ifdef __cplusplus
  972. }; /* extern "C" */
  973. #endif
  974. #include <poppack.h>
  975. #endif /* #ifndef _DMUSICF_ */