home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the 3D Game Programming Gurus / gurus.iso / DirectX / dx9sdkcp.exe / SDK (C++) / Include / dmusicf.h < prev    next >
Encoding:
C/C++ Source or Header  |  2002-11-12  |  73.5 KB  |  2,200 lines

  1. /************************************************************************
  2. *                                                                       *
  3. *   dmusicf.h -- This module defines the DirectMusic file formats       *
  4. *                                                                       *
  5. *   Copyright (c) Microsoft Corporation.  All rights reserved.          *
  6. *                                                                       *
  7. ************************************************************************/
  8.  
  9. #ifndef _DMUSICF_
  10. #define _DMUSICF_
  11.  
  12.  
  13. #include <windows.h>
  14.  
  15. #define COM_NO_WINDOWS_H
  16. #include <objbase.h>
  17.  
  18. #include <mmsystem.h>
  19.  
  20. #include <pshpack8.h>
  21.  
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25.  
  26. interface IDirectMusicCollection;
  27. #ifndef __cplusplus 
  28. typedef interface IDirectMusicCollection IDirectMusicCollection;
  29. #endif
  30.  
  31. /* Common chunks */
  32.  
  33. #define DMUS_FOURCC_GUID_CHUNK        mmioFOURCC('g','u','i','d')
  34. #define DMUS_FOURCC_INFO_LIST         mmioFOURCC('I','N','F','O')
  35. #define DMUS_FOURCC_UNFO_LIST         mmioFOURCC('U','N','F','O')
  36. #define DMUS_FOURCC_UNAM_CHUNK        mmioFOURCC('U','N','A','M')
  37. #define DMUS_FOURCC_UART_CHUNK        mmioFOURCC('U','A','R','T')
  38. #define DMUS_FOURCC_UCOP_CHUNK        mmioFOURCC('U','C','O','P')
  39. #define DMUS_FOURCC_USBJ_CHUNK        mmioFOURCC('U','S','B','J')
  40. #define DMUS_FOURCC_UCMT_CHUNK        mmioFOURCC('U','C','M','T')
  41. #define DMUS_FOURCC_CATEGORY_CHUNK    mmioFOURCC('c','a','t','g')
  42. #define DMUS_FOURCC_VERSION_CHUNK     mmioFOURCC('v','e','r','s')
  43.  
  44. /* The following structures are used by the Tracks, and are the packed structures */
  45. /* that are passed to the Tracks inside the IStream. */
  46.  
  47.  
  48. typedef struct _DMUS_IO_SEQ_ITEM
  49. {
  50.     MUSIC_TIME    mtTime;
  51.     MUSIC_TIME    mtDuration;
  52.     DWORD         dwPChannel;
  53.     short         nOffset; 
  54.     BYTE          bStatus;
  55.     BYTE          bByte1;
  56.     BYTE          bByte2;
  57. } DMUS_IO_SEQ_ITEM;
  58.  
  59.  
  60. typedef struct _DMUS_IO_CURVE_ITEM
  61. {
  62.     MUSIC_TIME  mtStart;
  63.     MUSIC_TIME  mtDuration;
  64.     MUSIC_TIME  mtResetDuration;
  65.     DWORD       dwPChannel;
  66.     short       nOffset;
  67.     short       nStartValue;
  68.     short       nEndValue;
  69.     short       nResetValue;
  70.     BYTE        bType;
  71.     BYTE        bCurveShape;
  72.     BYTE        bCCData;
  73.     BYTE        bFlags;
  74.     /* Following was added for DX8. */
  75.     WORD        wParamType;      /* RPN or NRPN parameter number. */
  76.     WORD        wMergeIndex;     /* Allows multiple parameters to be merged (pitchbend, volume, and expression.) */
  77. } DMUS_IO_CURVE_ITEM;
  78.  
  79.  
  80. typedef struct _DMUS_IO_TEMPO_ITEM
  81. {
  82.     MUSIC_TIME    lTime;
  83.     double        dblTempo;
  84. } DMUS_IO_TEMPO_ITEM;
  85.  
  86.  
  87. typedef struct _DMUS_IO_SYSEX_ITEM
  88. {
  89.     MUSIC_TIME    mtTime;
  90.     DWORD         dwPChannel;
  91.     DWORD         dwSysExLength;
  92. } DMUS_IO_SYSEX_ITEM;
  93.  
  94. typedef DMUS_CHORD_KEY DMUS_CHORD_PARAM; /* DMUS_CHORD_KEY defined in dmusici.h */
  95.  
  96. typedef struct _DMUS_RHYTHM_PARAM
  97. {
  98.     DMUS_TIMESIGNATURE  TimeSig;
  99.     DWORD               dwRhythmPattern;
  100. } DMUS_RHYTHM_PARAM;
  101.  
  102. typedef struct _DMUS_TEMPO_PARAM
  103. {
  104.     MUSIC_TIME  mtTime;
  105.     double      dblTempo;
  106. } DMUS_TEMPO_PARAM;
  107.  
  108.  
  109. typedef struct _DMUS_MUTE_PARAM
  110. {
  111.     DWORD   dwPChannel;
  112.     DWORD   dwPChannelMap;
  113.     BOOL    fMute;
  114. } DMUS_MUTE_PARAM;
  115.  
  116. /* Style chunks */
  117.  
  118. #define DMUS_FOURCC_STYLE_FORM            mmioFOURCC('D','M','S','T')
  119. #define DMUS_FOURCC_STYLE_CHUNK           mmioFOURCC('s','t','y','h')
  120. #define DMUS_FOURCC_PART_LIST             mmioFOURCC('p','a','r','t')
  121. #define DMUS_FOURCC_PART_CHUNK            mmioFOURCC('p','r','t','h')
  122. #define DMUS_FOURCC_NOTE_CHUNK            mmioFOURCC('n','o','t','e')
  123. #define DMUS_FOURCC_CURVE_CHUNK           mmioFOURCC('c','r','v','e')
  124. #define DMUS_FOURCC_MARKER_CHUNK          mmioFOURCC('m','r','k','r')
  125. #define DMUS_FOURCC_RESOLUTION_CHUNK      mmioFOURCC('r','s','l','n')
  126. #define DMUS_FOURCC_ANTICIPATION_CHUNK    mmioFOURCC('a','n','p','n')
  127. #define DMUS_FOURCC_PATTERN_LIST          mmioFOURCC('p','t','t','n')
  128. #define DMUS_FOURCC_PATTERN_CHUNK         mmioFOURCC('p','t','n','h')
  129. #define DMUS_FOURCC_RHYTHM_CHUNK          mmioFOURCC('r','h','t','m')
  130. #define DMUS_FOURCC_PARTREF_LIST          mmioFOURCC('p','r','e','f')
  131. #define DMUS_FOURCC_PARTREF_CHUNK         mmioFOURCC('p','r','f','c')
  132. #define DMUS_FOURCC_STYLE_PERS_REF_LIST   mmioFOURCC('p','r','r','f')
  133. #define DMUS_FOURCC_MOTIFSETTINGS_CHUNK   mmioFOURCC('m','t','f','s')
  134.  
  135. /* Flags used by variations: these make up the DWORDs in dwVariationChoices.               */
  136.  
  137. /* These flags determine the types of chords supported by a given variation in DirectMusic */
  138. /* mode.  The first seven flags (bits 1-7) are set if the variation supports major chords  */
  139. /* rooted in scale positions, so, e.g., if bits 1, 2, and 4 are set, the variation         */
  140. /* supports major chords rooted in the tonic, second, and fourth scale positions.  The     */
  141. /* next seven flags serve the same purpose, but for minor chords, and the following seven  */
  142. /* flags serve the same purpose for chords that are not major or minor (e.g., SUS 4        */
  143. /* chords).  Bits 22, 23, and 24 are set if the variation supports chords rooted in the    */
  144. /* scale, chords rooted sharp of scale tones, and chords rooted flat of scale tones,       */
  145. /* respectively.  For example, to support a C# minor chord in the scale of C Major,        */
  146. /* bits 8 (for tonic minor) and 24 (for sharp) need to be set.  Bits 25, 26, an 27 handle  */
  147. /* chords that are triads, 6th or 7th chords, and chords with extensions, respectively.    */
  148. /* bits 28 and 29 handle chords that are followed by tonic and dominant chords,            */
  149. /* respectively.                                                                           */
  150. #define DMUS_VARIATIONF_MAJOR        0x0000007F /* Seven positions in the scale - major chords. */    
  151. #define DMUS_VARIATIONF_MINOR        0x00003F80 /* Seven positions in the scale - minor chords. */    
  152. #define DMUS_VARIATIONF_OTHER        0x001FC000 /* Seven positions in the scale - other chords. */    
  153. #define DMUS_VARIATIONF_ROOT_SCALE   0x00200000 /* Handles chord roots in the scale. */         
  154. #define DMUS_VARIATIONF_ROOT_FLAT    0x00400000 /* Handles flat chord roots (based on scale notes). */         
  155. #define DMUS_VARIATIONF_ROOT_SHARP   0x00800000 /* Handles sharp chord roots (based on scale notes). */         
  156. #define DMUS_VARIATIONF_TYPE_TRIAD   0x01000000 /* Handles simple chords - triads. */  
  157. #define DMUS_VARIATIONF_TYPE_6AND7   0x02000000 /* Handles simple chords - 6 and 7. */  
  158. #define DMUS_VARIATIONF_TYPE_COMPLEX 0x04000000 /* Handles complex chords. */  
  159. #define DMUS_VARIATIONF_DEST_TO1     0x08000000 /* Handles transitions to 1 chord. */  
  160. #define DMUS_VARIATIONF_DEST_TO5     0x10000000 /* Handles transitions to 5 chord. */  
  161. #define DMUS_VARIATIONF_DEST_OTHER   0x40000000 /* Handles transitions to chords other than 1 . */  
  162.  
  163. /* legacy mask for variation modes */
  164. #define DMUS_VARIATIONF_MODES        0xE0000000
  165. /* Bits 29 and 31 of the variation flags are the Mode bits.  If both are 0, it's IMA. */  
  166. /* If bit 29 is 1, it's Direct Music. */
  167. #define DMUS_VARIATIONF_MODES_EX     (0x20000000 | 0x80000000)
  168. #define DMUS_VARIATIONF_IMA25_MODE   0x00000000
  169. #define DMUS_VARIATIONF_DMUS_MODE    0x20000000
  170.  
  171. /* Set this if the part uses marker events */
  172. #define DMUS_PARTF_USE_MARKERS       0x1
  173. /* Set this if the part is allowed to switch only on chord-aligned markers */
  174. #define DMUS_PARTF_ALIGN_CHORDS      0x2
  175.  
  176. /* These specify if the marker event signals whether to stop a variation or start a 
  177. pattern/variation (or both), and whether new variations must align with a chord */
  178. #define DMUS_MARKERF_START            0x1
  179. #define DMUS_MARKERF_STOP             0x2
  180. #define DMUS_MARKERF_CHORD_ALIGN      0x4
  181.  
  182. /* if this flag is set, variation settings in a playing pattern-based track's state data will 
  183. persist in the track after it stops playing */
  184. #define DMUS_PATTERNF_PERSIST_CONTROL 0x1
  185.  
  186. /* These specify possible values for DMUS_IO_PARTREF.bRandomVariation
  187.    all but DMUS_VARIATIONT_SEQUENTIAL and DMUS_VARIATIONT_RANDOM are dx8. */
  188. typedef enum enumDMUS_VARIATIONT_TYPES
  189. {
  190.     DMUS_VARIATIONT_SEQUENTIAL       = 0, /* Play sequential starting with variation 1. */
  191.     DMUS_VARIATIONT_RANDOM           = 1, /* Play randomly. */
  192.     DMUS_VARIATIONT_RANDOM_START     = 2, /* Play sequential starting with a random variation. */
  193.     DMUS_VARIATIONT_NO_REPEAT        = 3, /* Play randomly, but don't play the same variation twice. */
  194.     DMUS_VARIATIONT_RANDOM_ROW       = 4  /* Play randomly as a row: don't repeat any variation until all have played. */
  195. } DMUS_VARIATIONT_TYPES;
  196.  
  197. /* These specify possible values for DMUS_IO_PATTERN.wEmbellishment (dx8) */
  198. typedef enum enumDMUS_EMBELLISHT_TYPES
  199. {
  200.     DMUS_EMBELLISHT_NORMAL          = 0,
  201.     DMUS_EMBELLISHT_FILL            = 1,
  202.     DMUS_EMBELLISHT_BREAK           = 2,
  203.     DMUS_EMBELLISHT_INTRO           = 4,
  204.     DMUS_EMBELLISHT_END             = 8,
  205.     DMUS_EMBELLISHT_MOTIF           = 16,
  206.     DMUS_EMBELLISHT_ALL             = 0xFFFF
  207. } DMUS_EMBELLISHT_TYPES;
  208.  
  209. #pragma pack(2)
  210.  
  211. typedef struct _DMUS_IO_TIMESIG
  212. {
  213.     /* Time signatures define how many beats per measure, which note receives */
  214.     /* the beat, and the grid resolution. */
  215.     BYTE    bBeatsPerMeasure;   /* beats per measure (top of time sig) */
  216.     BYTE    bBeat;              /* what note receives the beat (bottom of time sig.) */
  217.                                 /* we can assume that 0 means 256th note */
  218.     WORD    wGridsPerBeat;      /* grids per beat */
  219. } DMUS_IO_TIMESIG;
  220.  
  221. typedef struct _DMUS_IO_STYLE
  222. {
  223.     DMUS_IO_TIMESIG     timeSig;        /* Styles have a default Time Signature */
  224.     double              dblTempo;   
  225. } DMUS_IO_STYLE;
  226.  
  227. typedef struct _DMUS_IO_VERSION
  228. {
  229.     DWORD               dwVersionMS;        /* Version # high-order 32 bits */
  230.     DWORD               dwVersionLS;        /* Version # low-order 32 bits  */
  231. } DMUS_IO_VERSION;
  232.  
  233. typedef struct _DMUS_IO_PATTERN
  234. {
  235.     DMUS_IO_TIMESIG     timeSig;           /* Patterns can override the Style's Time sig. */
  236.     BYTE                bGrooveBottom;     /* bottom of groove range */
  237.     BYTE                bGrooveTop;        /* top of groove range */
  238.     WORD                wEmbellishment;    /* Fill, Break, Intro, End, Normal, Motif */
  239.     WORD                wNbrMeasures;      /* length in measures */
  240.     BYTE                bDestGrooveBottom; /* bottom of groove range for next pattern */
  241.     BYTE                bDestGrooveTop;    /* top of groove range for next pattern */
  242.     DWORD               dwFlags;           /* various flags */
  243. } DMUS_IO_PATTERN;
  244.  
  245. typedef struct _DMUS_IO_STYLEPART
  246. {
  247.     DMUS_IO_TIMESIG     timeSig;        /* can override pattern's */
  248.     DWORD               dwVariationChoices[32]; /* MOAW choice bitfield */
  249.     GUID                guidPartID;     /* identifies the part */
  250.     WORD                wNbrMeasures;   /* length of the Part */
  251.     BYTE                bPlayModeFlags; /* see PLAYMODE flags */
  252.     BYTE                bInvertUpper;   /* inversion upper limit */
  253.     BYTE                bInvertLower;   /* inversion lower limit */
  254.     BYTE                bPad[3];        /* for DWORD alignment */
  255.     DWORD               dwFlags;        /* various flags */ 
  256. } DMUS_IO_STYLEPART;
  257.  
  258. typedef struct _DMUS_IO_PARTREF
  259. {
  260.     GUID    guidPartID;         /* unique ID for matching up with parts */
  261.     WORD    wLogicalPartID;     /* corresponds to port/device/midi channel OBSOLETE */
  262.     BYTE    bVariationLockID;   /* parts with the same ID lock variations. */
  263.                                 /* high bit is used to identify master Part */
  264.     BYTE    bSubChordLevel;     /* tells which sub chord level this part wants */
  265.     BYTE    bPriority;          /* 256 priority levels. Parts with lower priority */
  266.                                 /* aren't played first when a device runs out of */
  267.                                 /* notes */
  268.     BYTE    bRandomVariation;   /* when set, matching variations play in random order */
  269.                                 /* when clear, matching variations play sequentially */
  270.     WORD    wPad;               /* not used */
  271.     DWORD   dwPChannel;         /* replaces wLogicalPartID */
  272. } DMUS_IO_PARTREF;
  273.  
  274. typedef struct _DMUS_IO_STYLENOTE
  275. {
  276.     MUSIC_TIME  mtGridStart;    /* when this note occurs */
  277.     DWORD       dwVariation;    /* variation bits */
  278.     MUSIC_TIME  mtDuration;     /* how long this note lasts */
  279.     short       nTimeOffset;    /* offset from mtGridStart */
  280.     WORD        wMusicValue;    /* Position in scale. */
  281.     BYTE        bVelocity;      /* Note velocity. */
  282.     BYTE        bTimeRange;     /* Range to randomize start time. */
  283.     BYTE        bDurRange;      /* Range to randomize duration. */
  284.     BYTE        bVelRange;      /* Range to randomize velocity. */
  285.     BYTE        bInversionID;   /* Identifies inversion group to which this note belongs */
  286.     BYTE        bPlayModeFlags; /* Can override part */
  287.     /* Following exists only under DX8 and on */
  288.     BYTE        bNoteFlags;     /* values from DMUS_NOTEF_FLAGS */
  289. } DMUS_IO_STYLENOTE;
  290.  
  291. typedef struct _DMUS_IO_STYLECURVE
  292. {
  293.     MUSIC_TIME  mtGridStart;    /* when this curve occurs */
  294.     DWORD       dwVariation;    /* variation bits */
  295.     MUSIC_TIME  mtDuration;     /* how long this curve lasts */
  296.     MUSIC_TIME  mtResetDuration;/* how long after the end of the curve to reset the curve */
  297.     short       nTimeOffset;    /* offset from mtGridStart */
  298.     short       nStartValue;    /* curve's start value */
  299.     short       nEndValue;      /* curve's end value */
  300.     short       nResetValue;    /* the value to which to reset the curve */
  301.     BYTE        bEventType;     /* type of curve */
  302.     BYTE        bCurveShape;    /* shape of curve */
  303.     BYTE        bCCData;        /* CC# */
  304.     BYTE        bFlags;         /* Bit 1=TRUE means to send nResetValue. Otherwise, don't.
  305.                                    Other bits are reserved. */
  306.     /*  Following was added for DX8. */
  307.     WORD        wParamType;      /* RPN or NRPN parameter number. */
  308.     WORD        wMergeIndex;     /* Allows multiple parameters to be merged (pitchbend, volume, and expression.) */
  309. } DMUS_IO_STYLECURVE;
  310.  
  311. typedef struct _DMUS_IO_STYLEMARKER
  312. {
  313.     MUSIC_TIME  mtGridStart;    /* when this marker occurs */
  314.     DWORD       dwVariation;    /* variation bits */
  315.     WORD        wMarkerFlags;   /* how the marker is used */
  316. } DMUS_IO_STYLEMARKER;
  317.  
  318. typedef struct _DMUS_IO_STYLERESOLUTION
  319. {
  320.     DWORD    dwVariation;       /* variation bits */
  321.     WORD     wMusicValue;       /* Position in scale. */
  322.     BYTE     bInversionID;      /* Identifies inversion group to which this note belongs */
  323.     BYTE     bPlayModeFlags;    /* Can override part */
  324. } DMUS_IO_STYLERESOLUTION;
  325.  
  326. typedef struct _DMUS_IO_STYLE_ANTICIPATION
  327. {
  328.     MUSIC_TIME    mtGridStart;   /* when this anticipation occurs */
  329.     DWORD         dwVariation;   /* variation bits */
  330.     short         nTimeOffset;   /* offset from mtGridStart */
  331.     BYTE          bTimeRange;    /* Range to randomize start time. */
  332. } DMUS_IO_STYLE_ANTICIPATION;
  333.  
  334. typedef struct _DMUS_IO_MOTIFSETTINGS
  335. {
  336.     DWORD       dwRepeats;      /* Number of repeats. By default, 0. */
  337.     MUSIC_TIME  mtPlayStart;    /* Start of playback. By default, 0. */
  338.     MUSIC_TIME  mtLoopStart;    /* Start of looping portion. By default, 0. */
  339.     MUSIC_TIME  mtLoopEnd;      /* End of loop. Must be greater than mtLoopStart. Or, 0, indicating loop full motif.  */
  340.     DWORD       dwResolution;   /* Default resolution. */
  341. } DMUS_IO_MOTIFSETTINGS;
  342.  
  343. #pragma pack()
  344.  
  345.  
  346. /*
  347. RIFF
  348. (
  349.     'DMST'          // Style
  350.     <styh-ck>       // Style header chunk
  351.     <guid-ck>       // Every Style has a GUID
  352.     [<UNFO-list>]   // Name, author, copyright info., comments
  353.     [<vers-ck>]     // version chunk
  354.     <part-list>...  // Array of parts in the Style, used by patterns
  355.     <pttn-list>...  // Array of patterns in the Style
  356.     <DMBD-form>...  // Array of bands in the Style
  357.     [<prrf-list>]...// Optional array of chord map references in the Style
  358. )
  359.  
  360.     // <styh-ck>
  361.     styh
  362.     (
  363.         <DMUS_IO_STYLE>
  364.     )
  365.  
  366.     // <guid-ck>
  367.     guid
  368.     (
  369.         <GUID>
  370.     )
  371.  
  372.     // <vers-ck>
  373.     vers
  374.     (
  375.         <DMUS_IO_VERSION>
  376.     )
  377.  
  378.     // <part-list>
  379.     LIST
  380.     (
  381.         'part'
  382.         <prth-ck>       // Part header chunk
  383.         [<UNFO-list>]   // Name, author, copyright info., comments
  384.         [<note-ck>]     // Optional chunk containing an array of notes in Part
  385.         [<crve-ck>]     // Optional chunk containing an array of curves in Part
  386.         [<mrkr-ck>]     // Optional chunk containing an array of markers in Part
  387.         [<rsln-ck>]     // Optional chunk containing an array of variation resolutions in Part
  388.         [<anpn-ck>]     // Optional chunk containing an array of resolution anticipations in Part
  389.     )
  390.  
  391.         // <orth-ck>
  392.         prth
  393.         (
  394.             <DMUS_IO_STYLEPART>
  395.         )
  396.  
  397.         // <note-ck>
  398.         'note'
  399.         (
  400.             // sizeof DMUS_IO_STYLENOTE:DWORD
  401.             <DMUS_IO_STYLENOTE>...
  402.         )
  403.  
  404.         // <crve-ck>
  405.         'crve'
  406.         (
  407.             // sizeof DMUS_IO_STYLECURVE:DWORD
  408.             <DMUS_IO_STYLECURVE>...
  409.         )
  410.  
  411.         // <mrkr-ck>
  412.         'mrkr'
  413.         (
  414.             // sizeof DMUS_IO_STYLEMARKER:DWORD
  415.             <DMUS_IO_STYLEMARKER>...
  416.         )
  417.  
  418.         // <rsln-ck>
  419.         'rsln'
  420.         (
  421.             // sizeof DMUS_IO_STYLERESOLUTION:DWORD
  422.             <DMUS_IO_STYLERESOLUTION>...
  423.         )
  424.  
  425.         // <anpn-ck>
  426.         'anpn'
  427.         (
  428.             // sizeof DMUS_IO_STYLE_ANTICIPATION:DWORD
  429.             <DMUS_IO_STYLE_ANTICIPATION>...
  430.         )
  431.  
  432.     // <pttn-list>
  433.     LIST
  434.     (
  435.         'pttn'
  436.         <ptnh-ck>       // Pattern header chunk
  437.         <rhtm-ck>       // Chunk containing an array of rhythms for chord matching
  438.         [<UNFO-list>]   // Name, author, copyright info., comments
  439.         [<mtfs-ck>]     // Motif settings chunk
  440.         [<DMBD-form>]   // Optional band to be associated with the pattern (for motifs)
  441.         <pref-list>...  // Array of part reference id's
  442.     )
  443.  
  444.         // <ptnh-ck>
  445.         ptnh
  446.         (
  447.             <DMUS_IO_PATTERN>
  448.         )
  449.  
  450.         // <rhtm-ck>
  451.         'rhtm'
  452.         (
  453.             // DWORD's representing rhythms for chord matching based on number
  454.             // of measures in the pattern
  455.         )
  456.  
  457.  
  458.         // pref-list
  459.         LIST
  460.         (
  461.             'pref'
  462.             <prfc-ck>   // part ref chunk
  463.         )
  464.  
  465.         // <prfc-ck>
  466.         prfc
  467.         (
  468.             <DMUS_IO_PARTREF>
  469.         )
  470.  
  471.         // <mtfs-ck>
  472.         mtfs
  473.         (
  474.             <DMUS_IO_MOTIFSETTINGS>
  475.         )
  476.  
  477.     // <prrf-list>
  478.     LIST
  479.     (
  480.         'prrf'
  481.         <DMRF-list>... // Array of Chordmap references
  482.     )
  483. */
  484.  
  485. /* Pattern chunk, for use in Pattern tracks */
  486.  
  487. #define DMUS_FOURCC_PATTERN_FORM        mmioFOURCC('D','M','P','T')
  488.  
  489. /*
  490. RIFF
  491. (
  492.     'DMPT'          // Pattern
  493.     <styh-ck>       // Style header chunk
  494.     <pttn-list>     // The pattern, in single pattern format (includes DMUS_FOURCC_PART_LIST chunks)
  495. )
  496. */
  497.  
  498.  
  499. /* Chord and command file formats */
  500.  
  501. /* These specify possible values for DMUS_IO_COMMAND.bRepeatMode (dx8) */
  502. typedef enum enumDMUS_PATTERNT_TYPES
  503. {
  504.     DMUS_PATTERNT_RANDOM           = 0, /* Play randomly. (dx7 behavior) */
  505.     DMUS_PATTERNT_REPEAT           = 1, /* Repeat last pattern. */
  506.     DMUS_PATTERNT_SEQUENTIAL       = 2, /* Play sequential starting with first matching pattern. */
  507.     DMUS_PATTERNT_RANDOM_START     = 3, /* Play sequential starting with a random pattern. */
  508.     DMUS_PATTERNT_NO_REPEAT        = 4, /* Play randomly, but don't play the same pattern twice. */
  509.     DMUS_PATTERNT_RANDOM_ROW       = 5  /* Play randomly as a row: don't repeat any pattern until all have played. */
  510. } DMUS_PATTERNT_TYPES;
  511.  
  512.  
  513. #define DMUS_FOURCC_CHORDTRACK_LIST         mmioFOURCC('c','o','r','d')
  514. #define DMUS_FOURCC_CHORDTRACKHEADER_CHUNK  mmioFOURCC('c','r','d','h')
  515. #define DMUS_FOURCC_CHORDTRACKBODY_CHUNK    mmioFOURCC('c','r','d','b')
  516.  
  517. #define DMUS_FOURCC_COMMANDTRACK_CHUNK      mmioFOURCC('c','m','n','d')
  518.  
  519. typedef struct _DMUS_IO_CHORD
  520. {
  521.     WCHAR       wszName[16];    /* Name of the chord */
  522.     MUSIC_TIME  mtTime;         /* Time of this chord */
  523.     WORD        wMeasure;       /* Measure this falls on */
  524.     BYTE        bBeat;          /* Beat this falls on */
  525.     BYTE        bFlags;         /* Various flags */
  526. } DMUS_IO_CHORD;
  527.  
  528. typedef struct _DMUS_IO_SUBCHORD
  529. {
  530.     DWORD   dwChordPattern;     /* Notes in the subchord */
  531.     DWORD   dwScalePattern;     /* Notes in the scale */
  532.     DWORD   dwInversionPoints;  /* Where inversions can occur */
  533.     DWORD   dwLevels;           /* Which levels are supported by this subchord */
  534.     BYTE    bChordRoot;         /* Root of the subchord */
  535.     BYTE    bScaleRoot;         /* Root of the scale */
  536. } DMUS_IO_SUBCHORD;
  537.  
  538. typedef struct _DMUS_IO_COMMAND
  539. {
  540.     MUSIC_TIME  mtTime;         /* Time of this command */
  541.     WORD        wMeasure;       /* Measure this falls on */
  542.     BYTE        bBeat;          /* Beat this falls on */
  543.     BYTE        bCommand;       /* Command type (see #defines below) */
  544.     BYTE        bGrooveLevel;   /* Groove level (0 if command is not a groove) */
  545.     BYTE        bGrooveRange;   /* Groove range  */
  546.     BYTE        bRepeatMode;    /* Used to control selection of patterns with same groove level  */
  547. } DMUS_IO_COMMAND;
  548.  
  549.  
  550. /*
  551.  
  552.     // <cord-list>
  553.     LIST
  554.     (
  555.         'cord'
  556.         <crdh-ck>
  557.         <crdb-ck>...    // Chord body chunks
  558.     )
  559.  
  560.         // <crdh-ck>
  561.         crdh
  562.         (
  563.             // Scale: dword (upper 8 bits for root, lower 24 for scale)
  564.         )
  565.  
  566.         // <crdb-ck>
  567.         crdb
  568.         (
  569.             // sizeof DMUS_IO_CHORD:dword
  570.             <DMUS_IO_CHORD>
  571.             // # of DMUS_IO_SUBCHORDS:dword
  572.             // sizeof DMUS_IO_SUBCHORDS:dword
  573.             // a number of <DMUS_IO_SUBCHORD>
  574.         )
  575.  
  576.  
  577.     // <cmnd-list>
  578.     'cmnd'
  579.     (
  580.         //sizeof DMUS_IO_COMMAND: DWORD
  581.         <DMUS_IO_COMMAND>...
  582.     )
  583.  
  584. */
  585.  
  586. /*  File io for DirectMusic Tool and ToolGraph objects
  587. */
  588.  
  589. /* RIFF ids: */
  590.  
  591. #define DMUS_FOURCC_TOOLGRAPH_FORM  mmioFOURCC('D','M','T','G')
  592. #define DMUS_FOURCC_TOOL_LIST       mmioFOURCC('t','o','l','l')
  593. #define DMUS_FOURCC_TOOL_FORM       mmioFOURCC('D','M','T','L')
  594. #define DMUS_FOURCC_TOOL_CHUNK      mmioFOURCC('t','o','l','h')
  595.  
  596. /* io structures: */
  597.  
  598. typedef struct _DMUS_IO_TOOL_HEADER
  599. {
  600.     GUID        guidClassID;    /* Class id of tool. */
  601.     long        lIndex;         /* Position in graph. */
  602.     DWORD       cPChannels;     /* Number of items in channels array. */
  603.     FOURCC      ckid;           /* chunk ID of tool's data chunk if 0 fccType valid. */
  604.     FOURCC      fccType;        /* list type if NULL ckid valid. */
  605.     DWORD       dwPChannels[1]; /* Array of PChannels, size determined by cPChannels. */
  606. } DMUS_IO_TOOL_HEADER;
  607.  
  608. /*
  609. RIFF
  610. (
  611.     'DMTG'          // DirectMusic ToolGraph chunk
  612.     [<guid-ck>]     // GUID for ToolGraph
  613.     [<vers-ck>]     // Optional version info
  614.     [<UNFO-list>]   // Name, author, copyright info., comments
  615.     <toll-list>     // List of Tools
  616. )
  617.  
  618.     // <guid-ck>
  619.     'guid'
  620.     (
  621.         <GUID>
  622.     )
  623.  
  624.     // <vers-ck>
  625.     vers
  626.     (
  627.         <DMUS_IO_VERSION>
  628.     )
  629.  
  630.     // <toll-list>
  631.     LIST
  632.     (
  633.         'toll'          // Array of tools
  634.         <DMTL-form>...  // Each tool is encapsulated in a RIFF chunk
  635.     )
  636.  
  637. // <DMTL-form>      Tools are embedded in a graph. Theoretically, they can be saved as individual files too.
  638. RIFF
  639. (
  640.     'DMTL'
  641.     <tolh-ck>
  642.     [<data>]        // Tool data. Must be a RIFF readable chunk.
  643. )
  644.  
  645.     // <tolh-ck>            // Tool header chunk
  646.     (
  647.         'tolh'
  648.         <DMUS_IO_TOOL_HEADER>   // Tool header
  649.     )
  650. */
  651.  
  652. /*  The AudioPath file carries everything for describing a specific audio path,
  653.     including Tool Graph and Buffer Descriptor.
  654.     This can even be used for configuring a complete performance.
  655. */
  656.  
  657. #define DMUS_FOURCC_AUDIOPATH_FORM  mmioFOURCC('D','M','A','P')
  658.  
  659. /*
  660. RIFF
  661. (
  662.     'DMAP'          // DirectMusic AudioPath chunk
  663.     [<guid-ck>]     // GUID for this Audio Path configuration
  664.     [<vers-ck>]     // Optional version info
  665.     [<UNFO-list>]   // Name, author, copyright info., comments
  666.     [<DMTG-form>]   // Optional ToolGraph
  667.     [<pcsl-list>]   // Optional list of port configurations
  668.     [<dbfl-list>]...// Optional array of Dsound buffer descriptors
  669. )
  670. */
  671.  
  672. #define DMUS_FOURCC_PORTCONFIGS_LIST    mmioFOURCC('p','c','s','l')
  673. #define DMUS_FOURCC_PORTCONFIG_LIST     mmioFOURCC('p','c','f','l')
  674. #define DMUS_FOURCC_PORTCONFIG_ITEM     mmioFOURCC('p','c','f','h')
  675. #define DMUS_FOURCC_PORTPARAMS_ITEM     mmioFOURCC('p','p','r','h')
  676. #define DMUS_FOURCC_DSBUFFER_LIST       mmioFOURCC('d','b','f','l')
  677. #define DMUS_FOURCC_DSBUFFATTR_ITEM     mmioFOURCC('d','d','a','h')
  678. #define DMUS_FOURCC_PCHANNELS_LIST      mmioFOURCC('p','c','h','l')
  679. #define DMUS_FOURCC_PCHANNELS_ITEM      mmioFOURCC('p','c','h','h')
  680.  
  681. typedef struct _DMUS_IO_PORTCONFIG_HEADER
  682. {
  683.     GUID    guidPort;           /* GUID of requested port. */
  684.     DWORD   dwPChannelBase;     /* PChannel that this should start on. */
  685.     DWORD   dwPChannelCount;    /* How many channels. */
  686.     DWORD   dwFlags;            /* Various flags. */
  687. } DMUS_IO_PORTCONFIG_HEADER;
  688.  
  689. #define DMUS_PORTCONFIGF_DRUMSON10  1   /* This port configured for drums on channel 10. */
  690. #define DMUS_PORTCONFIGF_USEDEFAULT 2   /* Use the default port. */
  691.  
  692. /* Each portconfig has one or more pchannel to buffer mappings. Each buffer
  693.    is identified by a guid. Each pchannel can map to one or more buffers.
  694.    This is defined with one or more DMUS_IO_PCHANNELTOBUFFER_HEADER
  695.    structures. Each defines a range of PChannels and the set of buffers
  696.    that they connect to. 
  697. */
  698.  
  699. typedef struct _DMUS_IO_PCHANNELTOBUFFER_HEADER
  700. {
  701.     DWORD   dwPChannelBase;     /* PChannel that this should start on. */
  702.     DWORD   dwPChannelCount;    /* How many PChannels. */
  703.     DWORD   dwBufferCount;      /* How many buffers do these connect to. */
  704.     DWORD   dwFlags;            /* Various flags. Currently reserved for future use. Must be 0. */
  705. } DMUS_IO_PCHANNELTOBUFFER_HEADER;
  706.  
  707. /* Each buffer is represented by an DSBC form. This is wrapped by the 
  708.    DMUS_IO_BUFFER_ATTRIBUTES_HEADER which identifies how to use the
  709.    buffer. In particular, it indicates whether this gets dynamically duplicated
  710.    or all references to this should share the same instance. 
  711.    To resolve references, the unique GUID of the buffer is also stored
  712.    in this structure. 
  713. */
  714.    
  715. typedef struct _DMUS_IO_BUFFER_ATTRIBUTES_HEADER
  716. {
  717.     GUID    guidBufferID;       /* Each buffer config has a unique ID. */
  718.     DWORD   dwFlags;            /* Various flags. */
  719. } DMUS_IO_BUFFER_ATTRIBUTES_HEADER;
  720.  
  721. /* DMUS_IO_BUFFER_ATTRIBUTES_HEADER.dwFlags: */
  722. #define DMUS_BUFFERF_SHARED     1   /* Share this with other audio paths, instead of creating unique copies. */
  723. #define DMUS_BUFFERF_DEFINED    2   /* Use one of the standard predefined buffers (see GUID_Buffer... in dmusici.h.) */
  724. #define DMUS_BUFFERF_MIXIN      8   /* This is a mixin buffer. */
  725.  
  726. /*
  727.  
  728. LIST
  729. (
  730.     'pcsl'          // Array of port configurations
  731.     <pcfl-list>...  // One or more port configurations, each in a list chunk
  732. )
  733.  
  734. LIST
  735. (
  736.     'pcfl'          // List container for one port configuration.
  737.     <pcfh-ck>       // Portconfig header chunk.
  738.     <pprh-ck>       // Port params, to be used to create the port.
  739.     [<dbfl-list>]...// Optional array of Dsound buffer descriptors
  740.     [<pchl-list>]   // Optional list of pchannel to buffer assignments
  741.  
  742. )
  743.  
  744.     // <pcfh-ck>            // Port config header chunk
  745.     (
  746.         'pcfh'
  747.         <DMUS_IO_PORTCONFIG_HEADER>   // Port config header
  748.     )
  749.  
  750.     // <pprh-ck>            // Port params header chunk
  751.     (
  752.         'pprh'
  753.         <DMUS_PORTPARAMS8>   // Port params header
  754.     )
  755.  
  756. LIST
  757. (
  758.     'pchl'          // List container for one or more pchannel to buffer assignments.
  759.     <pchh-ck>...    // One or more pchannel to buffer assignment headers and data.
  760.  
  761.     // <pchh-ck>
  762.     (
  763.         'pchh'
  764.         <DMUS_IO_PCHANNELTOBUFFER_HEADER>   // Description of PChannels
  765.         <GUID>...                           // Array of GUIDs defining the buffers they all connect to.
  766.     )
  767. )
  768.  
  769. LIST
  770. (
  771.     'dbfl'          // List container for one buffer and buffer attributes header.
  772.     <ddah-ck>       // Buffer attributes header. 
  773.     [<DSBC-form>]   // Buffer configuration. Not required when header uses a predefined buffer type.
  774.  
  775.     // <ddah-ck>
  776.     (
  777.         'ddah'
  778.         <DMUS_IO_BUFFER_ATTRIBUTES_HEADER>   // Buffer attributes.
  779.     )
  780. )
  781. */
  782.  
  783. /*  File io for DirectMusic Band Track object */
  784.  
  785.  
  786. /* RIFF ids: */
  787. #define DMUS_FOURCC_BANDTRACK_FORM  mmioFOURCC('D','M','B','T')
  788. #define DMUS_FOURCC_BANDTRACK_CHUNK mmioFOURCC('b','d','t','h')
  789. #define DMUS_FOURCC_BANDS_LIST      mmioFOURCC('l','b','d','l')
  790. #define DMUS_FOURCC_BAND_LIST       mmioFOURCC('l','b','n','d')
  791. #define DMUS_FOURCC_BANDITEM_CHUNK  mmioFOURCC('b','d','i','h')
  792. #define DMUS_FOURCC_BANDITEM_CHUNK2 mmioFOURCC('b','d','2','h')
  793.  
  794. /* io structures */
  795. typedef struct _DMUS_IO_BAND_TRACK_HEADER
  796. {
  797.     BOOL bAutoDownload;     /* Determines if Auto-Download is enabled. */
  798. } DMUS_IO_BAND_TRACK_HEADER;
  799.  
  800. typedef struct _DMUS_IO_BAND_ITEM_HEADER
  801. {
  802.     MUSIC_TIME lBandTime;   /* Position in track list. */
  803. } DMUS_IO_BAND_ITEM_HEADER;
  804.  
  805. typedef struct _DMUS_IO_BAND_ITEM_HEADER2
  806. {
  807.     MUSIC_TIME lBandTimeLogical;   /* Position in track list. Time in the music with which band change is associated. */
  808.     MUSIC_TIME lBandTimePhysical;  /* Precise time band change will take effect. Should be close to logical time. */
  809. } DMUS_IO_BAND_ITEM_HEADER2;
  810.  
  811. /*
  812. RIFF
  813. (
  814.     'DMBT'          // DirectMusic Band Track form-type
  815.     [<bdth-ck>]     // Band track header
  816.     [<guid-ck>]     // GUID for band track
  817.     [<vers-ck>]     // Optional version info
  818.     [<UNFO-list>]   // Name, author, copyright info., comments
  819.     <lbdl-list>     // List of Band items
  820. )
  821.  
  822.     // <bnth-ck>
  823.     'bdth'
  824.     (
  825.         <DMUS_IO_BAND_TRACK_HEADER>
  826.     )
  827.  
  828.     // <guid-ck>
  829.     'guid'
  830.     (
  831.         <GUID>
  832.     )
  833.  
  834.     // <vers-ck>
  835.     vers
  836.     (
  837.         <DMUS_IO_VERSION>
  838.     )
  839.  
  840.     // <lbdl-list>
  841.     LIST
  842.     (
  843.         'lbdl'
  844.         <lbnd-list>...  // Array of bands, each encapsulated in a list chunk
  845.     )
  846.  
  847.         // <lbnd-list>
  848.         LIST
  849.         (
  850.             'lbnd'
  851.             <bdih-ck> or <bd2h-ck>  // bdih is a legacy format.  bd2h is preferred for new content.
  852.             <DMBD-form> // Band
  853.         )
  854.  
  855.             // <bdih-ck> or <bd2h-ck>       // band item header
  856.             (
  857.                 <DMUS_IO_BAND_ITEM_HEADER> or <DMUS_IO_BAND_ITEM_HEADER2> // Band item header
  858.             )
  859. */      
  860.  
  861.  
  862. /*  File io for DirectMusic Band object
  863. */
  864.  
  865. /* RIFF ids: */
  866.  
  867. #define DMUS_FOURCC_BAND_FORM           mmioFOURCC('D','M','B','D')
  868. #define DMUS_FOURCC_INSTRUMENTS_LIST    mmioFOURCC('l','b','i','l')
  869. #define DMUS_FOURCC_INSTRUMENT_LIST     mmioFOURCC('l','b','i','n')
  870. #define DMUS_FOURCC_INSTRUMENT_CHUNK    mmioFOURCC('b','i','n','s')
  871.  
  872. /* Flags for DMUS_IO_INSTRUMENT
  873.  */
  874. #define DMUS_IO_INST_PATCH          (1 << 0)        /* dwPatch is valid. */
  875. #define DMUS_IO_INST_BANKSELECT     (1 << 1)        /* dwPatch contains a valid Bank Select MSB and LSB part */
  876. #define DMUS_IO_INST_ASSIGN_PATCH   (1 << 3)        /* dwAssignPatch is valid */
  877. #define DMUS_IO_INST_NOTERANGES     (1 << 4)        /* dwNoteRanges is valid */
  878. #define DMUS_IO_INST_PAN            (1 << 5)        /* bPan is valid */
  879. #define DMUS_IO_INST_VOLUME         (1 << 6 )       /* bVolume is valid */
  880. #define DMUS_IO_INST_TRANSPOSE      (1 << 7)        /* nTranspose is valid */
  881. #define DMUS_IO_INST_GM             (1 << 8)        /* Instrument is from GM collection */
  882. #define DMUS_IO_INST_GS             (1 << 9)        /* Instrument is from GS collection */
  883. #define DMUS_IO_INST_XG             (1 << 10)       /* Instrument is from XG collection */
  884. #define DMUS_IO_INST_CHANNEL_PRIORITY (1 << 11)     /* dwChannelPriority is valid */
  885. #define DMUS_IO_INST_USE_DEFAULT_GM_SET (1 << 12)   /* Always use the default GM set for this patch,  */
  886.                                                     /* don't rely on the synth caps stating GM or GS in hardware. */
  887. #define DMUS_IO_INST_PITCHBENDRANGE (1 << 13)     /* nPitchBendRange is valid */
  888.  
  889. /* io structures */
  890. typedef struct _DMUS_IO_INSTRUMENT
  891. {
  892.     DWORD   dwPatch;            /* MSB, LSB and Program change to define instrument */
  893.     DWORD   dwAssignPatch;      /* MSB, LSB and Program change to assign to instrument when downloading */
  894.     DWORD   dwNoteRanges[4];    /* 128 bits; one for each MIDI note instrument needs to able to play */
  895.     DWORD   dwPChannel;         /* PChannel instrument plays on */
  896.     DWORD   dwFlags;            /* DMUS_IO_INST_ flags */
  897.     BYTE    bPan;               /* Pan for instrument */
  898.     BYTE    bVolume;            /* Volume for instrument */
  899.     short   nTranspose;         /* Number of semitones to transpose notes */
  900.     DWORD   dwChannelPriority;  /* Channel priority */
  901.     short   nPitchBendRange;    /* Number of semitones shifted by pitch bend */
  902. } DMUS_IO_INSTRUMENT;
  903.  
  904. /*
  905. // <DMBD-form> bands can be embedded in other forms
  906. RIFF
  907. (
  908.     'DMBD'          // DirectMusic Band chunk
  909.     [<guid-ck>]     // GUID for band
  910.     [<vers-ck>]     // Optional version info
  911.     [<UNFO-list>]   // Name, author, copyright info., comments
  912.     <lbil-list>     // List of Instruments
  913. )
  914.  
  915.     // <guid-ck>
  916.     'guid'
  917.     (
  918.         <GUID>
  919.     )
  920.  
  921.     // <vers-ck>
  922.     vers
  923.     (
  924.         <DMUS_IO_VERSION>
  925.     )
  926.  
  927.     // <lbil-list>
  928.     LIST
  929.     (
  930.         'lbil'          // Array of instruments
  931.         <lbin-list>...  // Each instrument is encapsulated in a list
  932.     )
  933.  
  934.         // <lbin-list>
  935.         LIST
  936.         (
  937.             'lbin'
  938.             <bins-ck>
  939.             [<DMRF-list>]       // Optional reference to DLS Collection file.
  940.         )
  941.  
  942.             // <bins-ck>            // Instrument chunk
  943.             (
  944.                 'bins'
  945.                 <DMUS_IO_INSTRUMENT>    // Instrument header
  946.             )
  947. */      
  948.  
  949. /* This RIFF id and io struct have been added to allow wave files (and the wave object) to 
  950.    differentiate between streaming and one-shot waves, and to give a prefetch for streaming
  951.    waves  */
  952.  
  953. #define DMUS_FOURCC_WAVEHEADER_CHUNK   mmioFOURCC('w','a','v','h')
  954.  
  955. typedef struct _DMUS_IO_WAVE_HEADER
  956. {
  957.     REFERENCE_TIME  rtReadAhead;    /* How far ahead in the stream wave data will be read (in REFERENCE_TIME).  Ignored for one-shot waves.  */
  958.     DWORD           dwFlags;        /* Various flags, including whether this is a streaming wave and whether it can be invalidated. */
  959. } DMUS_IO_WAVE_HEADER;
  960.  
  961.  
  962. /*  File io for Wave track */
  963.  
  964. /* RIFF ids: */
  965.  
  966. #define DMUS_FOURCC_WAVETRACK_LIST      mmioFOURCC('w','a','v','t')
  967. #define DMUS_FOURCC_WAVETRACK_CHUNK     mmioFOURCC('w','a','t','h')
  968. #define DMUS_FOURCC_WAVEPART_LIST       mmioFOURCC('w','a','v','p')
  969. #define DMUS_FOURCC_WAVEPART_CHUNK      mmioFOURCC('w','a','p','h')
  970. #define DMUS_FOURCC_WAVEITEM_LIST       mmioFOURCC('w','a','v','i')
  971. #define DMUS_FOURCC_WAVE_LIST           mmioFOURCC('w','a','v','e')
  972. #define DMUS_FOURCC_WAVEITEM_CHUNK      mmioFOURCC('w','a','i','h')
  973.  
  974. /* This flag is included in DMUS_IO_WAVE_TRACK_HEADER.dwFlags.  If set, the track will get its 
  975.    variations from a pattern track, via GetParam(GUID_Variations). */
  976. #define DMUS_WAVETRACKF_SYNC_VAR   0x1
  977. /* This is also included in DMUS_IO_WAVE_TRACK_HEADER.dwFlags.  If set, variation control 
  978.    information will persist from one playback instance to the next.*/
  979. #define DMUS_WAVETRACKF_PERSIST_CONTROL 0x2
  980.  
  981. typedef struct _DMUS_IO_WAVE_TRACK_HEADER
  982. {
  983.     long        lVolume;        /* Gain, in 1/100th of dB, to be applied to all waves.  Note:  All gain values should be negative. */
  984.     DWORD       dwFlags;        /* Flags, including whether this track syncs to a pattern track for its variations. */
  985. } DMUS_IO_WAVE_TRACK_HEADER;
  986.  
  987. typedef struct _DMUS_IO_WAVE_PART_HEADER
  988. {
  989.     long            lVolume;        /* Gain, in 1/100th of dB, to be applied to all waves in wave part.  Note:  All gain values should be negative. */
  990.     DWORD           dwVariations;   /* Variation mask for which of 32 variations */
  991.     DWORD           dwPChannel;     /* PChannel */
  992.     DWORD           dwLockToPart;   /* Part ID to lock to. */
  993.     DWORD           dwFlags;        /* Flags, including stuff for managing how variations are chosen (in low-order nibble) */
  994.     DWORD           dwIndex;        /* Index for distinguishing multiple parts on the same PChannel*/
  995. } DMUS_IO_WAVE_PART_HEADER;
  996.  
  997. typedef struct _DMUS_IO_WAVE_ITEM_HEADER
  998. {
  999.     long            lVolume;        /* Gain, in 1/100th of dB.  Note:  All gain values should be negative. */
  1000.     long            lPitch;         /* Pitch offset in 1/100th of a semitone. */
  1001.     DWORD           dwVariations;   /* Variation flags for which of 32 variations this wave belongs to. */
  1002.     REFERENCE_TIME  rtTime;         /* Start time, in REFERENCE_TIME, if clock time track, or MUSIC_TIME for music time track. */
  1003.     REFERENCE_TIME  rtStartOffset;  /* Distance into wave to start playback, in reference time units. */
  1004.     REFERENCE_TIME  rtReserved;     /* Reserved field. */
  1005.     REFERENCE_TIME  rtDuration;     /* Duration, in REFERENCE_TIME or MUSIC_TIME, depending on track timing format. */
  1006.     MUSIC_TIME      mtLogicalTime;  /* If in music track format, this indicates the musical boundary where this belongs. Otherwise, ignored. */
  1007.     DWORD           dwLoopStart;    /* Start point for a looping wave. */
  1008.     DWORD           dwLoopEnd;      /* End point for a looping wave. */
  1009.     DWORD           dwFlags;        /* Various flags, including whether this is a streaming wave and whether it can be invalidated. */
  1010.     WORD            wVolumeRange;   /* Random range for volume. */
  1011.     WORD            wPitchRange;    /* Random range for pitch. */
  1012. } DMUS_IO_WAVE_ITEM_HEADER;
  1013.  
  1014. /*
  1015. LIST
  1016. {
  1017.     'wavt'          // Wave track chunk
  1018.     <wath-ck>       // Wave track header
  1019.     <wavp-list>...  // Array of Wave Parts
  1020. }
  1021.     // <wath-ck>
  1022.     'wath'
  1023.     {
  1024.         <DMUS_IO_WAVE_TRACK_HEADER>
  1025.     }
  1026.  
  1027.     //  <wavp-list>
  1028.     LIST
  1029.     {
  1030.         'wavp'
  1031.         <waph-ck>       //  Wave Part Header
  1032.         <wavi-list>     //  List of wave items
  1033.     }
  1034.  
  1035.         //  <waph-ck>
  1036.         'waph'
  1037.         {
  1038.             <DMUS_IO_WAVE_PART_HEADER>
  1039.         }
  1040.  
  1041.         //  <wavi-list>
  1042.         LIST
  1043.         {
  1044.             'wavi'
  1045.             <wave-list>...  //  Array of waves; each wave is encapsulated in a list
  1046.         }
  1047.  
  1048.             //  <wave-list>
  1049.             LIST
  1050.             {
  1051.                 'wave'
  1052.                 <waih-ck>       //  Wave item header
  1053.                 <DMRF-list>     //  Reference to wave object
  1054.             }
  1055.  
  1056.                 //  <waih-ck>
  1057.                 'waih'
  1058.                 {
  1059.                     <DMUS_IO_WAVE_ITEM_HEADER>
  1060.                 }
  1061.  
  1062. */
  1063.  
  1064. /*  File io for DirectMusic Container file. This embeds a set of related files. And,
  1065.     in turn, it can be embedded within a segment or script file.
  1066. */
  1067.  
  1068. #define DMUS_FOURCC_CONTAINER_FORM          mmioFOURCC('D','M','C','N')
  1069. #define DMUS_FOURCC_CONTAINER_CHUNK         mmioFOURCC('c','o','n','h')
  1070. #define DMUS_FOURCC_CONTAINED_ALIAS_CHUNK   mmioFOURCC('c','o','b','a')
  1071. #define DMUS_FOURCC_CONTAINED_OBJECT_CHUNK  mmioFOURCC('c','o','b','h')
  1072. #define DMUS_FOURCC_CONTAINED_OBJECTS_LIST  mmioFOURCC('c','o','s','l')
  1073. #define DMUS_FOURCC_CONTAINED_OBJECT_LIST   mmioFOURCC('c','o','b','l')
  1074.  
  1075. typedef struct _DMUS_IO_CONTAINER_HEADER
  1076. {
  1077.     DWORD       dwFlags;        /* Flags. */
  1078. } DMUS_IO_CONTAINER_HEADER;
  1079.  
  1080. #define DMUS_CONTAINER_NOLOADS  (1 << 1)   /* Contained items are not loaded when the container is loaded.
  1081.                                               Entries will be created in the loader (via SetObject) but
  1082.                                               the actual objects will not be created until they are
  1083.                                               specifically loaded at a later time. */
  1084.  
  1085. typedef struct _DMUS_IO_CONTAINED_OBJECT_HEADER
  1086. {
  1087.     GUID        guidClassID;    /* Class id of object. */
  1088.     DWORD       dwFlags;        /* Flags, for example DMUS_CONTAINED_OBJF_KEEP. */
  1089.     FOURCC      ckid;           /* chunk ID of track's data chunk if 0 fccType valid. */
  1090.     FOURCC      fccType;        /* list type if NULL ckid valid */
  1091.         /* Note that LIST:DMRF may be used for ckid and fccType in order to reference an
  1092.            object instead of embedding it within the container. */
  1093. } DMUS_IO_CONTAINED_OBJECT_HEADER;
  1094.  
  1095. #define DMUS_CONTAINED_OBJF_KEEP    1   /* Keep the object cached in the loader after the container is released. */
  1096.  
  1097. /*
  1098. RIFF
  1099. (
  1100.     'DMCN'          // DirectMusic Container chunk
  1101.     <conh-ck>       // Container header chunk
  1102.     [<guid-ck>]     // GUID for container
  1103.     [<vers-ck>]     // Optional version info
  1104.     [<UNFO-list>]   // Name, author, copyright info., comments
  1105.     <cosl-list>     // List of objects.
  1106. )
  1107.  
  1108.     // <conh-ck>        
  1109.     'conh'
  1110.     (
  1111.         <DMUS_IO_CONTAINER_HEADER>
  1112.     )
  1113.     
  1114.     // <guid-ck>
  1115.     'guid'
  1116.     (
  1117.         <GUID>
  1118.     )
  1119.  
  1120.     // <vers-ck>
  1121.     vers
  1122.     (
  1123.         <DMUS_IO_VERSION>
  1124.     )
  1125.  
  1126.     LIST
  1127.     (
  1128.         'cosl'          // Array of embedded objects.
  1129.         <cobl-list>...  // Each object is encapsulated in a LIST chunk
  1130.     )
  1131.  
  1132.     // <cobl-list>      // Encapsulates one object
  1133.     LIST
  1134.     (
  1135.         'cobl'
  1136.         [<coba-ck>]         // Alias.  An alternative name by which this object is known
  1137.                             // within the container.
  1138.         <cobh-ck>           // Required header, includes CLASS ID for object.
  1139.         [<data>] or <DMRF>  // Object data of the type specified in <cobh-ck>.
  1140.                             // If DMRF, it is a reference of where to find the object.
  1141.                             // Otherwise, it could be any RIFF readable chunk in the
  1142.                             //    exact same format as a file.  The object will load
  1143.                             //    itself from this data.
  1144.     )
  1145.  
  1146.     // <coba-ck>
  1147.     'coba'
  1148.     (
  1149.         // Alias, stored as NULL terminated string of WCHARs
  1150.     )
  1151.  
  1152.     // <cobh-ck>
  1153.     'cobh'
  1154.     (
  1155.         <DMUS_IO_CONTAINED_OBJECT_HEADER>
  1156.     )
  1157. */
  1158.  
  1159. /*  File io for DirectMusic Segment object */
  1160.  
  1161. /* RIFF ids: */
  1162.  
  1163. #define DMUS_FOURCC_SEGMENT_FORM        mmioFOURCC('D','M','S','G')
  1164. #define DMUS_FOURCC_SEGMENT_CHUNK       mmioFOURCC('s','e','g','h')
  1165. #define DMUS_FOURCC_TRACK_LIST          mmioFOURCC('t','r','k','l')
  1166. #define DMUS_FOURCC_TRACK_FORM          mmioFOURCC('D','M','T','K')
  1167. #define DMUS_FOURCC_TRACK_CHUNK         mmioFOURCC('t','r','k','h')
  1168. #define DMUS_FOURCC_TRACK_EXTRAS_CHUNK  mmioFOURCC('t','r','k','x')
  1169.  
  1170. /* io structures:*/
  1171.  
  1172. typedef struct _DMUS_IO_SEGMENT_HEADER
  1173. {
  1174.     DWORD       dwRepeats;      /* Number of repeats. By default, 0. */
  1175.     MUSIC_TIME  mtLength;       /* Length, in music time. */
  1176.     MUSIC_TIME  mtPlayStart;    /* Start of playback. By default, 0. */
  1177.     MUSIC_TIME  mtLoopStart;    /* Start of looping portion. By default, 0. */
  1178.     MUSIC_TIME  mtLoopEnd;      /* End of loop. Must be greater than dwPlayStart. Or, 0, indicating loop full segment. */
  1179.     DWORD       dwResolution;   /* Default resolution. */
  1180.     /* Following added for DX8: */
  1181.     REFERENCE_TIME rtLength;    /* Length, in reference time (overrides music time length.) */
  1182.     DWORD       dwFlags;
  1183.     DWORD       dwReserved;     /* Reserved. */
  1184.     /* Added for DX9. */
  1185.     REFERENCE_TIME rtLoopStart; /* Clock time loop start. */
  1186.     REFERENCE_TIME rtLoopEnd;   /* Clock time loop end. */
  1187.     REFERENCE_TIME rtPlayStart; /* Start of playback in clock time. */
  1188. } DMUS_IO_SEGMENT_HEADER;
  1189.  
  1190. #define DMUS_SEGIOF_REFLENGTH   1  /* Use the time in rtLength for the segment length. */
  1191. #define DMUS_SEGIOF_CLOCKTIME   2  /* This is a clock time segment. */
  1192.  
  1193. typedef struct _DMUS_IO_TRACK_HEADER
  1194. {
  1195.     GUID        guidClassID;    /* Class id of track. */
  1196.     DWORD       dwPosition;     /* Position in track list. */
  1197.     DWORD       dwGroup;        /* Group bits for track. */
  1198.     FOURCC      ckid;           /* chunk ID of track's data chunk. */
  1199.     FOURCC      fccType;        /* list type if ckid is RIFF or LIST */ 
  1200. } DMUS_IO_TRACK_HEADER;
  1201.  
  1202. /*  Additional parameters for the track header chunk, introduced in DX8 and
  1203.     on, are stored in a separate chunk. */
  1204.  
  1205. typedef struct _DMUS_IO_TRACK_EXTRAS_HEADER
  1206. {
  1207.     DWORD       dwFlags;        /* DX8 Added flags for control tracks. */
  1208.     DWORD       dwPriority;     /* Priority for composition. */
  1209. } DMUS_IO_TRACK_EXTRAS_HEADER;
  1210.  
  1211. /*
  1212. RIFF
  1213. (
  1214.     'DMSG'          // DirectMusic Segment chunk
  1215.     <segh-ck>       // Segment header chunk
  1216.     [<guid-ck>]     // GUID for segment
  1217.     [<vers-ck>]     // Optional version info
  1218.     [<UNFO-list>]   // Name, author, copyright info., comments
  1219.     [<DMCN-form>]   // Optional container of objects embedded in file. Must precede tracklist.
  1220.     <trkl-list>     // List of Tracks
  1221.     [<DMTG-form>]   // Optional ToolGraph
  1222.     [<DMAP-form>]   // Optional Audio Path
  1223. )
  1224.  
  1225.     // <segh-ck>        
  1226.     'segh'
  1227.     (
  1228.         <DMUS_IO_SEGMENT_HEADER>
  1229.     )
  1230.     
  1231.     // <guid-ck>
  1232.     'guid'
  1233.     (
  1234.         <GUID>
  1235.     )
  1236.  
  1237.     // <vers-ck>
  1238.     vers
  1239.     (
  1240.         <DMUS_IO_VERSION>
  1241.     )
  1242.  
  1243.     // <trkl-list>
  1244.     LIST
  1245.     (
  1246.         'trkl'          // Array of tracks
  1247.         <DMTK-form>...  // Each track is encapsulated in a RIFF chunk
  1248.     )
  1249.  
  1250.     // <DMTK-form>      // Tracks can be embedded in a segment or stored as separate files.
  1251.     RIFF
  1252.     (
  1253.         'DMTK'
  1254.         <trkh-ck>
  1255.         [<trkx-ck>]     // Optional track flags. 
  1256.         [<guid-ck>]     // Optional GUID for track object instance (not to be confused with Class id in track header)
  1257.         [<vers-ck>]     // Optional version info
  1258.         [<UNFO-list>]   // Optional name, author, copyright info., comments
  1259.         [<data>]        // Track data. Must be a RIFF readable chunk.
  1260.     )
  1261.  
  1262.     // <trkh-ck>            // Track header chunk
  1263.     (
  1264.         'trkh'
  1265.         <DMUS_IO_TRACK_HEADER>  // Track header
  1266.     )
  1267.  
  1268.     // <trkx-ck>            // Track flags chunk
  1269.     (
  1270.         'trkx'
  1271.         <DMUS_IO_TRACK_EXTRAS_HEADER>  // DX8 Track flags header
  1272.     )
  1273. */
  1274.  
  1275. /*  File io for DirectMusic reference chunk. 
  1276.     This is used to embed a reference to an object.
  1277. */
  1278.  
  1279. /*  RIFF ids: */
  1280.  
  1281. #define DMUS_FOURCC_REF_LIST        mmioFOURCC('D','M','R','F')
  1282. #define DMUS_FOURCC_REF_CHUNK       mmioFOURCC('r','e','f','h')
  1283. #define DMUS_FOURCC_DATE_CHUNK      mmioFOURCC('d','a','t','e')
  1284. #define DMUS_FOURCC_NAME_CHUNK      mmioFOURCC('n','a','m','e')
  1285. #define DMUS_FOURCC_FILE_CHUNK      mmioFOURCC('f','i','l','e')
  1286.  
  1287. typedef struct _DMUS_IO_REFERENCE
  1288. {
  1289.     GUID    guidClassID;    /* Class id is always required. */
  1290.     DWORD   dwValidData;    /* Flags. */
  1291. } DMUS_IO_REFERENCE;
  1292.  
  1293. /*
  1294. LIST
  1295. (
  1296.     'DMRF'          // DirectMusic Reference chunk
  1297.     <refh-ck>       // Reference header chunk
  1298.     [<guid-ck>]     // Optional object GUID.
  1299.     [<date-ck>]     // Optional file date.
  1300.     [<name-ck>]     // Optional name.
  1301.     [<file-ck>]     // Optional file name.
  1302.     [<catg-ck>]     // Optional category name.
  1303.     [<vers-ck>]     // Optional version info.
  1304. )
  1305.  
  1306.     // <refh-ck>
  1307.     'refh'
  1308.     (
  1309.         <DMUS_IO_REFERENCE>
  1310.     )
  1311.  
  1312.     // <guid-ck>
  1313.     'guid'
  1314.     (
  1315.         <GUID>
  1316.     )
  1317.  
  1318.     // <date-ck>
  1319.     date
  1320.     (
  1321.         <FILETIME>
  1322.     )
  1323.  
  1324.     // <name-ck>
  1325.     name
  1326.     (
  1327.         // Name, stored as NULL terminated string of WCHARs
  1328.     )
  1329.  
  1330.     // <file-ck>
  1331.     file
  1332.     (
  1333.         // File name, stored as NULL terminated string of WCHARs
  1334.     )
  1335.  
  1336.     // <catg-ck>
  1337.     catg
  1338.     (
  1339.         // Category name, stored as NULL terminated string of WCHARs
  1340.     )
  1341.  
  1342.     // <vers-ck>
  1343.     vers
  1344.     (
  1345.         <DMUS_IO_VERSION>
  1346.     )
  1347. */
  1348.  
  1349. /* Chord Maps */
  1350.  
  1351. /* runtime chunks */
  1352. #define DMUS_FOURCC_CHORDMAP_FORM       mmioFOURCC('D','M','P','R')
  1353. #define DMUS_FOURCC_IOCHORDMAP_CHUNK    mmioFOURCC('p','e','r','h')
  1354. #define DMUS_FOURCC_SUBCHORD_CHUNK      mmioFOURCC('c','h','d','t')
  1355. #define DMUS_FOURCC_CHORDENTRY_CHUNK    mmioFOURCC('c','h','e','h')
  1356. #define DMUS_FOURCC_SUBCHORDID_CHUNK    mmioFOURCC('s','b','c','n')
  1357. #define DMUS_FOURCC_IONEXTCHORD_CHUNK   mmioFOURCC('n','c','r','d')
  1358. #define DMUS_FOURCC_NEXTCHORDSEQ_CHUNK  mmioFOURCC('n','c','s','q')
  1359. #define DMUS_FOURCC_IOSIGNPOST_CHUNK    mmioFOURCC('s','p','s','h')
  1360. #define DMUS_FOURCC_CHORDNAME_CHUNK     mmioFOURCC('I','N','A','M')
  1361.  
  1362. /* runtime list chunks */
  1363. #define DMUS_FOURCC_CHORDENTRY_LIST     mmioFOURCC('c','h','o','e')
  1364. #define DMUS_FOURCC_CHORDMAP_LIST       mmioFOURCC('c','m','a','p')
  1365. #define DMUS_FOURCC_CHORD_LIST          mmioFOURCC('c','h','r','d')
  1366. #define DMUS_FOURCC_CHORDPALETTE_LIST   mmioFOURCC('c','h','p','l')
  1367. #define DMUS_FOURCC_CADENCE_LIST        mmioFOURCC('c','a','d','e')
  1368. #define DMUS_FOURCC_SIGNPOSTITEM_LIST   mmioFOURCC('s','p','s','t')
  1369.  
  1370. #define DMUS_FOURCC_SIGNPOST_LIST       mmioFOURCC('s','p','s','q')
  1371.  
  1372. /* values for dwChord field of DMUS_IO_PERS_SIGNPOST */
  1373. /* DMUS_SIGNPOSTF_ flags are also used in templates (DMUS_IO_SIGNPOST) */
  1374. #define DMUS_SIGNPOSTF_A        1      
  1375. #define DMUS_SIGNPOSTF_B        2
  1376. #define DMUS_SIGNPOSTF_C        4
  1377. #define DMUS_SIGNPOSTF_D        8
  1378. #define DMUS_SIGNPOSTF_E        0x10
  1379. #define DMUS_SIGNPOSTF_F        0x20
  1380. #define DMUS_SIGNPOSTF_LETTER   (DMUS_SIGNPOSTF_A | DMUS_SIGNPOSTF_B | DMUS_SIGNPOSTF_C | DMUS_SIGNPOSTF_D | DMUS_SIGNPOSTF_E | DMUS_SIGNPOSTF_F)
  1381. #define DMUS_SIGNPOSTF_1        0x100
  1382. #define DMUS_SIGNPOSTF_2        0x200
  1383. #define DMUS_SIGNPOSTF_3        0x400
  1384. #define DMUS_SIGNPOSTF_4        0x800
  1385. #define DMUS_SIGNPOSTF_5        0x1000
  1386. #define DMUS_SIGNPOSTF_6        0x2000
  1387. #define DMUS_SIGNPOSTF_7        0x4000
  1388. #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)
  1389. #define DMUS_SIGNPOSTF_CADENCE  0x8000
  1390.  
  1391. /* values for dwFlags field of DMUS_IO_CHORDMAP */
  1392. #define DMUS_CHORDMAPF_VERSION8  1   /* Chordmap is version 8 or above. */
  1393.  
  1394. /* values for dwChord field of DMUS_IO_PERS_SIGNPOST */
  1395. #define DMUS_SPOSTCADENCEF_1  2   /* Use the first cadence chord. */
  1396. #define DMUS_SPOSTCADENCEF_2  4   /* Use the second cadence chord. */
  1397.  
  1398. /* run time data structs */
  1399. typedef struct _DMUS_IO_CHORDMAP
  1400. {
  1401.     WCHAR   wszLoadName[20];
  1402.     DWORD   dwScalePattern;
  1403.     DWORD   dwFlags;           /* Various flags. Only lower 16 bits are significant. */
  1404. } DMUS_IO_CHORDMAP;
  1405.  
  1406. typedef struct _DMUS_IO_CHORDMAP_SUBCHORD
  1407. {
  1408.     DWORD   dwChordPattern;
  1409.     DWORD   dwScalePattern;
  1410.     DWORD   dwInvertPattern;
  1411.     BYTE    bChordRoot;
  1412.     BYTE    bScaleRoot;
  1413.     WORD    wCFlags;
  1414.     DWORD   dwLevels;   /* parts or which subchord levels this chord supports */
  1415. } DMUS_IO_CHORDMAP_SUBCHORD;
  1416.  
  1417. /* Legacy name... */
  1418. typedef DMUS_IO_CHORDMAP_SUBCHORD DMUS_IO_PERS_SUBCHORD;
  1419.  
  1420. typedef struct _DMUS_IO_CHORDENTRY
  1421. {
  1422.     DWORD   dwFlags;
  1423.     WORD    wConnectionID;  /* replaces runtime "pointer to this" */
  1424. } DMUS_IO_CHORDENTRY;
  1425.  
  1426. typedef struct _DMUS_IO_NEXTCHORD
  1427. {
  1428.     DWORD   dwFlags;
  1429.     WORD    nWeight;
  1430.     WORD    wMinBeats;
  1431.     WORD    wMaxBeats;
  1432.     WORD    wConnectionID;  /* points to an ioChordEntry */
  1433. } DMUS_IO_NEXTCHORD;
  1434.  
  1435. typedef struct _DMUS_IO_CHORDMAP_SIGNPOST
  1436. {
  1437.     DWORD   dwChords;   /* 1bit per group */
  1438.     DWORD   dwFlags;
  1439. } DMUS_IO_CHORDMAP_SIGNPOST;
  1440.  
  1441. /* Legacy name... */
  1442. typedef DMUS_IO_CHORDMAP_SIGNPOST DMUS_IO_PERS_SIGNPOST;
  1443.  
  1444. /*
  1445. RIFF
  1446. (
  1447.     'DMPR'
  1448.     <perh-ck>           // Chord map header chunk
  1449.     [<guid-ck>]         // guid chunk
  1450.     [<vers-ck>]         // version chunk (two DWORDS)
  1451.     [<UNFO-list>]       // Unfo chunk
  1452.     <chdt-ck>           // subchord database
  1453.     <chpl-list>         // chord palette
  1454.     <cmap-list>         // chord map
  1455.     <spsq-list>         // signpost list
  1456.  )
  1457.  
  1458. <cmap-list> ::= LIST('cmap' <choe-list> )
  1459.  
  1460. <choe-list> ::= LIST('choe'
  1461.                                 <cheh-ck>   // chord entry data
  1462.                                 <chrd-list> // chord definition
  1463.                                 <ncsq-ck>   // connecting(next) chords
  1464.                      )
  1465.  
  1466. <chrd-list> ::= LIST('chrd' 
  1467.                                 <INAM-ck>   // name of chord in wide char format
  1468.                                 <sbcn-ck>   // list of subchords composing chord
  1469.                     )
  1470.  
  1471. <chpl-list> ::= LIST('chpl' 
  1472.                                 <chrd-list> ... // chord definition
  1473.                     )
  1474.  
  1475. <spsq-list> ::== LIST('spsq' <spst-list> ... )
  1476.  
  1477. <spst-list> ::= LIST('spst'
  1478.                              <spsh-ck>
  1479.                              <chrd-list>
  1480.                              [<cade-list>]
  1481.                     )
  1482.  
  1483. <cade-list> ::= LIST('cade' <chrd-list> ...)
  1484.  
  1485. <perh-ck> ::= perh(<DMUS_IO_CHORDMAP>)
  1486.  
  1487. <chdt-ck> ::= chdt(<cbChordSize::WORD>
  1488.                    <DMUS_IO_PERS_SUBCHORD> ... )
  1489.  
  1490. <cheh-ck> ::= cheh(<DMUS_IO_CHORDENTRY>)
  1491.  
  1492. <sbcn-ck> ::= sbcn(<cSubChordID:WORD> ...)
  1493.  
  1494. <ncsq-ck> ::= ncsq(<wNextChordSize:WORD> 
  1495.                    <DMUS_IO_NEXTCHORD>...)
  1496.  
  1497. <spsh-ck> ::= spsh(<DMUS_IO_PERS_SIGNPOST>)
  1498.  
  1499. */
  1500.  
  1501. /*  File io for DirectMusic Script object */
  1502.  
  1503. /* RIFF ids: */
  1504.  
  1505. #define DMUS_FOURCC_SCRIPT_FORM             mmioFOURCC('D','M','S','C')
  1506. #define DMUS_FOURCC_SCRIPT_CHUNK            mmioFOURCC('s','c','h','d')
  1507. #define DMUS_FOURCC_SCRIPTVERSION_CHUNK     mmioFOURCC('s','c','v','e')
  1508. #define DMUS_FOURCC_SCRIPTLANGUAGE_CHUNK    mmioFOURCC('s','c','l','a')
  1509. #define DMUS_FOURCC_SCRIPTSOURCE_CHUNK      mmioFOURCC('s','c','s','r')
  1510.  
  1511. /* io structures:*/
  1512.  
  1513. typedef struct _DMUS_IO_SCRIPT_HEADER
  1514. {
  1515.     DWORD       dwFlags; /* DMUS_SCRIPTIOF_ flags */
  1516. } DMUS_IO_SCRIPT_HEADER;
  1517.  
  1518. #define DMUS_SCRIPTIOF_LOAD_ALL_CONTENT       (1 << 0)
  1519.     /* If set, when the script loads it will also load all the content in its container. */
  1520. #define DMUS_SCRIPTIOF_DOWNLOAD_ALL_SEGMENTS  (1 << 1)
  1521.     /* If set and LOAD_ALL_CONTENT is also set, when the script initializes it will also download all the segments in its container.
  1522.        If set and LOAD_ALL_CONTENT is not set, when the script calls segment.Load on a segment then the segment will also be downloaded.
  1523.        If not set, the script must manually download and unload by calling segment.DownloadSoundData and segment.UnloadSoundData. */
  1524.  
  1525. /*
  1526. RIFF
  1527. (
  1528.     'DMSC'              // DirectMusic Script chunk
  1529.     <schd-ck>           // Script header chunk
  1530.     [<guid-ck>]         // GUID for script
  1531.     [<vers-ck>]         // Optional version info
  1532.     [<UNFO-list>]       // Name, author, copyright info., comments
  1533.     <scve-ck>           // Version of DirectMusic this script was authored to run against
  1534.     <DMCN-form>         // Container of content referenced by the script.
  1535.     <scla-ck>           // ActiveX scripting language in which the script is written
  1536.     <scsr-ck> or <DMRF> // The script's source code.
  1537.                         // If scsr-ck, the source is embedding in the chunk.
  1538.                         // If DMRF, it is a reference of where to find a text file with the source.
  1539.                         //    Class id (guidClassID in DMUS_IO_REFERENCE) must be GUID_NULL because
  1540.                         //    this text file is not a DirectMusic object in its own right.
  1541. )
  1542.  
  1543.     // <schd-ck>
  1544.     'schd'
  1545.     (
  1546.         <DMUS_FOURCC_SCRIPT_CHUNK>
  1547.     )
  1548.     
  1549.     // <guid-ck>
  1550.     'guid'
  1551.     (
  1552.         <GUID>
  1553.     )
  1554.  
  1555.     // <vers-ck>
  1556.     vers
  1557.     (
  1558.         <DMUS_IO_VERSION>
  1559.     )
  1560.  
  1561.     // <scve-ck>
  1562.     scve
  1563.     (
  1564.         <DMUS_IO_VERSION>
  1565.     )
  1566.  
  1567.     'scla'
  1568.     (
  1569.         // Language name, stored as NULL terminated string of WCHARs
  1570.     )
  1571.  
  1572.     'scsr'
  1573.     (
  1574.         // Source code, stored as NULL terminated string of WCHARs
  1575.     )
  1576. */
  1577.  
  1578. /* Signpost tracks */
  1579.  
  1580. #define DMUS_FOURCC_SIGNPOST_TRACK_CHUNK     mmioFOURCC( 's', 'g', 'n', 'p' )
  1581.  
  1582.  
  1583. typedef struct _DMUS_IO_SIGNPOST
  1584. {
  1585.     MUSIC_TIME  mtTime;
  1586.     DWORD       dwChords;
  1587.     WORD        wMeasure;
  1588. } DMUS_IO_SIGNPOST;
  1589.  
  1590. /*
  1591.  
  1592.     // <sgnp-list>
  1593.     'sgnp'
  1594.     (
  1595.         //sizeof DMUS_IO_SIGNPOST: DWORD
  1596.         <DMUS_IO_SIGNPOST>...
  1597.     )
  1598.  
  1599. */
  1600.  
  1601. #define DMUS_FOURCC_MUTE_CHUNK  mmioFOURCC('m','u','t','e')
  1602.  
  1603. typedef struct _DMUS_IO_MUTE
  1604. {
  1605.     MUSIC_TIME  mtTime;
  1606.     DWORD       dwPChannel;
  1607.     DWORD       dwPChannelMap;
  1608. } DMUS_IO_MUTE;
  1609.  
  1610. /*
  1611.  
  1612.     // <mute-list>
  1613.     'mute'
  1614.     (
  1615.         //sizeof DMUS_IO_MUTE:DWORD
  1616.         <DMUS_IO_MUTE>...
  1617.     )
  1618.  
  1619.  
  1620. */
  1621.  
  1622. /* Used for both style and chord map tracks */
  1623.  
  1624. #define DMUS_FOURCC_TIME_STAMP_CHUNK    mmioFOURCC('s', 't', 'm', 'p')
  1625.  
  1626. /* Style tracks */
  1627.  
  1628. #define DMUS_FOURCC_STYLE_TRACK_LIST    mmioFOURCC('s', 't', 't', 'r')
  1629. #define DMUS_FOURCC_STYLE_REF_LIST      mmioFOURCC('s', 't', 'r', 'f')
  1630.  
  1631. /*
  1632.  
  1633.     // <sttr-list>
  1634.     LIST('sttr'
  1635.     (
  1636.         <strf-list>...  // Array of Style references
  1637.     )
  1638.  
  1639.     // <strf-list>
  1640.     LIST('strf'
  1641.     (
  1642.         <stmp-ck>
  1643.         <DMRF>
  1644.     )
  1645.  
  1646.   // <stmp-ck>
  1647.   'stmp'
  1648.   (
  1649.     // time:DWORD
  1650.   )
  1651.  
  1652. */
  1653.  
  1654. /* Chord map tracks */
  1655.  
  1656. #define DMUS_FOURCC_PERS_TRACK_LIST mmioFOURCC('p', 'f', 't', 'r')
  1657. #define DMUS_FOURCC_PERS_REF_LIST   mmioFOURCC('p', 'f', 'r', 'f')
  1658.  
  1659. /*
  1660.  
  1661.     // <pftr-list>
  1662.     LIST('pftr'
  1663.     (
  1664.         <pfrf-list>...  // Array of Chord map references
  1665.     )
  1666.  
  1667.     // <pfrf-list>
  1668.     LIST('pfrf'
  1669.     (
  1670.         <stmp-ck>
  1671.         <DMRF>
  1672.     )
  1673.  
  1674.   // <stmp-ck>
  1675.   'stmp'
  1676.   (
  1677.     // time:DWORD
  1678.   )
  1679.  
  1680. */
  1681.  
  1682. #define DMUS_FOURCC_TEMPO_TRACK     mmioFOURCC('t','e','t','r')
  1683.  
  1684. /*
  1685.     // tempo array
  1686.     'tetr'
  1687.     (
  1688.         // sizeof DMUS_IO_TEMPO_ITEM: DWORD
  1689.         <DMUS_IO_TEMPO_ITEM>...
  1690.     )
  1691.  */
  1692.  
  1693. #define DMUS_FOURCC_SEQ_TRACK       mmioFOURCC('s','e','q','t')
  1694. #define DMUS_FOURCC_SEQ_LIST        mmioFOURCC('e','v','t','l')
  1695. #define DMUS_FOURCC_CURVE_LIST      mmioFOURCC('c','u','r','l')
  1696.  
  1697. /*
  1698.     // sequence track
  1699.     'seqt'
  1700.     (
  1701.         // sequence array
  1702.         'evtl'
  1703.         (
  1704.             // sizeof DMUS_IO_SEQ_ITEM: DWORD
  1705.             <DMUS_IO_SEQ_ITEM>...
  1706.         )
  1707.         // curve array
  1708.         'curl'
  1709.         (
  1710.             // sizeof DMUS_IO_CURVE_ITEM: DWORD
  1711.             <DMUS_IO_CURVE_ITEM>...
  1712.         )
  1713.     )
  1714. */
  1715.  
  1716. #define DMUS_FOURCC_SYSEX_TRACK     mmioFOURCC('s','y','e','x')
  1717.  
  1718. /*
  1719.     // sysex track
  1720.     'syex'
  1721.     (
  1722.         {
  1723.             <DMUS_IO_SYSEX_ITEM>
  1724.             <BYTE>...    // Array of bytes, length defined in the DMUS_IO_SYSEXITEM structure
  1725.         }...
  1726.     )
  1727. */
  1728.  
  1729. #define DMUS_FOURCC_TIMESIGNATURE_TRACK mmioFOURCC('t','i','m','s')
  1730.  
  1731. typedef struct _DMUS_IO_TIMESIGNATURE_ITEM
  1732. {
  1733.     MUSIC_TIME    lTime;
  1734.     BYTE          bBeatsPerMeasure;   /* beats per measure (top of time sig) */
  1735.     BYTE          bBeat;              /* what note receives the beat (bottom of time sig.) */
  1736.                                       /* we can assume that 0 means 256th note */
  1737.     WORD          wGridsPerBeat;      /* grids per beat */
  1738. } DMUS_IO_TIMESIGNATURE_ITEM;
  1739.  
  1740. /*  DX6 time signature track
  1741.     
  1742.     'tims'
  1743.     (
  1744.         // size of DMUS_IO_TIMESIGNATURE_ITEM : DWORD
  1745.         <DMUS_IO_TIMESIGNATURE_ITEM>...
  1746.     )
  1747. */
  1748.  
  1749. /*  DX8 Time signature track. The track has been updated from DX7 to support a list of
  1750.     RIFF chunks. This will allow the time signature track to expand in the future.
  1751. */
  1752.  
  1753. #define DMUS_FOURCC_TIMESIGTRACK_LIST   mmioFOURCC('T','I','M','S')
  1754. #define DMUS_FOURCC_TIMESIG_CHUNK       DMUS_FOURCC_TIMESIGNATURE_TRACK
  1755.  
  1756. /*
  1757. LIST
  1758. (
  1759.     'TIMS'          // Time Signature Track list-type
  1760.     <tims-ck>       // Chunk containing an array of time signatures
  1761. )
  1762.  
  1763.     'tims'
  1764.     (
  1765.         // size of DMUS_IO_TIMESIGNATURE_ITEM : DWORD
  1766.         <DMUS_IO_TIMESIGNATURE_ITEM>...
  1767.     )
  1768.  
  1769. */
  1770.  
  1771. /*  DX8 Marker track. This is used to store valid start points and other
  1772.     flow control parameters that may come later. For example, if we want
  1773.     to implement more sophisticated looping and branching constructs, they
  1774.     would live in this track.
  1775. */
  1776.  
  1777. #define DMUS_FOURCC_MARKERTRACK_LIST    mmioFOURCC('M','A','R','K')
  1778. #define DMUS_FOURCC_VALIDSTART_CHUNK    mmioFOURCC('v','a','l','s')
  1779. #define DMUS_FOURCC_PLAYMARKER_CHUNK    mmioFOURCC('p','l','a','y')
  1780.  
  1781. /* io structures */
  1782. typedef struct _DMUS_IO_VALID_START
  1783. {
  1784.     MUSIC_TIME mtTime;      /* Time of a legal start. */
  1785. } DMUS_IO_VALID_START;
  1786.  
  1787. typedef struct _DMUS_IO_PLAY_MARKER
  1788. {
  1789.     MUSIC_TIME mtTime;      /* Time of a next legal play point marker. */
  1790. } DMUS_IO_PLAY_MARKER;
  1791.  
  1792. /*
  1793. LIST
  1794. (
  1795.     'MARK'          // Marker Track list-type
  1796.     [<vals-ck>]     // Chunk containing an array of start points
  1797.     [<play-ck>]     // Chunk containing an array of play start markers
  1798. )
  1799.  
  1800.     'vals'
  1801.     (
  1802.         // size of DMUS_IO_VALID_START : DWORD
  1803.         <DMUS_IO_VALID_START>...
  1804.     )
  1805.  
  1806.     'play'
  1807.     (
  1808.         // size of DMUS_IO_PLAY_MARKER : DWORD
  1809.         <DMUS_IO_PLAY_MARKER>...
  1810.     )
  1811.   
  1812. */
  1813.  
  1814. /* segment trigger tracks */
  1815.  
  1816. /* RIFF ids: */
  1817. #define DMUS_FOURCC_SEGTRACK_LIST                   mmioFOURCC('s','e','g','t')
  1818. #define DMUS_FOURCC_SEGTRACK_CHUNK                  mmioFOURCC('s','g','t','h')
  1819. #define DMUS_FOURCC_SEGMENTS_LIST                   mmioFOURCC('l','s','g','l')
  1820. #define DMUS_FOURCC_SEGMENT_LIST                    mmioFOURCC('l','s','e','g')
  1821. #define DMUS_FOURCC_SEGMENTITEM_CHUNK               mmioFOURCC('s','g','i','h')
  1822. #define DMUS_FOURCC_SEGMENTITEMNAME_CHUNK           mmioFOURCC('s','n','a','m')
  1823.  
  1824. /* io structures */
  1825. typedef struct _DMUS_IO_SEGMENT_TRACK_HEADER
  1826. {
  1827.     DWORD dwFlags; /* Reserved leave as 0. */
  1828. } DMUS_IO_SEGMENT_TRACK_HEADER;
  1829.  
  1830. typedef struct _DMUS_IO_SEGMENT_ITEM_HEADER
  1831. {
  1832.     MUSIC_TIME      lTimeLogical;    /* Position in track list. Time in the music with which the event is associated. */
  1833.     MUSIC_TIME      lTimePhysical;   /* Precise time event will be triggered. Should be close to logical time. */
  1834.     DWORD           dwPlayFlags;     /* Flags for PlaySegment(). */
  1835.     DWORD           dwFlags;         /* Flags. */
  1836. } DMUS_IO_SEGMENT_ITEM_HEADER;
  1837.  
  1838. /* values for dwflags field of DMUS_IO_SEGMENT_ITEM_HEADER */
  1839. #define DMUS_SEGMENTTRACKF_MOTIF                 1        /* interpret DMRF as link to style, and use snam as the name of a motif within the style */
  1840.  
  1841. /*
  1842. LIST
  1843. (
  1844.     'segt'          // DirectMusic Segment Trigger Track form-type
  1845.     [<sgth-ck>]     // Segment track header
  1846.     <lsgl-list>     // List of Segment Lists
  1847. )
  1848.  
  1849.     // <sgth-ck>
  1850.     'sgth'
  1851.     (
  1852.         <DMUS_IO_SEGMENT_TRACK_HEADER>
  1853.     )
  1854.  
  1855.     // <lsgl-list>
  1856.     LIST
  1857.     (
  1858.         'lsgl'          // Array of segments
  1859.         <lseg-list>...  // Each segment is encapsulated in a list (that way it can still be riff parsed.)
  1860.     )
  1861.  
  1862.         // <lseg-list>
  1863.         LIST
  1864.         (
  1865.             'lseg'
  1866.             <sgih-ck>
  1867.             <DMRF-list>    // Link to a segment or style file.
  1868.             [<snam-ck>]    // Name field.  Used with DMUS_SEGMENTTRACKF_MOTIF flag.
  1869.         )
  1870.  
  1871.             // <sgih-ck>            // segment item header
  1872.             (
  1873.                 <DMUS_IO_SEGMENT_ITEM_HEADER>  // Segment item header
  1874.             )
  1875.  
  1876.             // <snam-ck>
  1877.             (
  1878.                 // Name, stored as NULL terminated string of WCHARs
  1879.             )
  1880. */      
  1881.  
  1882. /* Script track. */
  1883.  
  1884. /* RIFF ids: */
  1885. #define DMUS_FOURCC_SCRIPTTRACK_LIST                mmioFOURCC('s','c','r','t')
  1886. #define DMUS_FOURCC_SCRIPTTRACKEVENTS_LIST          mmioFOURCC('s','c','r','l')
  1887. #define DMUS_FOURCC_SCRIPTTRACKEVENT_LIST           mmioFOURCC('s','c','r','e')
  1888. #define DMUS_FOURCC_SCRIPTTRACKEVENTHEADER_CHUNK    mmioFOURCC('s','c','r','h')
  1889. #define DMUS_FOURCC_SCRIPTTRACKEVENTNAME_CHUNK      mmioFOURCC('s','c','r','n')
  1890.  
  1891. /* Flags for DMUS_IO_SCRIPTTRACK_TIMING
  1892.  */
  1893. #define DMUS_IO_SCRIPTTRACKF_PREPARE (1 << 0)        /* Fire event in advance of time stamp, at Prepare time.  This is the default because it leaves the script time to change the music happening at the target time. */
  1894. #define DMUS_IO_SCRIPTTRACKF_QUEUE   (1 << 1)        /* Fire event just before time stamp, at Queue time. */
  1895. #define DMUS_IO_SCRIPTTRACKF_ATTIME  (1 << 2)        /* Fire event right at the time stamp. */
  1896.  
  1897. typedef struct _DMUS_IO_SCRIPTTRACK_EVENTHEADER
  1898. {
  1899.     DWORD dwFlags;              /* various bits (see DMUS_IO_SCRIPTTRACKF_*) */
  1900.     MUSIC_TIME lTimeLogical;    /* Position in track list. Time in the music with which the event is associated. */
  1901.     MUSIC_TIME lTimePhysical;   /* Precise time event will be triggered. Should be close to logical time. */
  1902. } DMUS_IO_SCRIPTTRACK_EVENTHEADER;
  1903.  
  1904. /*
  1905.     // Script Track
  1906.  
  1907.     // <scrt-list>
  1908.     LIST
  1909.     (
  1910.         <scrl-list>       // List of script events
  1911.     )
  1912.  
  1913.         // <scrl-list>
  1914.         LIST
  1915.         (
  1916.             <scre-list>...    // Array of event descriptions
  1917.         )
  1918.  
  1919.             // <scre-list>
  1920.             LIST
  1921.             (
  1922.                 <scrh-ck>         // Event header chunk
  1923.                 <DMRF>
  1924.                 <scrn-ck>         // Routine name
  1925.             )
  1926.  
  1927.                 'scrh'
  1928.                 (
  1929.                     <DMUS_IO_SCRIPTTRACK_EVENTHEADER>
  1930.                 )
  1931.  
  1932.                 'scrn'
  1933.                 (
  1934.                     // Name, stored as NULL terminated string of WCHARs
  1935.                 )
  1936. */
  1937.  
  1938. /* Lyrics/Notification track. */
  1939.  
  1940. /* RIFF ids: */
  1941. #define DMUS_FOURCC_LYRICSTRACK_LIST                mmioFOURCC('l','y','r','t')
  1942. #define DMUS_FOURCC_LYRICSTRACKEVENTS_LIST          mmioFOURCC('l','y','r','l')
  1943. #define DMUS_FOURCC_LYRICSTRACKEVENT_LIST           mmioFOURCC('l','y','r','e')
  1944. #define DMUS_FOURCC_LYRICSTRACKEVENTHEADER_CHUNK    mmioFOURCC('l','y','r','h')
  1945. #define DMUS_FOURCC_LYRICSTRACKEVENTTEXT_CHUNK      mmioFOURCC('l','y','r','n')
  1946.  
  1947. typedef struct _DMUS_IO_LYRICSTRACK_EVENTHEADER
  1948. {
  1949.     DWORD dwFlags;              /* Reserved leave as 0. */
  1950.     DWORD dwTimingFlags;        /* Combination DMUS_PMSGF_TOOL_* flags.  Determines the precise timing of when the notification happens. Invalid with the flag DMUS_PMSGF_REFTIME, DMUS_PMSGF_MUSICTIME, DMUS_PMSGF_TOOL_FLUSH, or DMUS_PMSGF_LOCKTOREFTIME. */
  1951.     MUSIC_TIME lTimeLogical;    /* Position in track list. Time in the music with which the event is associated. */
  1952.     MUSIC_TIME lTimePhysical;   /* Precise time event will be triggered. Should be close to logical time. */
  1953. } DMUS_IO_LYRICSTRACK_EVENTHEADER;
  1954.  
  1955. /*
  1956.     // Lyrics/Notification Track
  1957.  
  1958.     // <lyrt-list>
  1959.     LIST
  1960.     (
  1961.         <lyrl-list>       // List of notification events
  1962.     )
  1963.  
  1964.         // <lyrl-list>
  1965.         LIST
  1966.         (
  1967.             <lyre-list>...    // Array of event descriptions
  1968.         )
  1969.  
  1970.             // <lyre-list>
  1971.             LIST
  1972.             (
  1973.                 <lyrh-ck>         // Event header chunk
  1974.                 <lyrn-ck>         // Notification text
  1975.             )
  1976.  
  1977.                 'lyrh'
  1978.                 (
  1979.                     <DMUS_IO_LYRICSTRACK_EVENTHEADER>
  1980.                 )
  1981.  
  1982.                 'lyrn'
  1983.                 (
  1984.                     // Name, stored as NULL terminated string of WCHARs
  1985.                 )
  1986. */
  1987.  
  1988. /* Parameter control track */
  1989.  
  1990. /* RIFF ids: */
  1991. #define DMUS_FOURCC_PARAMCONTROLTRACK_TRACK_LIST            mmioFOURCC('p','r','m','t')
  1992. #define DMUS_FOURCC_PARAMCONTROLTRACK_OBJECT_LIST           mmioFOURCC('p','r','o','l')
  1993. #define DMUS_FOURCC_PARAMCONTROLTRACK_OBJECT_CHUNK          mmioFOURCC('p','r','o','h')
  1994. #define DMUS_FOURCC_PARAMCONTROLTRACK_PARAM_LIST            mmioFOURCC('p','r','p','l')
  1995. #define DMUS_FOURCC_PARAMCONTROLTRACK_PARAM_CHUNK           mmioFOURCC('p','r','p','h')
  1996. #define DMUS_FOURCC_PARAMCONTROLTRACK_CURVES_CHUNK          mmioFOURCC('p','r','c','c')
  1997.  
  1998. typedef struct _DMUS_IO_PARAMCONTROLTRACK_OBJECTHEADER
  1999. {
  2000.     DWORD dwFlags;              /* Reserved.  Must be zero. */
  2001.     GUID guidTimeFormat;        /* Time format to set the object to.  Must be GUID_TIME_REFERNCE or GUID_TIME_MUSIC from medparam.h. */
  2002.     /* Path for finding the object. These fields correspond to the first five parameters of IDirectMusicSegmentState::GetObjectInPath. */
  2003.     DWORD dwPChannel;
  2004.     DWORD dwStage;
  2005.     DWORD dwBuffer;
  2006.     GUID guidObject;
  2007.     DWORD dwIndex;
  2008. } DMUS_IO_PARAMCONTROLTRACK_OBJECTHEADER;
  2009.  
  2010. typedef struct _DMUS_IO_PARAMCONTROLTRACK_PARAMHEADER
  2011. {
  2012.     DWORD dwFlags;              /* Reserved.  Must be zero. */
  2013.     DWORD dwIndex;              /* Index number of the parameter on the object */
  2014. } DMUS_IO_PARAMCONTROLTRACK_PARAMHEADER;
  2015.  
  2016. typedef struct _DMUS_IO_PARAMCONTROLTRACK_CURVEINFO
  2017. {
  2018.     MUSIC_TIME  mtStartTime;
  2019.     MUSIC_TIME  mtEndTime;
  2020.     float       fltStartValue;
  2021.     float       fltEndValue;
  2022.     DWORD       dwCurveType;   /* One of the items from the MP_CURVE_TYPE enum in medparam.h */
  2023.     DWORD       dwFlags;       /* A combination of the MPF_ENVLP_* constants in medparam.h */
  2024. } DMUS_IO_PARAMCONTROLTRACK_CURVEINFO;
  2025.  
  2026. /*
  2027.     // <prmt-list>
  2028.     LIST
  2029.     (
  2030.         <prol-list>...   // one for each object
  2031.     )
  2032.  
  2033.         // <prol-list>
  2034.         LIST
  2035.         (
  2036.             <proh-ck>       // object header chunk
  2037.             <prpl-list>...  // one for each parameter
  2038.         )
  2039.  
  2040.             // <proh-ck>
  2041.             proh
  2042.             (
  2043.                 <DMUS_IO_PARAMCONTROLTRACK_OBJECTHEADER>
  2044.             )
  2045.  
  2046.             // <prpl-list>
  2047.             LIST
  2048.             (
  2049.                 <prph-ck>       // parameter header chunk
  2050.                 <prcc-ck>       // chunk containing an array of curves
  2051.             )
  2052.  
  2053.                 // <prph-ck>
  2054.                 prph
  2055.                 (
  2056.                     <DMUS_IO_PARAMCONTROLTRACK_PARAMHEADER>
  2057.                 )
  2058.  
  2059.                 // <prcc-ck>
  2060.                 prcc
  2061.                 (
  2062.                     // sizeof DMUS_IO_PARAMCONTROLTRACK_CURVEINFO:DWORD
  2063.                     <DMUS_IO_PARAMCONTROLTRACK_CURVEINFO>... // curves, sorted in order of mtTime
  2064.                 )
  2065. */
  2066.  
  2067. #if (DIRECTSOUND_VERSION >= 0x0800)
  2068.  
  2069. /* DirectSoundBufferConfig FX Map */
  2070.  
  2071. /* RIFF ids: */
  2072.  
  2073. #define DMUS_FOURCC_DSBC_FORM       mmioFOURCC('D','S','B','C')
  2074. #define DMUS_FOURCC_DSBD_CHUNK      mmioFOURCC('d','s','b','d')
  2075. #define DMUS_FOURCC_BSID_CHUNK      mmioFOURCC('b','s','i','d')
  2076. #define DMUS_FOURCC_DS3D_CHUNK      mmioFOURCC('d','s','3','d')
  2077. #define DMUS_FOURCC_DSBC_LIST       mmioFOURCC('f','x','l','s')
  2078. #define DMUS_FOURCC_DSFX_FORM       mmioFOURCC('D','S','F','X')
  2079. #define DMUS_FOURCC_DSFX_CHUNK      mmioFOURCC('f','x','h','r')
  2080. #define DMUS_FOURCC_DSFX_DATA       mmioFOURCC('d','a','t','a')
  2081.  
  2082. /* io structures */
  2083.  
  2084. typedef struct _DSOUND_IO_DSBUFFERDESC
  2085. {
  2086.     DWORD dwFlags;        /* DirectSound buffer creation flags */
  2087.     WORD nChannels;       /* No. of channels (rest of buffer format is determined by owning sink) */
  2088.     LONG lVolume;         /* Initial pan; only used if CTRLVOLUME is specified */
  2089.     LONG lPan;            /* Initial pan; only used if CTRLPAN is specified */
  2090.     DWORD dwReserved;     /* Reserved - must be 0 */
  2091. } DSOUND_IO_DSBUFFERDESC;
  2092.  
  2093. typedef struct _DSOUND_IO_DSBUSID
  2094. {
  2095.     DWORD busid[1];       /* Array size determined from chunk size */
  2096. } DSOUND_IO_DSBUSID;
  2097.  
  2098. typedef struct _DSOUND_IO_3D
  2099. {
  2100.     GUID guid3DAlgorithm; /* GUID identifying the 3D algorithm to use (defined in dsound.h) */
  2101.     DS3DBUFFER ds3d;      /* Initial 3D parameters */
  2102. } DSOUND_IO_3D;
  2103.  
  2104. typedef struct _DSOUND_IO_DXDMO_HEADER
  2105. {
  2106.     DWORD dwEffectFlags;  /* Effect creation flags - equivalent to DSEFFECTDESC::dwFlags */
  2107.     GUID guidDSFXClass;   /* GUID identifying the effect to use - corresponds to a COM CLSID */
  2108.     GUID guidReserved;    /* Reserved - must be the null GUID */
  2109.     GUID guidSendBuffer;  /* GUID identifying the buffer to send to if this is a send effect */
  2110.     DWORD dwReserved;     /* Reserved - must be 0 */
  2111. } DSOUND_IO_DXDMO_HEADER;
  2112.  
  2113. typedef struct _DSOUND_IO_DXDMO_DATA
  2114. {
  2115.     DWORD data[1];      /* Array size determined by the DMO involved */
  2116. } DSOUND_IO_DXDMO_DATA;
  2117.  
  2118. /*
  2119. RIFF
  2120. (
  2121.     'DSBC'          // DirectSoundBufferConfig chunk
  2122.     [<guid-ck>]     // GUID identifier for this DirectSoundBufferConfig
  2123.     [<vers-ck>]     // Optional version info
  2124.     [<UNFO-list>]   // Name, author, copyright info., comments
  2125.     <dsbd-ck>       // DirectSound Buffer descriptor chunk
  2126.     [<bsid-ck>]     // Optional bus id array
  2127.     [<ds3d-ck>]     // Optional 3d Parameters
  2128.     [<fxls-list>]   // Optional list of FX descriptors
  2129. )
  2130.  
  2131.     // <guid-ck>
  2132.     'guid'
  2133.     (
  2134.         <GUID>
  2135.     )
  2136.  
  2137.     // <vers-ck>
  2138.     'vers'
  2139.     (
  2140.         <DMUS_IO_VERSION>
  2141.     )
  2142.  
  2143.     // <dsbd-ck>
  2144.     'dsbd'
  2145.     (
  2146.         <DSOUND_IO_DSBUFFERDESC>  // Creation parameters and initial settings for the buffer
  2147.     )
  2148.  
  2149.     // <bsid-ck>
  2150.     'bsid'
  2151.     (
  2152.         <DSOUND_IO_DSBUSID>  // The size of DSOUND_IO_DSBUSID is determined by the chunk size 
  2153.     )
  2154.  
  2155.     // <ds3d-ck>
  2156.     'ds3d'
  2157.     (
  2158.         <DSOUND_IO_3D>  // Initial 3D buffer parameters: position, etc.
  2159.     )
  2160.  
  2161.     // <fx-list>
  2162.     LIST
  2163.     (
  2164.         'fxls'          // Array of DMO creation parameter blocks
  2165.         <DSFX-form>...  // Each DMO is encapsulated in a RIFF chunk
  2166.     )
  2167.  
  2168. // <DSFX-form>          // DMOs can be embedded in a buffer configuration or stored as separate files
  2169. RIFF
  2170. (
  2171.     'DSFX'
  2172.     <fxhr-ck>           // FX header chunk
  2173.     [<data-ck>]         // FX initial settings chunk
  2174. )
  2175.  
  2176.     // <fxhr-ck>
  2177.     'fxhr'
  2178.     (
  2179.         <DSOUND_IO_DXDMO_HEADER>
  2180.     )
  2181.  
  2182.     // <data-ck>
  2183.     'data'
  2184.     (
  2185.         <DSOUND_IO_DXDMO_DATA>  // Opaque data block used by the DMO to load itself.
  2186.         // For our standard included DMOs, this is simply the structure accepted by
  2187.         // the DMO's SetAllParameters() method - e.g. struct DSFXChorus for Chorus.
  2188.     )
  2189. */
  2190.  
  2191. #endif
  2192.  
  2193. #ifdef __cplusplus
  2194. }; /* extern "C" */
  2195. #endif
  2196.  
  2197. #include <poppack.h>
  2198.  
  2199. #endif /* #ifndef _DMUSICF_ */
  2200.