MMDMusic.pas
上传用户:hylc_2004
上传日期:2014-01-23
资源大小:46800k
文件大小:124k
源码类别:

Delphi控件源码

开发平台:

Delphi

  1. {========================================================================}
  2. {=                (c) 1995-98 SwiftSoft Ronald Dittrich                 =}
  3. {========================================================================}
  4. {=                          All Rights Reserved                         =}
  5. {========================================================================}
  6. {=  D 01099 Dresden             = Fax.: +49(0)351-8037944               =}
  7. {=  Loewenstr.7a                = info@swiftsoft.de                     =}
  8. {========================================================================}
  9. {=  Actual versions on http://www.swiftsoft.de/index.html               =}
  10. {========================================================================}
  11. {=  This code is for reference purposes only and may not be copied or   =}
  12. {=  distributed in any format electronic or otherwise except one copy   =}
  13. {=  for backup purposes.                                                =}
  14. {=                                                                      =}
  15. {=  No Delphi Component Kit or Component individually or in a collection=}
  16. {=  subclassed or otherwise from the code in this unit, or associated   =}
  17. {=  .pas, .dfm, .dcu, .asm or .obj files may be sold or distributed     =}
  18. {=  without express permission from SwiftSoft.                          =}
  19. {=                                                                      =}
  20. {=  For more licence informations please refer to the associated        =}
  21. {=  HelpFile.                                                           =}
  22. {========================================================================}
  23. {=  $Date: 27.01.98 - 18:28:27 $                                        =}
  24. {========================================================================}
  25. unit MMDMusic;
  26. interface
  27. {$Z4}
  28. {$A+}
  29. {$IFDEF DELPHI3}
  30. {$WEAKPACKAGEUNIT}
  31. {$ENDIF}
  32. uses Windows,MMSystem,ActiveX;
  33. (***************************************************************************
  34.  *
  35.  *  dls1.h
  36.  *
  37.  *
  38.  *  Description:
  39.  *
  40.  *  class defines and structures for the Instrument Collection Form
  41.  *  RIFF DLS.
  42.  *
  43.  *
  44.  *  Written by Sonic Foundry 1996.  Released for public use.
  45.  *
  46.  ***************************************************************************)
  47. (***************************************************************************
  48.  *
  49.  *
  50.  * Layout of an instrument collection:
  51.  *
  52.  *
  53.  * RIFF [] 'DLS ' [dlid,colh,INSTLIST,WAVEPOOL,INFOLIST]
  54.  *
  55.  * INSTLIST
  56.  * LIST [] 'lins'
  57.  *               LIST [] 'ins ' [dlid,insh,RGNLIST,ARTLIST,INFOLIST]
  58.  *               LIST [] 'ins ' [dlid,insh,RGNLIST,ARTLIST,INFOLIST]
  59.  *               LIST [] 'ins ' [dlid,insh,RGNLIST,ARTLIST,INFOLIST]
  60.  *
  61.  * RGNLIST
  62.  * LIST [] 'lrgn'
  63.  *               LIST [] 'rgn '  [rgnh,wsmp,wlnk,ARTLIST]
  64.  *               LIST [] 'rgn '  [rgnh,wsmp,wlnk,ARTLIST]
  65.  *               LIST [] 'rgn '  [rgnh,wsmp,wlnk,ARTLIST]
  66.  *
  67.  * ARTLIST
  68.  * LIST [] 'lart'
  69.  *         'art1' level 1 Articulation connection graph
  70.  *         'art2' level 2 Articulation connection graph
  71.  *         '3rd1' Possible 3rd party articulation structure 1
  72.  *         '3rd2' Possible 3rd party articulation structure 2 .... and so on
  73.  *
  74.  * WAVEPOOL
  75.  * ptbl [] [pool table]
  76.  * LIST [] 'wvpl'
  77.  *               [path],
  78.  *               [path],
  79.  *               LIST [] 'wave' [dlid,RIFFWAVE]
  80.  *               LIST [] 'wave' [dlid,RIFFWAVE]
  81.  *               LIST [] 'wave' [dlid,RIFFWAVE]
  82.  *               LIST [] 'wave' [dlid,RIFFWAVE]
  83.  *               LIST [] 'wave' [dlid,RIFFWAVE]
  84.  *
  85.  * INFOLIST
  86.  * LIST [] 'INFO'
  87.  *               'icmt' 'One of those crazy comments.'
  88.  *               'icop' 'Copyright (C) 1996 Sonic Foundry'
  89.  *
  90.  **************************************************************************)
  91. (**************************************************************************
  92.  * FOURCC's used in the DLS file
  93.  *************************************************************************)
  94. const
  95.      FOURCC_DLS   = $20534C44; //mmioFOURCC('D','L','S',' ')
  96.      FOURCC_DLID  = $64696C64; //mmioFOURCC('d','l','i','d')
  97.      FOURCC_COLH  = $686C6F63; //mmioFOURCC('c','o','l','h')
  98.      FOURCC_WVPL  = $6C707677; //mmioFOURCC('w','v','p','l')
  99.      FOURCC_PTBL  = $6C627470; //mmioFOURCC('p','t','b','l')
  100.      FOURCC_PATH  = $68746170; //mmioFOURCC('p','a','t','h')
  101.      FOURCC_wave  = $65766177; //mmioFOURCC('w','a','v','e')
  102.      FOURCC_LINS  = $736E696C; //mmioFOURCC('l','i','n','s')
  103.      FOURCC_INS   = $20736E69; //mmioFOURCC('i','n','s',' ')
  104.      FOURCC_INSH  = $68736E69; //mmioFOURCC('i','n','s','h')
  105.      FOURCC_LRGN  = $6E67726C; //mmioFOURCC('l','r','g','n')
  106.      FOURCC_RGN   = $206E6772; //mmioFOURCC('r','g','n',' ')
  107.      FOURCC_RGNH  = $686E6772; //mmioFOURCC('r','g','n','h')
  108.      FOURCC_LART  = $7472616C; //mmioFOURCC('l','a','r','t')
  109.      FOURCC_ART1  = $31747261; //mmioFOURCC('a','r','t','1')
  110.      FOURCC_WLNK  = $6B6E6C77; //mmioFOURCC('w','l','n','k')
  111.      FOURCC_WSMP  = $706D7377; //mmioFOURCC('w','s','m','p')
  112.      FOURCC_VERS  = $73726576; //mmioFOURCC('v','e','r','s')
  113. (**************************************************************************
  114.  * Articulation connection graph definitions
  115.  **************************************************************************)
  116. const
  117.      { Generic Sources }
  118.      CONN_SRC_NONE               = $0000;
  119.      CONN_SRC_LFO                = $0001;
  120.      CONN_SRC_KEYONVELOCITY      = $0002;
  121.      CONN_SRC_KEYNUMBER          = $0003;
  122.      CONN_SRC_EG1                = $0004;
  123.      CONN_SRC_EG2                = $0005;
  124.      CONN_SRC_PITCHWHEEL         = $0006;
  125.      { Midi Controllers 0-127 }
  126.      CONN_SRC_CC1                = $0081;
  127.      CONN_SRC_CC7                = $0087;
  128.      CONN_SRC_CC10               = $008a;
  129.      CONN_SRC_CC11               = $008b;
  130.      { Generic Destinations }
  131.      CONN_DST_NONE               = $0000;
  132.      CONN_DST_ATTENUATION        = $0001;
  133.      CONN_DST_PITCH              = $0003;
  134.      CONN_DST_PAN                = $0004;
  135.      { LFO Destinations }
  136.      CONN_DST_LFO_FREQUENCY      = $0104;
  137.      CONN_DST_LFO_STARTDELAY     = $0105;
  138.      { EG1 Destinations }
  139.      CONN_DST_EG1_ATTACKTIME     = $0206;
  140.      CONN_DST_EG1_DECAYTIME      = $0207;
  141.      CONN_DST_EG1_RELEASETIME    = $0209;
  142.      CONN_DST_EG1_SUSTAINLEVEL   = $020a;
  143.      { EG2 Destinations }
  144.      CONN_DST_EG2_ATTACKTIME     = $030a;
  145.      CONN_DST_EG2_DECAYTIME      = $030b;
  146.      CONN_DST_EG2_RELEASETIME    = $030d;
  147.      CONN_DST_EG2_SUSTAINLEVEL   = $030e;
  148.      CONN_TRN_NONE               = $0000;
  149.      CONN_TRN_CONCAVE            = $0001;
  150. type
  151.     PDLSID = ^TDLSID;
  152.     TDLSID = record
  153.         ulData1: DWORD;
  154.         usData2: Word;
  155.         usData3: Word;
  156.         abData4: array[0..7] of Byte;
  157.     end;
  158.     PDLSVERSION = ^TDLSVERSION;
  159.     TDLSVERSION = record
  160.         dwVersionMS: DWORD;
  161.         dwVersionLS: DWORD;
  162.     end;
  163.     PCONNECTION = ^TCONNECTION;
  164.     TCONNECTION = record
  165.         usSource     : Word;
  166.         usControl    : Word;
  167.         usDestination: Word;
  168.         usTransform  : Word;
  169.         lScale       : DWORD;
  170.     end;
  171.     { Level 1 Articulation Data }
  172.     PCONNECTIONLIST = ^TCONNECTIONLIST;
  173.     TCONNECTIONLIST = record
  174.         cbSize      : DWORD;      // size of the connection list structure
  175.         cConnections: DWORD;      // count of connections in the list
  176.     end;
  177. (**************************************************************************
  178.  * Generic type defines for regions and instruments
  179.  *************************************************************************)
  180. type
  181.     PRGNRANGE = ^TRGNRANGE;
  182.     TRGNRANGE = record
  183.         usLow : Word;
  184.         usHigh: Word;
  185.     end;
  186. const
  187.     F_INSTRUMENT_DRUMS = $80000000;
  188. type
  189.     PMIDILOCALE = ^TMIDILOCALE;
  190.     TMIDILOCALE = record
  191.       ulBank      : DWORD;
  192.       ulInstrument: DWORD;
  193.     end;
  194. (**************************************************************************
  195.  * Header structures found in an DLS file for collection, instruments, and
  196.  * regions.
  197.  *************************************************************************)
  198. const
  199.     F_RGN_OPTION_SELFNONEXCLUSIVE = $0001;
  200. type
  201.     PRGNHEADER = ^TRGNHEADER;
  202.     TRGNHEADER = record
  203.       RangeKey     : TRGNRANGE; // Key range
  204.       RangeVelocity: TRGNRANGE; // Velocity Range
  205.       fusOptions   : Word;      // Synthesis options for this range
  206.       usKeyGroup   : Word;      // Key grouping for non simultaneous play
  207.                                 // 0 = no group, 1 up is group
  208.                                 // for Level 1 only groups 1-15 are allowed
  209.     end;
  210.     PINSTHEADER = ^TINSTHEADER;
  211.     TINSTHEADER = record
  212.       cRegions: DWORD;          // Count of regions in this instrument
  213.       Locale  : TMIDILOCALE;    // Intended MIDI locale of this instrument
  214.     end;
  215.     PDLSHEADER = ^TDLSHEADER;
  216.     TDLSHEADER = record
  217.       cInstruments: DWORD;      // Count of instruments in the collection
  218.     end;
  219. (*****************************************************************************
  220. * definitions for the Wave link structure
  221. *****************************************************************************)
  222. (*****  For level 1 only WAVELINK_CHANNEL_MONO is valid  ******************
  223.  * ulChannel allows for up to 32 channels of audio with each bit position
  224.  * specifiying a channel of playback
  225.  **************************************************************************)
  226. const
  227.    WAVELINK_CHANNEL_LEFT     = $0001;
  228.    WAVELINK_CHANNEL_RIGHT    = $0002;
  229.    F_WAVELINK_PHASE_MASTER   = $0001;
  230. type
  231.    PWAVELINK = ^TWAVELINK;
  232.    TWAVELINK = record       // any paths or links are stored right after struct
  233.       fusOptions  : WORD;   // options flags for this wave
  234.       usPhaseGroup: WORD;   // Phase grouping for locking channels
  235.       ulChannel   : DWORD;  // channel placement
  236.       ulTableIndex: DWORD;  // index into the wave pool table, 0 based
  237.    end;
  238. const
  239.    POOL_CUE_NULL   = $ffffffff;
  240. type
  241.    PPOOLCUE = ^TPOOLCUE;
  242.    TPOOLCUE = record
  243.       // ulEntryIndex: DWORD; // Index entry in the list
  244.       ulOffset: DWORD;        // Offset to the entry in the list
  245.    end;
  246.    PPOOLTABLE = ^TPOOLTABLE;
  247.    TPOOLTABLE = record
  248.      cbSize: DWORD;           // size of the pool table structure
  249.      cCues : DWORD;           // count of cues in the list
  250.    end;
  251. (*****************************************************************************
  252.  * Structures for the "wsmp" chunk
  253.  *****************************************************************************)
  254. const
  255.     F_WSMP_NO_TRUNCATION      = $0001;
  256.     F_WSMP_NO_COMPRESSION     = $0002;
  257. type
  258.    PWSMPL = ^TWSMPL;
  259.    TWSMPL = record
  260.      cbSize      : DWORD;
  261.      usUnityNote : Word;       // MIDI Unity Playback Note
  262.      sFineTune   : Smallint;   // Fine Tune in log tuning
  263.      lAttenuation: DWORD;      // Overall Attenuation to be applied to data
  264.      fulOptions  : DWORD;      // Flag options
  265.      cSampleLoops: DWORD;      // Count of Sample loops, 0 loops is one shot
  266.    end;
  267. (* This loop type is a normal forward playing loop which is continually *)
  268. (* played until the envelope reaches an off threshold in the release    *)
  269. (* portion of the volume envelope                                       *)
  270. const
  271.    WLOOP_TYPE_FORWARD   = 0;
  272. type
  273.    PWLOOP = ^TWLOOP;
  274.    TWLOOP = record
  275.      cbSize  : DWORD;
  276.      ulType  : DWORD;          // Loop Type
  277.      ulStart : DWORD;          // Start of loop in samples
  278.      ulLength: DWORD;          // Length of loop in samples
  279.    end;
  280. (************************************************************************
  281. *                                                                       *
  282. *   dmusicc.h -- This module defines the DirectMusic core API's         *
  283. *                                                                       *
  284. *   Copyright (c) 1998, Microsoft Corp. All rights reserved.            *
  285. *                                                                       *
  286. ************************************************************************)
  287. (* TODO: Diese Deklarationen sind nun in dmerror.h zu finden
  288. const
  289.     FACILITY_DIRECTMUSIC      = $878;    // Shared with DirectSound
  290.     DMUS_ERRBASE              = $1000;   // Make error codes human readable in hex
  291.     DMUS_S_ALREADY_DOWNLOADED        = $08781090;
  292.     DMUS_S_PARTIALLOAD               = $08781091;
  293.     DMUS_S_REQUEUE                   = $08781200;
  294.     DMUS_S_FREE                      = $08781201;
  295.     DMUS_S_END                       = $08781202;
  296.     DMUS_E_NO_DRIVER                 = $88781100;
  297.     DMUS_E_DRIVER_FAILED             = $88781101;
  298.     DMUS_E_PORTS_OPEN                = $88781102;
  299.     DMUS_E_DEVICE_IN_USE             = $88781103;
  300.     DMUS_E_INSUFFICIENTBUFFER        = $88781104;
  301.     DMUS_E_BUFFERNOTSET              = $88781105;
  302.     DMUS_E_BUFFERNOTAVAILABLE        = $88781106;
  303.     DMUS_E_NOTINITED                 = $88781107;
  304.     DMUS_E_NOTADLSCOL                = $88781108;
  305.     DMUS_E_INVALIDOFFSET             = $88781109;
  306.     DMUS_E_INVALIDID                 = $88781110;
  307.     DMUS_E_ALREADY_LOADED            = $88781111;
  308.     DMUS_E_INVALIDPOS                = $88781113;
  309.     DMUS_E_INVALIDPATCH              = $88781114;
  310.     DMUS_E_CANNOTSEEK                = $88781115;
  311.     DMUS_E_CANNOTWRITE               = $88781116;
  312.     DMUS_E_CHUNKNOTFOUND             = $88781117;
  313.     DMUS_E_INVALID_DOWNLOADID        = $88781119;
  314.     DMUS_E_NOT_DOWNLOADED_TO_PORT    = $88781120;
  315.     DMUS_E_ALREADY_DOWNLOADED        = $88781121;
  316.     DMUS_E_UNKNOWN_PROPERTY          = $88781122;
  317.     DMUS_E_SET_UNSUPPORTED           = $88781123;
  318.     DMUS_E_GET_UNSUPPORTED           = $88781124;
  319.     DMUS_E_NOTMONO                   = $88781125;
  320.     DMUS_E_BADARTICULATION           = $88781126;
  321.     DMUS_E_BADINSTRUMENT             = $88781127;
  322.     DMUS_E_BADWAVELINK               = $88781128;
  323.     DMUS_E_NOARTICULATION            = $88781129;
  324.     DMUS_E_NOTPCM                    = $8878112A;
  325.     DMUS_E_BADWAVE                   = $8878112B;
  326.     DMUS_E_BADOFFSETTABLE            = $8878112C;
  327.     DMUS_E_UNKNOWNDOWNLOAD           = $8878112D;
  328.     DMUS_E_NOSYNTHSINK               = $8878112E;
  329.     DMUS_E_ALREADYOPEN               = $8878112F;
  330.     DMUS_E_ALREADYCLOSED             = $88781130;
  331.     DMUS_E_SYNTHNOTCONFIGURED        = $88781131;
  332.     DMUS_E_SYNTHACTIVE               = $88781132;
  333.     DMUS_E_UNSUPPORTED_STREAM        = $88781150;
  334.     DMUS_E_ALREADY_INITED            = $88781151;
  335.     DMUS_E_INVALID_BAND              = $88781152;
  336.     DMUS_E_CANNOT_ADD_AFTER_INITED   = $88781153;
  337.     DMUS_E_NOT_INITED                = $88781154;
  338.     DMUS_E_TRACK_HDR_NOT_FIRST_CK    = $88781155;
  339.     DMUS_E_TOOL_HDR_NOT_FIRST_CK     = $88781156;
  340.     DMUS_E_INVALID_TRACK_HDR         = $88781157;
  341.     DMUS_E_INVALID_TOOL_HDR          = $88781158;
  342.     DMUS_E_ALL_TOOLS_FAILED          = $88781159;
  343.     DMUS_E_ALL_TRACKS_FAILED         = $88781160;
  344.     DMUS_E_NOT_FOUND                 = $88781161;
  345.     DMUS_E_NOT_INIT                  = $88781162;
  346.     DMUS_E_NO_MASTER_CLOCK           = $88781170;
  347.     DMUS_E_LOADER_NOCLASSID          = $88781180;
  348.     DMUS_E_LOADER_BADPATH            = $88781181;
  349.     DMUS_E_LOADER_FAILEDOPEN         = $88781182;
  350.     DMUS_E_LOADER_FORMATNOTSUPPORTED = $88781183;
  351.     *)
  352. const
  353.     DMUS_MAX_DESCRIPTION = 128;
  354.     DMUS_MAX_DRIVER = 128;
  355.     // For DMUS_PORTCAPS dwClass
  356.     DMUS_PC_INPUTCLASS       = 0;
  357.     DMUS_PC_OUTPUTCLASS      = 1;
  358.     // DMUS_EFFECT_ flags are used in the dwEffectFlags fields of both DMUS_PORTCAPS and DMUS_PORTPARAMS.
  359.     DMUS_EFFECT_NONE         = $00000000;
  360.     DMUS_EFFECT_REVERB       = $00000001;
  361.     DMUS_EFFECT_CHORUS       = $00000002;
  362.     // For DMUS_PORTCAPS dwFlags
  363.     DMUS_PC_DLS              = $00000001;
  364.     DMUS_PC_EXTERNAL         = $00000002;
  365.     DMUS_PC_SOFTWARESYNTH    = $00000004;
  366.     DMUS_PC_MEMORYSIZEFIXED  = $00000008;
  367.     DMUS_PC_GMINHARDWARE     = $00000010;
  368.     DMUS_PC_GSINHARDWARE     = $00000020;
  369.     DMUS_PC_XGINHARDWARE     = $00000040;
  370.     DMUS_PC_DIRECTSOUND      = $00000080;
  371.     DMUS_PC_SHAREABLE        = $00000100;
  372.     DMUS_PC_SYSTEMMEMORY     = $7FFFFFFF;
  373. type
  374.     PDMUS_BUFFERDESC = ^TDMUS_BUFFERDESC;
  375.     TDMUS_BUFFERDESC = record
  376.        dwSize: DWORD;
  377.        dwFlags: DWORD;
  378.        guidBufferFormat: TGUID;
  379.        cbBuffer: DWORD;
  380.     end;
  381.     PDMUS_PORTCAPS = ^TDMUS_PORTCAPS;
  382.     TDMUS_PORTCAPS = record
  383.        dwSize : DWORD;
  384.        dwFlags: DWORD;
  385.        guidPort: TGUID;
  386.        dwClass: DWORD;
  387.        dwType: DWORD;
  388.        dwMemorySize: DWORD;
  389.        dwMaxChannelGroups: DWORD;
  390.        dwMaxVoices: DWORD;
  391.        dwMaxAudioChannels: DWORD;
  392.        dwEffectFlags: DWORD;
  393.        wszDescription: array[0..DMUS_MAX_DESCRIPTION-1] of WCHAR;
  394.     end;
  395.     PDMUS_PORTPARAMS = ^TDMUS_PORTPARAMS;
  396.     TDMUS_PORTPARAMS = record
  397.        dwSize: DWORD;
  398.        dwValidParams: DWORD;
  399.        dwVoices: DWORD;
  400.        dwChannelGroups: DWORD;
  401.        dwAudioChannels: DWORD;
  402.        dwSampleRate: DWORD;
  403.        dwEffectFlags: DWORD;
  404.        fShare: BOOL;
  405.     end;
  406. const
  407.     // Values for DMUS_PORTCAPS dwType. This field indicates the underlying
  408.     //  driver type of the port.
  409.     DMUS_PORT_WINMM_DRIVER    = 0;
  410.     DMUS_PORT_USER_MODE_SYNTH = 1;
  411.     DMUS_PORT_KERNEL_MODE     = 2;
  412. (* These flags (set in dwValidParams) indicate which other members of the *)
  413. (* DMUS_PORTPARAMS are valid.                                             *)
  414. const
  415.     DMUS_PORTPARAMS_VOICES        = $00000001;
  416.     DMUS_PORTPARAMS_CHANNELGROUPS = $00000002;
  417.     DMUS_PORTPARAMS_AUDIOCHANNELS = $00000004;
  418.     DMUS_PORTPARAMS_SAMPLERATE    = $00000008;
  419.     DMUS_PORTPARAMS_EFFECTS       = $00000020;
  420.     DMUS_PORTPARAMS_SHARE         = $00000040;
  421. type
  422.     PDMUS_SYNTHSTATS = ^TDMUS_SYNTHSTATS;
  423.     TDMUS_SYNTHSTATS = record
  424.         dwSize       : DWORD;      // Size in bytes of the structure
  425.         dwValidStats : DWORD;      // Flags indicating which fields below are valid.
  426.         dwVoices     : DWORD;      // Average number of voices playing.
  427.         dwTotalCPU   : DWORD;      // Total CPU usage as percent * 100.
  428.         dwCPUPerVoice: DWORD;      // CPU per voice as percent * 100.
  429.         dwLostNotes  : DWORD;      // Number of notes lost in 1 second.
  430.         dwFreeMemory : DWORD;      // Free memory in bytes
  431.         lPeakVolume  : DWORD;      // Decibel level * 100.
  432.     end;
  433. const
  434.     DMUS_SYNTHSTATS_VOICES          = (1 shl 0);
  435.     DMUS_SYNTHSTATS_TOTAL_CPU       = (1 shl 1);
  436.     DMUS_SYNTHSTATS_CPU_PER_VOICE   = (1 shl 2);
  437.     DMUS_SYNTHSTATS_LOST_NOTES      = (1 shl 3);
  438.     DMUS_SYNTHSTATS_PEAK_VOLUME     = (1 shl 4);
  439.     DMUS_SYNTHSTATS_FREE_MEMORY     = (1 shl 5);
  440.     DMUS_SYNTHSTATS_SYSTEMMEMORY    = DMUS_PC_SYSTEMMEMORY;
  441. type
  442.     PDMUS_WAVES_REVERB_PARAMS = ^TDMUS_WAVES_REVERB_PARAMS;
  443.     TDMUS_WAVES_REVERB_PARAMS = record
  444.          fInGain: SINGLE;          // Input gain in dB (to avoid output overflows) */
  445.          fReverbMix: SINGLE;       // Reverb mix in dB. 0dB means 100% wet reverb (no direct signal)
  446.                                    // Negative values gives less wet signal.
  447.                                    // The coeficients are calculated so that the overall output level stays
  448.                                    // (approximately) constant regardless of the ammount of reverb mix. */
  449.          fReverbTime: SINGLE;      // The reverb decay time, in milliseconds. */
  450.          fHighFreqRTRatio: SINGLE; // The ratio of the high frequencies to the global reverb time.
  451.                                    // Unless very 'splashy-bright' reverbs are wanted, this should be set to
  452.                                    // a value < 1.0.
  453.                                    // For example if dRevTime==1000ms and dHighFreqRTRatio=0.1 than the
  454.                                    // decay time for high frequencies will be 100ms.*/
  455.     end;
  456. {  Note: Default values for Reverb are:
  457.     fInGain             = 0.0dB   (no change in level)
  458.     fReverbMix          = -10.0dB   (a reasonable reverb mix)
  459.     fReverbTime         = 1000.0ms (one second global reverb time)
  460.     fHighFreqRTRatio    = 0.001    (the ratio of the high frequencies to the global reverb time)
  461. }
  462. type
  463.     TDMUS_CLOCKTYPE = (DMUS_CLOCK_SYSTEM,DMUS_CLOCK_WAVE);
  464.     PDMUS_CLOCKINFO = ^TDMUS_CLOCKINFO;
  465.     TDMUS_CLOCKINFO = record
  466.        dwSize: DWORD;
  467.        ctType: TDMUS_CLOCKTYPE;
  468.        guidClock: TGUID;          // Identifies this time source
  469.        wszDescription: array[0..DMUS_MAX_DESCRIPTION-1] of WCHAR;
  470.     end;
  471. // TODO: ab hier scheint entfernt worden zu sein
  472.     PREFERENCE_TIME = ^TREFERENCE_TIME;
  473.     TREFERENCE_TIME = LONGLONG;
  474. const
  475.     DMUS_EVENTCLASS_CHANNELMSG = $00000000;
  476.     DMUS_EVENTCLASS_SYSEX      = $00000001;
  477. type
  478.     PCENT  = DWORD;   // Pitch cents
  479.     GCENT  = DWORD;   // Gain cents
  480.     TCENT  = DWORD;   // Time cents
  481.     PERCENT= DWORD;   // Per.. cent!
  482.     PDMUS_DOWNLOADINFO = ^TDMUS_DOWNLOADINFO;
  483.     TDMUS_DOWNLOADINFO = record
  484.         dwDLType: DWORD;
  485.         dwDLId: DWORD;
  486.         dwNumOffsetTableEntries: DWORD;
  487.         cbSizeData: DWORD;
  488.     end;
  489. const
  490.    DMUS_DOWNLOADINFO_INSTRUMENT    = 1;
  491.    DMUS_DOWNLOADINFO_WAVE          = 2;
  492.    DMUS_DEFAULT_SIZE_OFFSETTABLE   = 1;
  493.    // Flags for DMUS_INSTRUMENT's ulFlags member
  494.    DMUS_INSTRUMENT_GM_INSTRUMENT   = (1 shl 0);
  495. type
  496.    PDMUS_OFFSETTABLE = ^TDMUS_OFFSETTABLE;
  497.    TDMUS_OFFSETTABLE = record
  498.       ulOffsetTable: array[0..DMUS_DEFAULT_SIZE_OFFSETTABLE-1] of DWORD;
  499.    end;
  500.    PDMUS_INSTRUMENT = ^TDMUS_INSTRUMENT;
  501.    TDMUS_INSTRUMENT = record
  502.      ulPatch: DWORD;
  503.      ulFirstRegionIdx: DWORD;
  504.      ulGlobalArtIdx: DWORD;         // If zero the instrument does not have an articulation */
  505.      ulFirstExtCkIdx: DWORD;        // If zero no 3rd party entenstion chunks associated with the instrument */
  506.      ulCopyrightIdx: DWORD;         // If zero no Copyright information associated with the instrument */
  507.      ulFlags: DWORD;
  508.    end;
  509.    PDMUS_REGION = ^TDMUS_REGION;
  510.    TDMUS_REGION = record
  511.      RangeKey     : TRGNRANGE;
  512.      RangeVelocity: TRGNRANGE;
  513.      fusOptions   : WORD;
  514.      usKeyGroup   : WORD;
  515.      ulRegionArtIdx: DWORD;         // If zero the region does not have an articulation */
  516.      ulNextRegionIdx: DWORD;        // If zero no more regions */
  517.      ulFirstExtCkIdx: DWORD;        // If zero no 3rd party entenstion chunks associated with the region */
  518.      WaveLink: TWAVELINK;
  519.      WSMP: TWSMPL;                   //  If WSMP.cSampleLoops > 1 then a WLOOP is included */
  520.      WLOOP: TWLOOP;
  521.    end;
  522.    PDMUS_LFOPARAMS = ^TDMUS_LFOPARAMS;
  523.    TDMUS_LFOPARAMS = record
  524.      pcFrequency: PCENT;
  525.      tcDelay: TCENT;
  526.      gcVolumeScale: GCENT;
  527.      pcPitchScale: PCENT;
  528.      gcMWToVolume: GCENT;
  529.      pcMWToPitch: PCENT;
  530.    end;
  531.    PDMUS_VEGPARAMS = ^TDMUS_VEGPARAMS;
  532.    TDMUS_VEGPARAMS = record
  533.      tcAttack: TCENT;
  534.      tcDecay: TCENT;
  535.      ptSustain: PERCENT;
  536.      tcRelease: TCENT;
  537.      tcVel2Attack: TCENT;
  538.      tcKey2Decay: TCENT;
  539.    end;
  540.    PDMUS_PEGPARAMS = ^TDMUS_PEGPARAMS;
  541.    TDMUS_PEGPARAMS = record
  542.      tcAttack: TCENT;
  543.      tcDecay: TCENT;
  544.      ptSustain: PERCENT;
  545.      tcRelease: TCENT;
  546.      tcVel2Attack: TCENT;
  547.      tcKey2Decay: TCENT;
  548.      pcRange: PCENT;
  549.    end;
  550.    PDMUS_MSCPARAMS = ^TDMUS_MSCPARAMS;
  551.    TDMUS_MSCPARAMS = record
  552.      ptDefaultPan: PERCENT;
  553.    end;
  554.    PDMUS_ARTICPARAMS = ^TDMUS_ARTICPARAMS;
  555.    TDMUS_ARTICPARAMS = record
  556.       LFO    : TDMUS_LFOPARAMS;
  557.       VolEG  : TDMUS_VEGPARAMS;
  558.       PitchEG: TDMUS_PEGPARAMS;
  559.       Misc   : TDMUS_MSCPARAMS;
  560.    end;
  561.    PDMUS_ARTICULATION = ^TDMUS_ARTICULATION;
  562.    TDMUS_ARTICULATION = record
  563.       ulArt1Idx      : DWORD;     // If zero no DLS Level 1 articulation chunk */
  564.       ulFirstExtCkIdx: DWORD;     // If zero no 3rd party entenstion chunks associated with the articulation */
  565.    end;
  566. const
  567.    DMUS_MIN_DATA_SIZE = 4;
  568.    //  The actual number is determined by cbSize of struct _DMUS_EXTENSIONCHUNK
  569. type
  570.    PDMUS_EXTENSIONCHUNK = ^TDMUS_EXTENSIONCHUNK;
  571.    TDMUS_EXTENSIONCHUNK = record
  572.       cbSize        : DWORD;              //  Size of extension chunk  */
  573.       ulNextExtCkIdx: DWORD;              //  If zero no more 3rd party entenstion chunks */
  574.       ExtCkID       : FOURCC;
  575.       byExtCk: array[0..DMUS_MIN_DATA_SIZE-1] of byte;//  The actual number that follows is determined by cbSize */
  576.    end;
  577.    //  The actual number is determined by cbSize of struct _DMUS_COPYRIGHT */
  578.    PDMUS_COPYRIGHT = ^TDMUS_COPYRIGHT;
  579.    TDMUS_COPYRIGHT = record
  580.       cbSize: DWORD;                             //  Size of copyright information */
  581.       byCopyright: array[0..DMUS_MIN_DATA_SIZE-1] of Byte; //  The actual number that follows is determined by cbSize */
  582.    end;
  583.    PDMUS_WAVEDATA = ^TDMUS_WAVEDATA;
  584.    TDMUS_WAVEDATA = record
  585.       cbSize: DWORD;
  586.       byData: array[0..DMUS_MIN_DATA_SIZE-1] of Byte;
  587.    end;
  588.    PDMUS_WAVE = ^TDMUS_WAVE;
  589.    TDMUS_WAVE = record
  590.       ulFirstExtCkIdx: DWORD;    // If zero no 3rd party entenstion chunks associated with the wave */
  591.       ulCopyrightIdx : DWORD;    // If zero no Copyright information associated with the wave */
  592.       WaveformatEx   : TWaveFormatEx;
  593.       WaveData       : TDMUS_WAVEDATA;  // Wave data
  594.    end;
  595.    PDMUS_NOTERANGE = ^TDMUS_NOTERANGE;
  596.    TDMUS_NOTERANGE = record
  597.       dwLowNote  : DWORD; // Sets the low note for the range of MIDI note events to which the instrument responds.*/
  598.       dwHighNote : DWORD; // Sets the high note for the range of MIDI note events to which the instrument responds.*/
  599.    end;
  600. // Software synths are enumerated from under this registry key.
  601. const
  602.      REGSTR_PATH_DIRECTMUSIC    =  'SoftwareMicrosoftDirectMusic';
  603.      REGSTR_PATH_SOFTWARESYNTHS =  'SoftwareMicrosoftDirectMusicSoftwareSynths';
  604. type
  605.     IDirectMusicBuffer = interface;
  606.     IDirectMusicPort = interface;
  607. //    IDirectMusicThru = interface;
  608.     IReferenceClock = interface;
  609.     IDirectMusicSynth = interface;
  610.     IDirectMusicSynthSink = interface;
  611.     PIDirectMusic = ^IDirectMusic;
  612.     TFreeHandle = function(dw1,dw2: THANDLE): THANDLE;
  613.     IDirectMusicSynth = interface(IUnknown)
  614.        ['{f69b9165-bb60-11d1-afa6-00aa0024d8b6}']
  615.        function Open(var pPortParams: TDMUS_PORTPARAMS): HRESULT;  stdcall;
  616.        function Close: HRESULT; stdcall;
  617.        function SetNumChannelGroups(dwGroups: DWORD): HRESULT; stdcall;
  618.        function Download(var phDownload: THANDLE; pvData: Pointer; var pbFree: BOOL): HRESULT; stdcall;
  619.        function Unload(hDownload: THandle; lpFreeHandle: TFreeHandle; hUserData: THandle): HRESULT; stdcall;
  620.        function PlayBuffer(rt: TREFERENCE_TIME; pbBuffer: PByte; cbBuffer: DWORD): HRESULT; stdcall;
  621.        function GetRunningStats(var pStats: TDMUS_SYNTHSTATS): HRESULT; stdcall;
  622.        function GetPortCaps(var pCaps: TDMUS_PORTCAPS): HRESULT; stdcall;
  623.        function SetMasterClock(pClock: IReferenceClock): HRESULT; stdcall;
  624.        function GetLatencyClock(var pClock: IReferenceClock): HRESULT; stdcall;
  625.        function Activate(hWnd: HWND; fEnable: BOOL): HRESULT; stdcall;
  626.        function SetSynthSink(pSynthSink: IDirectMusicSynthSink): HRESULT; stdcall;
  627.        function Render(pBuffer: PChar; dwLength, dwPosition: DWORD): HRESULT; stdcall;
  628.     end;
  629.     IDirectMusicSynthSink = interface(IUnknown)
  630.        ['{d2ac2880-b39b-11d1-8704-00600893b1bd}']
  631.        function Init(pSynth: IDirectMusicSynth): HRESULT; stdcall;
  632.        function SetFormat(pWaveFormat: PWAVEFORMATEX): HRESULT; stdcall;
  633.        function SetMasterClock(pClock: IReferenceClock): HRESULT; stdcall;
  634.        function GetLatencyClock(var pClock: IReferenceClock): HRESULT; stdcall;
  635.        function Activate(hwnd: HWND; fEnable: BOOL): HRESULT; stdcall;
  636.        function SampleToRefTime(dwSampleTime: DWORD; var prfTime: TREFERENCE_TIME): HRESULT; stdcall;
  637.        function RefTimeToSample(rfTime: TREFERENCE_TIME; var pdwSampleTime: DWORD): HRESULT; stdcall;
  638.     end;
  639.     IDirectMusic = interface(IUnknown)
  640.        ['{d2ac2876-b39b-11d1-8704-00600893b1bd}']
  641.        function EnumPort(dwIndex: DWORD; var pPortCaps: TDMUS_PORTCAPS): HRESULT; stdcall;
  642.        function CreateMusicBuffer(pBufferDesc: PDMUS_BUFFERDESC;
  643.                                   var ppBuffer: IDIRECTMUSICBUFFER;
  644.                                   pUnkOuter: IUnknown): HRESULT; stdcall;
  645.        function CreatePort(const rguidPort: TGUID;
  646.                            const pPortParams: TDMUS_PORTPARAMS;
  647.                            var ppPort: IDIRECTMUSICPORT;
  648.                            pUnkOuter: IUnknown): HRESULT; stdcall;
  649.        function EnumMasterClock(dwIndex: DWORD; var lpClockInfo: TDMUS_CLOCKINFO): HRESULT; stdcall;
  650.        function GetMasterClock(var pguidClock: TGUID; var ppReferenceClock: IReferenceClock): HRESULT; stdcall;
  651.        function SetMasterClock(const rguidClock: TGUID): HRESULT; stdcall;
  652.        function Activate(fEnable: BOOL): HRESULT; stdcall;
  653.        function GetDefaultPort(var pguidPort: TGUID): HRESULT; stdcall;
  654.        function SetDirectSound(const pDirectSound: {LPDIRECTSOUND:} Pointer; hWnd: HWND): HRESULT; stdcall;
  655.     end;
  656.     IDirectMusicBuffer = interface(IUnknown)
  657.        ['{d2ac2878-b39b-11d1-8704-00600893b1bd}']
  658.        function Flush: HRESULT; stdcall;
  659.        function TotalTime(var prtTime: TREFERENCE_TIME): HRESULT; stdcall;
  660.        function PackStructured(rt: TREFERENCE_TIME; dwChannelGroup,dwChannelMessage: DWORD): HRESULT; stdcall;
  661.        function PackUnstructured(rt: TREFERENCE_TIME;dwChannelGroup,cd: DWORD; lpb: PBYTE): HRESULT; stdcall;
  662.        function ResetReadPtr: HRESULT; stdcall;
  663.        function GetNextEvent(var prt: TREFERENCE_TIME;var pdwChannelGroup,pdwLength: DWORD;
  664.                              var ppData: PByte): HRESULT; stdcall;
  665.        function GetRawBufferPtr(var ppData: PByte): HRESULT; stdcall;
  666.        function GetStartTime(var prt: TREFERENCE_TIME): HRESULT; stdcall;
  667.        function GetUsedBytes(var pcb: DWORD): HRESULT; stdcall;
  668.        function GetMaxBytes(var pcb: DWORD): HRESULT; stdcall;
  669.        function GetBufferFormat(var pGuidFormat: TGUID): HRESULT; stdcall;
  670.        function SetStartTime(rt: TREFERENCE_TIME): HRESULT; stdcall;
  671.        function SetUsedBytes(cb: DWORD): HRESULT; stdcall;
  672.     end;
  673.     IDirectMusicInstrument = interface(IUnknown)
  674.        ['{d2ac287d-b39b-11d1-8704-00600893b1bd}']
  675.        function GetPatch(var pdwPatch: DWORD): HRESULT; stdcall;
  676.        function SetPatch(dwPatch: DWORD): HRESULT; stdcall;
  677.     end;
  678.     IDirectMusicDownloadedInstrument = interface(IUnknown)
  679.        ['{d2ac287e-b39b-11d1-8704-00600893b1bd}']
  680.        // None at this time */
  681.     end;
  682.     IDirectMusicCollection = interface(IUnknown)
  683.        ['{d2ac287c-b39b-11d1-8704-00600893b1bd}']
  684.        function GetInstrument(dwPatch: DWORD;
  685.                               var ppInstrument: IDirectMusicInstrument): HRESULT; stdcall;
  686.        function EnumInstrument(dwIndex: DWORD; var pdwPatch: DWORD; pwszName: PWCHAR; dwNameLen: DWORD): HRESULT; stdcall;
  687.     end;
  688.     IDirectMusicDownload = interface(IUnknown)
  689.        ['{d2ac287b-b39b-11d1-8704-00600893b1bd}']
  690.        function GetBuffer(var ppvBuffer: Pointer;var pdwSize: DWORD): HRESULT; stdcall;
  691.     end;
  692.     IDirectMusicPortDownload = interface(IUnknown)
  693.        ['{d2ac287a-b39b-11d1-8704-00600893b1bd}']
  694.        function GetBuffer(dwDLId: DWORD; var ppIDMDownload: IDirectMusicDownload): HRESULT; stdcall;
  695.        function AllocateBuffer(dwSize: DWORD; var ppIDMDownload: IDirectMusicDownload): HRESULT; stdcall;
  696.        function GetDLId(var pdwStartDLId: DWORD; dwCount: DWORD): HRESULT; stdcall;
  697.        function GetAppend(var pdwAppend: DWORD): HRESULT; stdcall;
  698.        function Download(pIDMDownloads: IDirectMusicDownload): HRESULT; stdcall;
  699.        function Unload(pIDMDownload: IDirectMusicDownload): HRESULT; stdcall;
  700.     end;
  701.     IDirectMusicPort = interface(IUnknown)
  702.        ['{55e2edd8-cd7c-11d1-a76f-0000f875ac12}']
  703.        function PlayBuffer(const pBuffer: IDIRECTMUSICBUFFER): HRESULT; stdcall;
  704.        function SetReadNotificationHandle(hEvent: THANDLE): HRESULT; stdcall;
  705.        function Read(var pBuffer: IDIRECTMUSICBUFFER): HRESULT; stdcall;
  706.        function DownloadInstrument(pInstrument: IDirectMusicInstrument;
  707.                                    var ppDownloadedInstrument: IDirectMusicDownloadedInstrument;
  708.                                    pNoteRanges: PDMUS_NOTERANGE; dwNumNoteRanges: DWORD): HRESULT; stdcall;
  709.        function UnloadInstrument(pDownloadedInstrument: IDirectMusicDownloadedInstrument): HRESULT; stdcall;
  710.        function GetLatencyClock(var ppClock: IReferenceClock): HRESULT; stdcall;
  711.        function GetRunningStats(var pStats: TDMUS_SYNTHSTATS): HRESULT; stdcall;
  712.        function Compact: HRESULT; stdcall;
  713.        function GetCaps(var pPortCaps: TDMUS_PORTCAPS): HRESULT; stdcall;
  714.        function DeviceIoControl(dwIoControlCode: DWORD; lpInBuffer: Pointer; nInBufferSize: DWORD;
  715.                                 lpOutBuffer: Pointer; nOutBufferSize: DWORD;
  716.                                 var lpBytesReturned: DWORD;
  717.                                 var lpOverlapped: TOVERLAPPED): HRESULT; stdcall;
  718.        function SetNumChannelGroups(dwChannelGroups: DWORD): HRESULT; stdcall;
  719.        function GetNumChannelGroups(var pdwChannelGroups: DWORD): HRESULT; stdcall;
  720.        function Activate(fActive: BOOL): HRESULT; stdcall;
  721.        function SetChannelPriority(dwChannelGroup, dwChannel, dwPriority: DWORd): HRESULT; stdcall;
  722.        function GetChannelPriority(dwChannelGroup, dwChannel: DWORD; var pdwPriority: DWORD): HRESULT; stdcall;
  723.        function SetDirectSound(pDirectSound:{LPDIRECTSOUND} Pointer; pDirectSoundBuffer: {LPDIRECTSOUNDBUFFER} Pointer): HRESULT; stdcall;
  724.        function GetFormat(pWaveFormatEx: PWAVEFORMATEX; var pdwWaveFormatExSize,pdwBufferSize: DWORd): HRESULT; stdcall;
  725.     end;
  726.     IReferenceClock = interface(IUnknown)
  727.        ['{56a86897-0ad4-11ce-b03a-0020af0ba770}']
  728.        function GetTime(var pTime: TREFERENCE_TIME): HRESULT; stdcall;
  729.        //  ask for an async notification that a time has elapsed */
  730.        function AdviseTime(baseTime: TREFERENCE_TIME;      //  base time */
  731.                            streamTime: TREFERENCE_TIME;    //  stream offset time */
  732.                            hEvent: Thandle;                //  advise via this event */
  733.                            var pdwAdviseCookie: DWORD      //  where your cookie goes */
  734.                            ): HRESULT; stdcall;
  735.        //  ask for an async periodic notification that a time has elapsed */
  736.        function AdvisePeriodic(startTime: TREFERENCE_TIME; //  starting at this time */
  737.                                periodTime: TREFERENCE_TIME;//  time between notifications */
  738.                                hSemaphore: Thandle;        //  advise via a semaphore */
  739.                                var pdwAdviseCookie: DWORD  //  where your cookie goes */
  740.                                ): HRESULT; stdcall;
  741.        //  cancel a request for notification */
  742.        function Unadvise(dwAdviseCookie: DWORD): HRESULT; stdcall;
  743.     end;
  744. const
  745.     IID_IKsControl : TGUID =
  746.         (D1:$28F54685;D2:$06FD;D3:$11D2;D4:($B2,$7A,$00,$A0,$C9,$22,$31,$96));
  747.     IID_IReferenceClock : TGUID =
  748.         (D1:$56a86897;D2:$0ad4;D3:$11ce;D4:($b0,$3a,$00,$20,$af,$0b,$a7,$70));
  749.     CLSID_DirectMusic : TGUID =
  750.         (D1:$636b9f10;D2:$0c7d;D3:$11d1;D4:($95,$b2,$00,$20,$af,$dc,$74,$21));
  751.     CLSID_DirectMusicCollection : TGUID =
  752.         (D1:$480ff4b0;D2:$28b2;D3:$11d1;D4:($be,$f7,$00,$c0,$4f,$bf,$8f,$ef));
  753.     CLSID_DirectMusicSynth : TGUID =
  754.         (D1:$58C2B4D0;D2:$46E7;D3:$11D1;D4:($89,$AC,$00,$A0,$C9,$05,$41,$29));
  755.     CLSID_DirectMusicSynthSink : TGUID =
  756.         (D1:$aec17ce3;D2:$a514;D3:$11d1;D4:($af,$a6,$00,$aa,$00,$24,$d8,$b6));
  757.     IID_IDirectMusic : TGUID =
  758.         //(D1:$d2ac2876;D2:$b39b;D3:$11d1;D4:($87,$04,$00,$60,$08,$93,$b1,$bd));
  759.         (D1:$6536115a;D2:$7b2d;D3:$11d2;D4:($ba,$18,$00,$00,$f8,$75,$ac,$12));
  760.     IID_IDirectMusicBuffer : TGUID =
  761.         (D1:$d2ac2878;D2:$b39b;D3:$11d1;D4:($87,$04,$00,$60,$08,$93,$b1,$bd));
  762.     IID_IDirectMusicPort : TGUID =
  763.         (D1:$08f2d8c9;D2:$37c2;D3:$11d2;D4:($b9,$f9,$00,$00,$f8,$75,$ac,$12));
  764.     IID_IDirectMusicPortDownload : TGUID =
  765.         (D1:$d2ac287a;D2:$b39b;D3:$11d1;D4:($87,$04,$00,$60,$8,$93,$b1,$bd));
  766.     IID_IDirectMusicDownload : TGUID =
  767.         (D1:$d2ac287b;D2:$b39b;D3:$11d1;D4:($87,$04,$00,$60,$08,$93,$b1,$bd));
  768.     IID_IDirectMusicCollection : TGUID =
  769.         (D1:$d2ac287c;D2:$b39b;D3:$11d1;D4:($87,$04,$00,$60,$08,$93,$b1,$bd));
  770.     IID_IDirectMusicInstrument : TGUID =
  771.         (D1:$d2ac287d;D2:$b39b;D3:$11d1;D4:($87,$04,$00,$60,$08,$93,$b1,$bd));
  772.     IID_IDirectMusicDownloadedInstrument : TGUID =
  773.         (D1:$d2ac287e;D2:$b39b;D3:$11d1;D4:($87,$04,$00,$60,$08,$93,$b1,$bd));
  774.     IID_IDirectMusicSynth : TGUID =
  775.         (D1:$f69b9165;D2:$bb60;D3:$11d1;D4:($af,$a6,$00,$aa,$00,$24,$d8,$b6));
  776.     IID_IDirectMusicSynthSink : TGUID =
  777.         (D1:$d2ac2880;D2:$b39b;D3:$11d1;D4:($87,$04,$00,$60,$08,$93,$b1,$bd));
  778. (* Property Query GUID_DMUS_PROP_GM_Hardware
  779.  * Property Query GUID_DMUS_PROP_GS_Hardware
  780.  * Property Query GUID_DMUS_PROP_XG_Hardware
  781.  * Property Query GUID_DMUS_PROP_DLS1_Hardware
  782.  * Property Query GUID_DMUS_PROP_SynthSink_DSOUND
  783.  * Property Query GUID_DMUS_PROP_SynthSink_WAVE
  784.  *
  785.  * Item 0: Supported
  786.  * Returns a DWORD which is non-zero if the feature is supported
  787.  *)
  788.     GUID_DMUS_PROP_GM_Hardware : TGUID =
  789.         (D1:$178f2f24;D2:$c364;D3:$11d1;D4:($a7,$60,$00,$00,$f8,$75,$ac,$12));
  790.     GUID_DMUS_PROP_GS_Hardware : TGUID =
  791.         (D1:$178f2f25;D2:$c364;D3:$11d1;D4:($a7,$60,$00,$00,$f8,$75,$ac,$12));
  792.     GUID_DMUS_PROP_XG_Hardware : TGUID =
  793.         (D1:$178f2f26;D2:$c364;D3:$11d1;D4:($a7,$60,$00,$00,$f8,$75,$ac,$12));
  794.     GUID_DMUS_PROP_DLS1 : TGUID =
  795.         (D1:$178f2f27;D2:$c364;D3:$11d1;D4:($a7,$60,$00,$00,$f8,$75,$ac,$12));
  796.     GUID_DMUS_PROP_SynthSink_DSOUND : TGUID =
  797.         (D1:$aa97844;D2:$c877;D3:$11d1;D4:($87,$c,$0,$60,$8,$93,$b1,$bd));
  798.     GUID_DMUS_PROP_SynthSink_WAVE : TGUID =
  799.         (D1:$aa97845;D2:$c877;D3:$11d1;D4:($87,$c,$0,$60,$8,$93,$b1,$bd));
  800. (* Property Get GUID_DMUS_PROP_MemorySize
  801.  *
  802.  * Item 0: Memory size
  803.  * Returns a DWORD containing the total number of bytes of sample RAM
  804.  *)
  805.     GUID_DMUS_PROP_MemorySize : TGUID =
  806.         (D1:$178f2f28;D2:$c364;D3:$11d1;D4:($a7,$60,$00,$00,$f8,$75,$ac,$12));
  807. (* Property Set GUID_DMUS_PROP_SetDSound
  808.  *
  809.  * Item 0: IDirectSound class
  810.  * Sets the IDirectMusicSynthSink to use the specified DSound object.
  811.  *)
  812.     GUID_DMUS_PROP_SetDSound : TGUID =
  813.         (D1:$aa97842;D2:$c877;D3:$11d1;D4:($87,$c,$0,$60,$8,$93,$b1,$bd));
  814. (* Property Set GUID_DMUS_PROP_WriteBufferZone
  815.  *
  816.  * Item 0: Distance in milliseconds from the write pointer to the synth write.
  817.  * Sets the IDirectMusicSynthSink to write this far behind the pointer.
  818.  *)
  819.     GUID_DMUS_PROP_WriteBufferZone : TGUID =
  820.         (D1:$aa97843;D2:$c877;D3:$11d1;D4:($87,$c,$0,$60,$8,$93,$b1,$bd));
  821. (* Property Set GUID_DMUS_PROP_LegacyCaps
  822.  *
  823.  * Item 0: The MIDINCAPS or MIDIOUTCAPS which describes the port's underlying WinMM device. This property is only supported
  824.  * by ports which wrap WinMM devices.
  825.  *)
  826.      GUID_DMUS_PROP_LegacyCaps :TGUID =
  827.         (D1:$cfa7cdc2;D2:$00a1;D3:$11d2;D4:($aa,$d5,$00,$00,$f8,$75,$ac,$12));
  828. (************************************************************************
  829. *                                                                       *
  830. *   dmusici.h -- This module defines the DirectMusic interative API's   *
  831. *                                                                       *
  832. *   Copyright (c) 1998, Microsoft Corp. All rights reserved.            *
  833. *                                                                       *
  834. ************************************************************************)
  835. type
  836.     TTRANSITION_TYPE = WORD;
  837.     TMUSIC_TIME      = DWORD;
  838. const
  839.     DMUS_PPQ        = 768;     // parts per quarter note
  840. const
  841.     DMUS_COMPOSEF_NONE              = 0;
  842.     DMUS_COMPOSEF_ALIGN             = $1;
  843.     DMUS_COMPOSEF_OVERLAP           = $2;
  844.     DMUS_COMPOSEF_IMMEDIATE         = $4;
  845.     DMUS_COMPOSEF_GRID              = $8;
  846.     DMUS_COMPOSEF_BEAT              = $10;
  847.     DMUS_COMPOSEF_MEASURE           = $20;
  848.     DMUS_COMPOSEF_AFTERPREPARETIME  = $40;
  849.     DMUS_COMPOSEF_MODULATE          = $1000;
  850.     DMUS_COMPOSEF_LONG              = $2000;
  851. (* DMUS_PMSGF_FLAGS fill the DMUS_PMSG's dwFlags member *)
  852. const
  853.     DMUS_PMSGF_REFTIME          = 1;      // if rtTime is valid
  854.     DMUS_PMSGF_MUSICTIME        = 2;      // if mtTime is valid
  855.     DMUS_PMSGF_TOOL_IMMEDIATE   = 4;      // if PMSG should be processed immediately
  856.     DMUS_PMSGF_TOOL_QUEUE       = 8;      // if PMSG should be processed a little early, at Queue time
  857.     DMUS_PMSGF_TOOL_ATTIME      = 16;     // if PMSG should be processed at the time stamp
  858.     DMUS_PMSGF_TOOL_FLUSH       = 32;     // if PMSG is being flushed
  859. (* DMUS_PMSGT_TYPES fill the DMUS_PMSG's dwType member *)
  860. const
  861.     DMUS_PMSGT_MIDI             = 0;      // MIDI short message
  862.     DMUS_PMSGT_NOTE             = 1;      // Interactive Music Note
  863.     DMUS_PMSGT_SYSEX            = 2;      // MIDI long message (system exclusive message)
  864.     DMUS_PMSGT_NOTIFICATION     = 3;      // Notification message
  865.     DMUS_PMSGT_TEMPO            = 4;      // Tempo message
  866.     DMUS_PMSGT_CURVE            = 5;      // Control change / pitch bend, etc. curve
  867.     DMUS_PMSGT_TIMESIG          = 6;      // Time signature
  868.     DMUS_PMSGT_PATCH            = 7;      // Patch changes
  869.     DMUS_PMSGT_TRANSPOSE        = 8;      // Transposition messages
  870.     DMUS_PMSGT_USER             = 255;    // User message
  871. (* DMUS_SEGF_FLAGS correspond to IDirectMusicPerformance::PlaySegment, and other API *)
  872. const
  873.     DMUS_SEGF_AFTERQUEUETIME    = 1;      // play after the queue time (See IDirectMusicPerformance::GetQueueTime)
  874.     DMUS_SEGF_AFTERPREPARETIME  = 2;      // play after the prepare time (See IDirectMusicPerformance::GetPrepareTime)
  875.     DMUS_SEGF_GRID              = 4;      // play on grid boundary
  876.     DMUS_SEGF_BEAT              = 8;      // play on beat boundary
  877.     DMUS_SEGF_MEASURE           = 16;     // play on measure boundary
  878.     DMUS_SEGF_DEFAULT           = 32;     // use segment's default boundary
  879.     DMUS_SEGF_REFTIME           = 64;     // time parameter is in reference time
  880.     DMUS_SEGF_SECONDARY         = 128;    // secondary segment
  881.     DMUS_SEGF_QUEUE             = 256;    // queue at the end of the primary segment queue (primary only)
  882.     DMUS_SEGF_CONTROL           = 512;    // play as a control track (secondary segments only)
  883. (* The following flags are sent in the IDirectMusicTrack::Play() method *)
  884. (* inside the dwFlags parameter                                         *)
  885. const
  886.     DMUS_TRACKF_SEEK            = 1;      // set on a seek
  887.     DMUS_TRACKF_LOOP            = 2;      // set on a loop (repeat)
  888.     DMUS_TRACKF_START           = 4;      // set on first call to Play
  889.     DMUS_TRACKF_FLUSH           = 8;      // set when this call is in response to a flush on the perfomance
  890.     DMUS_MAXSUBCHORD = 8;
  891.     DMUS_NOTEF_NOTEON = 1;     // Set if this is a MIDI Note On. Otherwise, it is MIDI Note Off
  892. const
  893.     DMUS_TEMPO_MAX = 350;
  894.     DMUS_TEMPO_MIN = 10;
  895.     DMUS_MASTERTEMPO_MAX  = 2.0;
  896.     DMUS_MASTERTEMPO_MIN  = 0.25;
  897.     DMUS_MASTERVOLUME_MAX = 6;
  898.     DMUS_MASTERVOLUME_MIN = -100;
  899. const
  900.     (* Curve shapes *)
  901.     DMUS_CURVES_LINEAR  = 0;
  902.     DMUS_CURVES_INSTANT = 1;
  903.     DMUS_CURVES_EXP     = 2;
  904.     DMUS_CURVES_LOG     = 3;
  905.     DMUS_CURVES_SINE    = 4;
  906.     (* curve types *)
  907.     DMUS_CURVET_PBCURVE  = $03;
  908.     DMUS_CURVET_CCCURVE  = $04;
  909.     DMUS_CURVET_MATCURVE = $05;
  910.     DMUS_CURVET_PATCURVE = $06;
  911. (* notification type values                              *)
  912. (* The following correspond to GUID_NOTIFICATION_SEGMENT *)
  913. const
  914.     DMUS_NOTIFICATION_SEGSTART      = 0;
  915.     DMUS_NOTIFICATION_SEGEND        = 1;
  916.     DMUS_NOTIFICATION_SEGALMOSTEND  = 2;
  917.     DMUS_NOTIFICATION_MUSICSTOPPED  = 3;
  918.     DMUS_NOTIFICATION_SEGLOOP       = 4;
  919.     // The following corresponds to GUID_NOTIFICATION_MEASUREANDBEAT
  920.     DMUS_NOTIFICATION_MEASUREBEAT   = 0;
  921.     // The following corresponds to GUID_NOTIFICATION_CHORD
  922.     DMUS_NOTIFICATION_CHORD         = 0;
  923.     // The following correspond to GUID_NOTIFICATION_COMMAND
  924.     DMUS_NOTIFICATION_GROOVE        = 0;
  925.     DMUS_NOTIFICATION_EMBELLISHMENT = 1;
  926. const
  927.     DMUS_MAX_NAME       = 64;       // Maximum object name length.
  928.     DMUS_MAX_CATEGORY   = 64;       // Maximum object category name length.
  929.     DMUS_MAX_FILENAME   = MAX_PATH;
  930.     (* Flags for dwValidData. When set, a flag indicates that the  *)
  931.     (* corresponding field in DMUSOBJECTDESC holds valid data.     *)
  932. const
  933.     DMUS_OBJ_OBJECT       =  (1 shl 0);     // Object GUID is valid.
  934.     DMUS_OBJ_CLASS        =  (1 shl 1);     // Class GUID is valid.
  935.     DMUS_OBJ_NAME         =  (1 shl 2);     // Name is valid.
  936.     DMUS_OBJ_CATEGORY     =  (1 shl 3);     // Category is valid.
  937.     DMUS_OBJ_FILENAME     =  (1 shl 4);     // File path is valid.
  938.     DMUS_OBJ_FULLPATH     =  (1 shl 5);     // Path is full path.
  939.     DMUS_OBJ_URL          =  (1 shl 6);     // Path is URL.
  940.     DMUS_OBJ_VERSION      =  (1 shl 7);     // Version is valid.
  941.     DMUS_OBJ_DATE         =  (1 shl 8);     // Date is valid.
  942.     DMUS_OBJ_LOADED       =  (1 shl 9);     // Object is currently loaded in memory.
  943.     DMUS_OBJ_MEMORY       =  (1 shl 10);    // Object is pointed to by pbMemData.
  944. const
  945.     DMUSB_LOADED  =  (1 shl 0);       // Set when band has been loaded
  946.     DMUSB_DEFAULT =  (1 shl 1);       // Set when band is default band for a style
  947. type
  948.     IDirectMusicTrack = interface;
  949.     IDirectMusicPerformance = interface;
  950.     IDirectMusicTool = interface;
  951.     IDirectMusicSegment = interface;
  952.     IDirectMusicSegmentState = interface;
  953.     IDirectMusicGraph = interface;
  954.     IDirectMusicBand = interface;
  955.     IDirectMusicChordMap = interface;
  956.     IDirectMusicLoader = interface;
  957.     IDirectMusicObject = interface;
  958.     PIDirectMusicSegmentState = ^IDirectMusicSegmentState;
  959.     TDMUS_COMMANDT_TYPES = (DMUS_COMMANDT_GROOVE,
  960.                             DMUS_COMMANDT_FILL,
  961.                             DMUS_COMMANDT_INTRO,
  962.                             DMUS_COMMANDT_BREAK,
  963.                             DMUS_COMMANDT_END,
  964.                             DMUS_COMMANDT_ENDANDINTRO);
  965.     TDMUS_SHAPET_TYPES   = (DMUS_SHAPET_FALLING,
  966.                             DMUS_SHAPET_LEVEL,
  967.                             DMUS_SHAPET_LOOPABLE,
  968.                             DMUS_SHAPET_LOUD,
  969.                             DMUS_SHAPET_QUIET,
  970.                             DMUS_SHAPET_PEAKING,
  971.                             DMUS_SHAPET_RANDOM,
  972.                             DMUS_SHAPET_RISING,
  973.                             DMUS_SHAPET_SONG);
  974.    (* every DMUS_PMSG is based off of this structure. The Performance needs    *)
  975.    (* to access these members consistently in every PMSG that goes through it. *)
  976.    PDMUS_PMSG = ^TDMUS_PMSG;
  977.    TDMUS_PMSG = packed record
  978.      dwSize: DWORD;
  979.      rtTime: TREFERENCE_TIME;   // real time (in 100 nanosecond increments)
  980.      mtTime: TMUSIC_TIME;       // music time
  981.      dwFlags: DWORD;            // various bits (see DMUS_PMSG_FLAGS enumeration)
  982.      dwPChannel: DWORD;         // Performance Channel. The Performance can
  983.                                 // use this to determine the port/channel.
  984.      dwVirtualTrackID: DWORD;   // virtual track ID
  985.      pTool: IDirectMusicTool;   // tool class pointer
  986.      pGraph: IDirectMusicGraph; // tool graph class pointer
  987.      dwType: DWORD;             // PMSG type (see DMUS_PM_TYPE defines)
  988.      punkUser: IUnknown;        // user com pointer, auto released upon PMSG free
  989.    end;
  990.     (* DMUS_NOTE_PMSG *)
  991.     PDMUS_NOTE_PMSG = ^TDMUS_NOTE_PMSG;
  992.     TDMUS_NOTE_PMSG = packed record
  993.       dwSize: DWORD;
  994.       rtTime: TREFERENCE_TIME;   // real time (in 100 nanosecond increments)
  995.       mtTime: TMUSIC_TIME;       // music time
  996.       dwFlags: DWORD;            // various bits (see DMUS_PMSG_FLAGS enumeration)
  997.       dwPChannel: DWORD;         // Performance Channel. The Performance can
  998.                                  // use this to determine the port/channel.
  999.       dwVirtualTrackID: DWORD;   // virtual track ID
  1000.       pTool: IDirectMusicTool;   // tool class pointer
  1001.       pGraph: IDirectMusicGraph; // tool graph class pointer
  1002.       dwType: DWORD;             // PMSG type (see DMUS_PM_TYPE defines)
  1003.       punkUser: IUnknown;        // user com pointer, auto released upon PMSG free
  1004.       mtDuration: TMUSIC_TIME;   // duration
  1005.       wMusicValue: WORD;         // Description of note in chord and key.
  1006.       wMeasure: WORD;            // Measure in which this note occurs
  1007.       nOffset: Smallint;         // Offset from grid at which this note occurs
  1008.       bBeat: BYTE;               // Beat (in measure) at which this note occurs
  1009.       bGrid: BYTE;               // Grid offset from beat at which this note occurs
  1010.       bVelocity: BYTE;           // Note velocity
  1011.       bFlags: BYTE;              // see DMUS_NOTE_FLAGS
  1012.       bTimeRange: BYTE;          // Range to randomize time.
  1013.       bDurRange: BYTE;           // Range to randomize duration.
  1014.       bVelRange: BYTE;           // Range to randomize velocity.
  1015.       bInversionID: BYTE;        // Identifies inversion group to which this note belongs
  1016.       bPlayModeFlags: BYTE;      // Play mode
  1017.       bMidiValue: BYTE;          // The MIDI note value, converted from wMusicValue
  1018.     end;
  1019.     (* DMUS_MIDI_PMSG *)
  1020.     PDMUS_MIDI_PMSG = ^TDMUS_MIDI_PMSG;
  1021.     TDMUS_MIDI_PMSG = packed record
  1022.        dwSize: DWORD;
  1023.        rtTime: TREFERENCE_TIME;   // real time (in 100 nanosecond increments)
  1024.        mtTime: TMUSIC_TIME;       // music time
  1025.        dwFlags: DWORD;            // various bits (see DMUS_PMSG_FLAGS enumeration)
  1026.        dwPChannel: DWORD;         // Performance Channel. The Performance can
  1027.                                   // use this to determine the port/channel.
  1028.        dwVirtualTrackID: DWORD;   // virtual track ID
  1029.        pTool: IDirectMusicTool;   // tool class pointer
  1030.        pGraph: IDirectMusicGraph; // tool graph class pointer
  1031.        dwType: DWORD;             // PMSG type (see DMUS_PM_TYPE defines)
  1032.        punkUser: IUnknown;        // user com pointer, auto released upon PMSG free
  1033.        bStatus: BYTE;
  1034.        bByte1: BYTE;
  1035.        bByte2: BYTE;
  1036.        bPad: BYTE;
  1037.     end;
  1038.     (* DMUS_PATCH_PMSG *)
  1039.     PDMUS_PATCH_PMSG = ^TDMUS_PATCH_PMSG;
  1040.     TDMUS_PATCH_PMSG = packed record
  1041.        dwSize: DWORD;
  1042.        rtTime: TREFERENCE_TIME;   // real time (in 100 nanosecond increments)
  1043.        mtTime: TMUSIC_TIME;       // music time
  1044.        dwFlags: DWORD;            // various bits (see DMUS_PMSG_FLAGS enumeration)
  1045.        dwPChannel: DWORD;         // Performance Channel. The Performance can
  1046.                                   // use this to determine the port/channel.
  1047.        dwVirtualTrackID: DWORD;   // virtual track ID
  1048.        pTool: IDirectMusicTool;   // tool class pointer
  1049.        pGraph: IDirectMusicGraph; // tool graph class pointer
  1050.        dwType: DWORD;             // PMSG type (see DMUS_PM_TYPE defines)
  1051.        punkUser: IUnknown;        // user com pointer, auto released upon PMSG free
  1052.        byInstrument: BYTE;
  1053.        byMSB: BYTE;
  1054.        byLSB: BYTE;
  1055.        byPad: BYTE;
  1056.        dwGroup: DWORD;
  1057.        dwMChannel: DWORD;
  1058.     end;
  1059.     (* DMUS_TRANSPOSE_PMSG *)
  1060.     PDMUS_TRANSPOSE_PMSG = ^TDMUS_TRANSPOSE_PMSG;
  1061.     TDMUS_TRANSPOSE_PMSG = packed record
  1062.        dwSize: DWORD;
  1063.        rtTime: TREFERENCE_TIME;   // real time (in 100 nanosecond increments)
  1064.        mtTime: TMUSIC_TIME;       // music time
  1065.        dwFlags: DWORD;            // various bits (see DMUS_PMSG_FLAGS enumeration)
  1066.        dwPChannel: DWORD;         // Performance Channel. The Performance can
  1067.                                   // use this to determine the port/channel.
  1068.        dwVirtualTrackID: DWORD;   // virtual track ID
  1069.        pTool: IDirectMusicTool;   // tool class pointer
  1070.        pGraph: IDirectMusicGraph; // tool graph class pointer
  1071.        dwType: DWORD;             // PMSG type (see DMUS_PM_TYPE defines)
  1072.        punkUser: IUnknown;        // user com pointer, auto released upon PMSG free
  1073.        nTranspose: Smallint;
  1074.     end;
  1075.     (* DMUS_TEMPO_PMSG *)
  1076.     PDMUS_TEMPO_PMSG = ^TDMUS_TEMPO_PMSG;
  1077.     TDMUS_TEMPO_PMSG = packed record
  1078.        dwSize: DWORD;
  1079.        rtTime: TREFERENCE_TIME;   // real time (in 100 nanosecond increments)
  1080.        mtTime: TMUSIC_TIME;       // music time
  1081.        dwFlags: DWORD;            // various bits (see DMUS_PMSG_FLAGS enumeration)
  1082.        dwPChannel: DWORD;         // Performance Channel. The Performance can
  1083.                                   // use this to determine the port/channel.
  1084.        dwVirtualTrackID: DWORD;   // virtual track ID
  1085.        pTool: IDirectMusicTool;   // tool class pointer
  1086.        pGraph: IDirectMusicGraph; // tool graph class pointer
  1087.        dwType: DWORD;             // PMSG type (see DMUS_PM_TYPE defines)
  1088.        punkUser: IUnknown;        // user com pointer, auto released upon PMSG free
  1089.        dblTempo: DOUBLE;          // the tempo
  1090.     end;
  1091.     (* DMUS_SYSEX_PMSG *)
  1092.     PDMUS_SYSEX_PMSG = ^TDMUS_SYSEX_PMSG;
  1093.     TDMUS_SYSEX_PMSG = packed record
  1094.        dwSize: DWORD;
  1095.        rtTime: TREFERENCE_TIME;   // real time (in 100 nanosecond increments)
  1096.        mtTime: TMUSIC_TIME;       // music time
  1097.        dwFlags: DWORD;            // various bits (see DMUS_PMSG_FLAGS enumeration)
  1098.        dwPChannel: DWORD;         // Performance Channel. The Performance can
  1099.                                   // use this to determine the port/channel.
  1100.        dwVirtualTrackID: DWORD;   // virtual track ID
  1101.        pTool: IDirectMusicTool;   // tool class pointer
  1102.        pGraph: IDirectMusicGraph; // tool graph class pointer
  1103.        dwType: DWORD;             // PMSG type (see DMUS_PM_TYPE defines)
  1104.        punkUser: IUnknown;        // user com pointer, auto released upon PMSG free
  1105.        dwLen: DWORD;              // length of the data
  1106.        abData: Byte;              // array of data, length equal to dwLen
  1107.     end;
  1108.     (* DMUS_CURVE_PMSG *)
  1109.     PDMUS_CURVE_PMSG = ^TDMUS_CURVE_PMSG;
  1110.     TDMUS_CURVE_PMSG = packed record
  1111.        dwSize: DWORD;
  1112.        rtTime: TREFERENCE_TIME;   // real time (in 100 nanosecond increments)
  1113.        mtTime: TMUSIC_TIME;       // music time
  1114.        dwFlags: DWORD;            // various bits (see DMUS_PMSG_FLAGS enumeration)
  1115.        dwPChannel: DWORD;         // Performance Channel. The Performance can
  1116.                                   // use this to determine the port/channel.
  1117.        dwVirtualTrackID: DWORD;   // virtual track ID
  1118.        pTool: IDirectMusicTool;   // tool class pointer
  1119.        pGraph: IDirectMusicGraph; // tool graph class pointer
  1120.        dwType: DWORD;             // PMSG type (see DMUS_PM_TYPE defines)
  1121.        punkUser: IUnknown;        // user com pointer, auto released upon PMSG free
  1122.        mtDuration: TMUSIC_TIME;      // how long this curve lasts
  1123.        mtOriginalStart: TMUSIC_TIME; // must be set to either zero when this PMSG is created or to the original mtTime of the curve
  1124.        mtResetDuration: TMUSIC_TIME; // how long after the curve is finished to reset to the
  1125.                                      //   reset value, nResetValue
  1126.        nStartValue: WORD;            // curve's start value
  1127.        nEndValue: WORD;              // curve's end value
  1128.        nResetValue: WORD;            // curve's reset value, sent after mtResetDuration or
  1129.                                      // upon a flush or invalidation
  1130.        wMeasure: WORD;               // Measure in which this curve occurs
  1131.        nOffset: WORD;                // Offset from grid at which this curve occurs
  1132.        bBeat: BYTE;                  // Beat (in measure) at which this curve occurs
  1133.        bGrid: BYTE;                  // Grid offset from beat at which this curve occurs
  1134.        bType: BYTE;                  // type of curve
  1135.        bCurveShape: BYTE;            // shape of curve
  1136.        bCCData: BYTE;                // CC# if this is a control change type
  1137.        bFlags: BYTE;                 // set to 1 if the nResetValue must be sent when the
  1138.                                      // time is reached or an invalidate occurs because
  1139.                                      // of a transition. If 0, the curve stays
  1140.                                      // permanently stuck at the new value. All bits besides
  1141.                                      //   1 are reserved.
  1142.     end;
  1143.     (* DMUS_TIMESIG_PMSG *)
  1144.     PDMUS_TIMESIG_PMSG = ^TDMUS_TIMESIG_PMSG;
  1145.     TDMUS_TIMESIG_PMSG = packed record
  1146.        dwSize: DWORD;
  1147.        rtTime: TREFERENCE_TIME;   // real time (in 100 nanosecond increments)
  1148.        mtTime: TMUSIC_TIME;       // music time
  1149.        dwFlags: DWORD;            // various bits (see DMUS_PMSG_FLAGS enumeration)
  1150.        dwPChannel: DWORD;         // Performance Channel. The Performance can
  1151.                                   // use this to determine the port/channel.
  1152.        dwVirtualTrackID: DWORD;   // virtual track ID
  1153.        pTool: IDirectMusicTool;   // tool class pointer
  1154.        pGraph: IDirectMusicGraph; // tool graph class pointer
  1155.        dwType: DWORD;             // PMSG type (see DMUS_PM_TYPE defines)
  1156.        punkUser: IUnknown;        // user com pointer, auto released upon PMSG free
  1157.        // Time signatures define how many beats per measure, which note receives
  1158.        // the beat, and the grid resolution.
  1159.        bBeatsPerMeasure: BYTE;    // beats per measure (top of time sig)
  1160.        bBeat: BYTE;               // what note receives the beat (bottom of time sig.)
  1161.                                   // we can assume that 0 means 256th note
  1162.        wGridsPerBeat: WORD;       // grids per beat
  1163.     end;
  1164.     (* DMUS_NOTIFICATION_PMSG *)
  1165.     PDMUS_NOTIFICATION_PMSG = ^TDMUS_NOTIFICATION_PMSG;
  1166.     TDMUS_NOTIFICATION_PMSG = packed record
  1167.        dwSize: DWORD;
  1168.        rtTime: TREFERENCE_TIME;   // real time (in 100 nanosecond increments)
  1169.        mtTime: TMUSIC_TIME;       // music time
  1170.        dwFlags: DWORD;            // various bits (see DMUS_PMSG_FLAGS enumeration)
  1171.        dwPChannel: DWORD;         // Performance Channel. The Performance can
  1172.                                   // use this to determine the port/channel.
  1173.        dwVirtualTrackID: DWORD;   // virtual track ID
  1174.        pTool: IDirectMusicTool;   // tool class pointer
  1175.        pGraph: IDirectMusicGraph; // tool graph class pointer
  1176.        dwType: DWORD;             // PMSG type (see DMUS_PM_TYPE defines)
  1177.        punkUser: IUnknown;        // user com pointer, auto released upon PMSG free
  1178.        guidNotificationType: TGUID;
  1179.        dwNotificationOption: DWORD;
  1180.        dwField1: DWORD;
  1181.        dwField2: DWORD;
  1182.     end;
  1183.     (* Time Signature structure, used by IDirectMusicStyle *)
  1184.     PDMUS_TIMESIGNATURE = ^TDMUS_TIMESIGNATURE;
  1185.     TDMUS_TIMESIGNATURE = packed record
  1186.        lTime: DWORD;
  1187.        bBeatsPerMeasure: BYTE;      // beats per measure (top of time sig)
  1188.        bBeat: BYTE;                 // what note receives the beat (bottom of time sig.)
  1189.                                     // we can assume that 0 means 256th note
  1190.        wGridsPerBeat: WORD;         // grids per beat
  1191.     end;
  1192.     PDMUS_VERSION = ^TDMUS_VERSION;
  1193.     TDMUS_VERSION = record
  1194.       dwVersionMS: DWORD;
  1195.       dwVersionLS: DWORD;
  1196.     end;
  1197.     (* The DMUSOBJECTDESC structure is used to communicate everything you could *)
  1198.     (* possibly use to describe a DirectMusic object.                           *)
  1199.     PDMUS_OBJECTDESC = ^TDMUS_OBJECTDESC;
  1200.     TDMUS_OBJECTDESC = record
  1201.       dwSize: DWORD;                 // Size of this structure.
  1202.       dwValidData: DWORD;            // Flags indicating which fields below are valid.
  1203.       guidObject: TGUID;             // Unique ID for this object.
  1204.       guidClass: TGUID;              // GUID for the class of object.
  1205.       ftData: TFILETIME;             // Last edited date of object.
  1206.       vVersion: TDMUS_VERSION;       // Version.
  1207.       wszName: array[0..DMUS_MAX_NAME-1] of WCHAR; // Name of object.
  1208.       wszCategory: array[0..DMUS_MAX_CATEGORY-1] of WCHAR; // Category for object (optional).
  1209.       wszFileName: array[0..DMUS_MAX_FILENAME-1] of WCHAR; // File path.
  1210.       llMemLength: LONGLONG;         // Size of Memory data.
  1211.       pbMemData: PBYTE;              // Memory pointer for data.
  1212.       Dummy: DWORD;
  1213.     end;
  1214.     IDirectMusicBand = interface(IUnknown)
  1215.        ['{d2ac28c0-b39b-11d1-8704-00600893b1bd}']
  1216.        function CreateSegment(var ppSegment: IDirectMusicSegment): HRESULT; stdcall;
  1217.        function Download(pPerformance: IDirectMusicPerformance): HRESULT; stdcall;
  1218.        function Unload(pPerformance: IDirectMusicPerformance): HRESULT; stdcall;
  1219.     end;
  1220.     IDirectMusicObject = interface(IUnknown)
  1221.        ['{d2ac28b5-b39b-11d1-8704-00600893b1bd}']
  1222.        function GetDescriptor(pDesc: PDMUS_OBJECTDESC): HRESULT; stdcall;
  1223.        function SetDescriptor(pDesc: PDMUS_OBJECTDESC): HRESULT; stdcall;
  1224.        function ParseDescriptor(pStream: ISTREAM; pDesc: PDMUS_OBJECTDESC): HRESULT; stdcall;
  1225.     end;
  1226.     PPointer = ^Pointer;
  1227.     IDirectMusicLoader = interface(IUnknown)
  1228.        ['{f0b49495-0bac-11d2-bca1-00a0c922e6eb}']
  1229.        function GetObject(pDesc: PDMUS_OBJECTDESC; const riid: TIID; out ppv): HRESULT; stdcall;
  1230.        function SetObject(pDesc: PDMUS_OBJECTDESC): HRESULT; stdcall;
  1231.        function SetSearchDirectory(const rguidClass: TGUID; pwzPath: PWCHAR; fClear: BOOL): HRESULT; stdcall;
  1232.        function ScanDirectory(const rguidClass: TGUID; pwzFileExtension,pwzScanFileName: PWCHAR): HRESULT; stdcall;
  1233.        function CacheObject(pObject: IDirectMusicObject): HRESULT; stdcall;
  1234.        function ReleaseObject(pObject: IDirectMusicObject): HRESULT; stdcall;
  1235.        function ClearCache(const rguidClass: TGUID): HRESULT; stdcall;
  1236.        function EnableCache(const rguidClass: TGUID; fEnable: BOOL): HRESULT; stdcall;
  1237.        function EnumObject(const rguidClass: TGUID;dwIndex: DWORD; pDesc: PDMUS_OBJECTDESC): HRESULT; stdcall;
  1238.     end;
  1239.     //  Stream object supports IDirectMusicGetLoader class to access loader while file parsing.
  1240.     IDirectMusicGetLoader = interface(IUnknown)
  1241.        ['{68a04844-d13d-11d1-afa6-00aa0024d8b6}']
  1242.        function GetLoader(var ppLoader: IDirectMusicLoader): HRESULT; stdcall;
  1243.     end;
  1244.     IDirectMusicSegment = interface(IUnknown)
  1245.        ['{70e3bd5d-f118-11d1-bc92-00a0c922e6eb}']
  1246.        function GetLength(var pmtLength: TMUSIC_TIME): HRESULT; stdcall;
  1247.        function SetLength(mtLength: TMUSIC_TIME): HRESULT; stdcall;
  1248.        function GetRepeats(var pdwRepeats: DWORD): HRESULT; stdcall;
  1249.        function SetRepeats(dwRepeats: DWORD): HRESULT; stdcall;
  1250.        function GetDefaultResolution(var pdwResolution: DWORD): HRESULT; stdcall;
  1251.        function SetDefaultResolution(dwResolution: DWORD): HRESULT; stdcall;
  1252.        function GetTrack(const rguidType: TGUID; dwGroupBits,dwIndex: DWORD; var ppTrack: IDirectMusicTrack): HRESULT; stdcall;
  1253.        function GetTrackGroup(pTrack: IDirectMusicTrack;var pdwGroupBits: DWORD): HRESULT; stdcall;
  1254.        function InsertTrack(pTrack: IDirectMusicTrack; dwGroupBits: DWORD): HRESULT; stdcall;
  1255.        function RemoveTrack(pTrack: IDirectMusicTrack): HRESULT; stdcall;
  1256.        function InitPlay(var ppSegState: IDirectMusicSegmentState; pPerformance: IDirectMusicPerformance; dwFlags: DWORD): HRESULT; stdcall;
  1257.        function GetGraph(var ppGraph: IDirectMusicGraph): HRESULT; stdcall;
  1258.        function SetGraph(pGraph: IDirectMusicGraph): HRESULT; stdcall;
  1259.        function AddNotificationType(const rguidNotificationType: TGUID): HRESULT; stdcall;
  1260.        function RemoveNotificationType(const rguidNotificationType: TGUID): HRESULT; stdcall;
  1261.        function GetParam(const rguidType: TGUID;dwGroupBits, dwIndex: DWORD; mtTime: TMUSIC_TIME;
  1262.                          var pmtNext: TMUSIC_TIME; pParam: Pointer): HRESULT; stdcall;
  1263.        function SetParam(const rguidType: TGUID; dwGroupBits, dwIndex: DWORD; mtTime: TMUSIC_TIME;
  1264.                          pParam: Pointer): HRESULT; stdcall;
  1265.        function Clone(mtStart,mtEnd: TMUSIC_TIME; var ppSegment: IDirectMusicSegment): HRESULT; stdcall;
  1266.        function SetStartPoint(mtStart: TMUSIC_TIME): HRESULT; stdcall;
  1267.        function GetStartPoint(var pmtStart: TMUSIC_TIME): HRESULT; stdcall;
  1268.        function SetLoopPoints(mtStart,mtEnd: TMUSIC_TIME): HRESULT; stdcall;
  1269.        function GetLoopPoints(var pmtStart, pmtEnd: TMUSIC_TIME): HRESULT; stdcall;
  1270.        function SetPChannelsUsed(dwNumPChannels: DWORD; var paPChannels: DWORD): HRESULT; stdcall;
  1271.     end;
  1272.     IDirectMusicSegmentState = interface(IUnknown)
  1273.        ['{a3afdcc7-d3ee-11d1-bc8d-00a0c922e6eb}']
  1274.        function GetRepeats(var pdwRepeats: DWORD): HRESULT; stdcall;
  1275.        function GetSegment(var ppSegment: IDirectMusicSegment): HRESULT; stdcall;
  1276.        function GetStartTime(var pmStart: TMUSIC_TIME): HRESULT; stdcall;
  1277.        function GetSeek(var pmtSeek: TMUSIC_TIME): HRESULT; stdcall;
  1278.        function GetStartPoint(var pmtStart: TMUSIC_TIME): HRESULT; stdcall;
  1279.     end;
  1280.     IDirectMusicTrack = interface(IUnknown)
  1281.        ['{de5e3a32-d31b-11d1-bc8b-00a0c922e6eb}']
  1282.        function Init(pSegment: IDirectMusicSegment): HRESULT; stdcall;
  1283.        function InitPlay(pSegmentState: IDirectMusicSegmentState;
  1284.                          pPerformance: IDirectMusicPerformance;
  1285.                          var ppStateData: Pointer;
  1286.                          dwVirtualTrackID,dwFlags: DWORD): HRESULT; stdcall;
  1287.        function EndPlay(pStateData: Pointer): HRESULT; stdcall;
  1288.        function Play(pStateData: Pointer; mtStart,mtEnd, mtOffset: TMUSIC_TIME;
  1289.                      dwFlags: DWORD; pPerf: IDirectMusicPerformance;
  1290.                      pSegSt: IDirectMusicSegmentState;dwVirtualID: DWORD): HRESULT; stdcall;
  1291.        function GetParam(const rguidType: TGUID; mtTime: TMUSIC_TIME; var pmtNext: TMUSIC_TIME; pParam: Pointer): HRESULT; stdcall;
  1292.        function SetParam(const rguidType: TGUID; mtTime: TMUSIC_TIME; pParam: Pointer): HRESULT; stdcall;
  1293.        function IsParamSupported(const rguidType: TGUID): HRESULT; stdcall;
  1294.        function AddNotificationType(const rguidNotificationType: TGUID): HRESULT; stdcall;
  1295.        function RemoveNotificationType(const rguidNotificationType: TGUID): HRESULT; stdcall;
  1296.        function Clone(mtStart, mtEnd: TMUSIC_TIME; var ppTrack: IDirectMusicTrack): HRESULT; stdcall;
  1297.     end;
  1298.     IDirectMusicPerformance = interface(IUnknown)
  1299.        ['{de5e3a33-d31b-11d1-bc8b-00a0c922e6eb}']
  1300.        function Init(ppDirectMusic: PIDirectMusic;
  1301.                      pDirectSound: {PDIRECTSOUND} Pointer;
  1302.                      hWnd: HWND): HRESULT; stdcall;
  1303.        function PlaySegment(pSegment: IDirectMusicSegment; dwFlags: DWORD; i64StartTime: LONGLONG;
  1304.                             ppSegmentState: PIDirectMusicSegmentState): HRESULT; stdcall;
  1305.        function Stop(pSegment: IDirectMusicSegment;
  1306.                      pSegmentState: IDirectMusicSegmentState;
  1307.                      mtTime: TMUSIC_TIME; dwFlags: DWORD): HRESULT; stdcall;
  1308.        function GetSegmentState(var ppSegmentState: IDirectMusicSegmentState;
  1309.                                 mtTime: TMUSIC_TIME): HRESULT; stdcall;
  1310.        function SetPrepareTime(dwMilliSeconds: DWORD): HRESULT; stdcall;
  1311.        function GetPrepareTime(var pdwMilliSeconds: DWORD): HRESULT; stdcall;
  1312.        function SetBumperLength(dwMilliSeconds: DWORD): HRESULT; stdcall;
  1313.        function GetBumperLength(var pdwMilliSeconds: DWORD): HRESULT; stdcall;
  1314.        function SendPMsg(pPMSG: PDMUS_PMSG): HRESULT; stdcall;
  1315.        function MusicToReferenceTime(mtTime: TMUSIC_TIME; var prtTime: TREFERENCE_TIME): HRESULT; stdcall;
  1316.        function ReferenceToMusicTime(rtTime: TREFERENCE_TIME; var pmtTime: TMUSIC_TIME): HRESULT; stdcall;
  1317.        function IsPlaying(pSegment: IDirectMusicSegment; pSegState: IDirectMusicSegmentState): HRESULT; stdcall;
  1318.        function GetTime(var prtNow: TREFERENCE_TIME; var pmtNow: TMUSIC_TIME): HRESULT; stdcall;
  1319.        function AllocPMsg(cb: ULONG; var ppPMSG: PDMUS_PMSG): HRESULT; stdcall;
  1320.        function FreePMsg(pPMSG: PDMUS_PMSG): HRESULT; stdcall;
  1321.        function GetGraph(var ppGraph: IDirectMusicGraph): HRESULT; stdcall;
  1322.        function SetGraph(pGraph: IDirectMusicGraph): HRESULT; stdcall;
  1323.        function SetNotificationHandle(hNotification: THANDLE; rtMinimum: TREFERENCE_TIME): HRESULT; stdcall;
  1324.        function GetNotificationPMsg(var ppNotificationPMsg: PDMUS_NOTIFICATION_PMSG): HRESULT; stdcall;
  1325.        function AddNotificationType(const rguidNotificationType: TGUID): HRESULT; stdcall;
  1326.        function RemoveNotificationType(const rguidNotificationType: TGUID): HRESULT; stdcall;
  1327.        function AddPort(pPort: IDirectMusicPort): HRESULT; stdcall;
  1328.        function RemovePort(pPort: IDirectMusicPort): HRESULT; stdcall;
  1329.        function AssignPChannelBlock(dwBlockNum: DWORD; pPort: IDirectMusicPort; dwGroup: DWORD): HRESULT; stdcall;
  1330.        function AssignPChannel(dwPChannel: DWORD; pPort: IDirectMusicPort; dwGroup, dwMChannel: DWORD): HRESULT; stdcall;
  1331.        function PChannelInfo(dwPChannel: DWORD; var ppPort: IDirectMusicPort; var pdwGroup, pdwMChannel: DWORD): HRESULT; stdcall;
  1332.        function DownloadInstrument(pInst: IDirectMusicInstrument; dwPChannel: DWORD;
  1333.                                    var ppDownInst: IDirectMusicDownloadedInstrument;
  1334.                                    pNoteRanges: PDMUS_NOTERANGE; dwNumNoteRanges: DWORD;
  1335.                                    var ppPort: IDirectMusicPort; var pdwGroup, pdwMChannel: DWORD): HRESULT; stdcall;
  1336.        function Invalidate(mtTime: TMUSIC_TIME;dwFlags: DWORD): HRESULT; stdcall;
  1337.        function GetParam(const rguidType: TGUID; dwGroupBits,dwIndex: DWORD;
  1338.                          mtTime: TMUSIC_TIME; var pmtNext: TMUSIC_TIME; pParam: Pointer): HRESULT; stdcall;
  1339.        function SetParam(rguidType: TGUID; dwGroupBits, dwIndex: DWORD;
  1340.                          mtTime: TMUSIC_TIME; pParam: Pointer): HRESULT; stdcall;
  1341.        function GetGlobalParam(const rguidType: TGUID; pParam: Pointer; dwSize: DWORD): HRESULT; stdcall;
  1342.        function SetGlobalParam(const rguidType: TGUID; pParam: Pointer; dwSize: DWORD): HRESULT; stdcall;
  1343.        function GetLatencyTime(var prtTime: TREFERENCE_TIME): HRESULT; stdcall;
  1344.        function GetQueueTime(var prtTime: TREFERENCE_TIME): HRESULT; stdcall;
  1345.        function AdjustTime(rtAmount: TREFERENCE_TIME): HRESULT; stdcall;
  1346.        function CloseDown: HRESULT; stdcall;
  1347.        function GetResolvedTime(rtTime: TREFERENCE_TIME; var prtResolved: TREFERENCE_TIME; dwTimeResolveFlags: DWORD): HRESULT; stdcall;
  1348.        function MIDIToMusic(bMIDIValue: Byte; var pChord: Word{muss TDMUS_CHORD_KEY sein}; bPlayMode, bChordLevel: Byte; var pwMusicValue: WORD): HRESULT; stdcall;
  1349.        function MusicToMIDI(wMusicValue: WORD; var pChord: Word{muss TDMUS_CHORD_KEY sein}; bPlayMode, bChordLevel: Byte; var pwMidiValue: WORD): HRESULT; stdcall;
  1350.        function TimeToRhythm(mtTime: TMUSIC_TIME; var pTimeSig: TDMUS_TIMESIGNATURE; var pwMeasure: WORD; var pbBeat, pbGrid: BYTE; var pnOffset: Smallint): HRESULT; stdcall;
  1351.        function RhythmToTime(wMeasure: WORD; bBeat, bGrid: BYTE; nOffset: Smallint; var pTimeSig: TDMUS_TIMESIGNATURE; var pmtTime: TMUSIC_TIME): HRESULT; stdcall;
  1352.     end;
  1353.     IDirectMusicTool = interface(IUnknown)
  1354.        ['{d2ac28ba-b39b-11d1-8704-00600893b1bd}']
  1355.        function Init(pGraph: IDirectMusicGraph): HRESULT; stdcall;
  1356.        function GetMsgDeliveryType(var pdwDeliveryType: DWORD): HRESULT; stdcall;
  1357.        function GetMediaTypeArraySize(var pdwNumElements: DWORD): HRESULT; stdcall;
  1358.        function GetMediaTypes(var padwMediaTypes: PDWORD; dwNumElements: DWORD): HRESULT; stdcall;
  1359.        function ProcessPMsg(pPerf: IDirectMusicPerformance; pPMSG: PDMUS_PMSG): HRESULT; stdcall;
  1360.        function Flush(pPerf: IDirectMusicPerformance; pPMSG: PDMUS_PMSG; rtTime: TREFERENCE_TIME): HRESULT; stdcall;
  1361.     end;
  1362.     IDirectMusicGraph = interface(IUnknown)
  1363.        ['{1ee21dc8-c370-11d1-bc84-00a0c922e6eb}']
  1364.        function StampPMsg(pPMSG: PDMUS_PMSG): HRESULT; stdcall;
  1365.        function InsertTool(pTool: IDirectMusicTool; pdwPChannels: PDWORD; cPChannels, lIndex: DWORD): HRESULT; stdcall;
  1366.        function GetTool(dwIndex: DWORD; var ppTool: IDirectMusicTool): HRESULT; stdcall;
  1367.        function RemoveTool(pTool: IDirectMusicTool): HRESULT; stdcall;
  1368.     end;
  1369.     IDirectMusicStyle = interface(IUnknown)
  1370.        ['{d2ac28bd-b39b-11d1-8704-00600893b1bd}']
  1371.        function GetBand(pwszName: PWCHAR; var ppBand: IDirectMusicBand): HRESULT; stdcall;
  1372.        function EnumBand(dwIndex: DWORD; pwszName: PWCHAR): HRESULT; stdcall;
  1373.        function GetDefaultBand(var ppBand: IDirectMusicBand): HRESULT; stdcall;
  1374.        function EnumMotif(dwIndex: DWORD; pwszName: PWCHAR): HRESULT; stdcall;
  1375.        function GetMotif(pwszName: PWCHAR; var ppSegment: IDirectMusicSegment): HRESULT; stdcall;
  1376.        function GetDefaultChordMap(var ppChordMap: IDirectMusicChordMap): HRESULT; stdcall;
  1377.        function EnumChordMap(dwIndex: DWORD; pwszName: PWCHAR): HRESULT; stdcall;
  1378.        function GetChordMap(pwszName: PWCHAR; var ppChordMap: IDirectMusicChordMap): HRESULT; stdcall;
  1379.        function GetTimeSignature(var pTimeSig: TDMUS_TIMESIGNATURE): HRESULT; stdcall;
  1380.        function GetEmbellishmentLength(dwType, dwLevel: DWORD; var pdwMin, pdwMax: DWORD): HRESULT; stdcall;
  1381.        function GetTempo(var pTempo: Double): HRESULT; stdcall;
  1382.     end;
  1383.     IDirectMusicChordMap = interface(IUnknown)
  1384.        ['{d2ac28be-b39b-11d1-8704-00600893b1bd}']
  1385.        function GetScale(var pdwScale: DWORD): HRESULT; stdcall;
  1386.     end;
  1387.     IDirectMusicComposer = interface(IUnknown)
  1388.        ['{d2ac28bf-b39b-11d1-8704-00600893b1bd}']
  1389.        function ComposeSegmentFromTemplate(pStyle: IDirectMusicStyle;
  1390.                                            pTempSeg: IDirectMusicSegment;
  1391.                                            wActivity: WORD;
  1392.                                            pChordMap: IDirectMusicChordMap;
  1393.                                            var ppSectionSeg: IDirectMusicSegment): HRESULT; stdcall;
  1394.        function ComposeSegmentFromShape(pStyle: IDirectMusicStyle; wNumMeasures,wShape,wActivity: WORD;
  1395.                                         fIntro, fEnd: BOOL; pChordMap: IDirectMusicChordMap;
  1396.                                         var ppSectionSeg: IDirectMusicSegment): HRESULT; stdcall;
  1397.        function ComposeTransition(pFromSeg,pToSeg: IDirectMusicSegment;
  1398.                                   mtTime: TMUSIC_TIME; wCommand: WORD; dwFlags: DWORD;
  1399.                                   pChordMap: IDirectMusicChordMap;
  1400.                                   var ppSectionSeg: IDirectMusicSegment): HRESULT; stdcall;
  1401.        function AutoTransition(pPerformance: IDirectMusicPerformance;
  1402.                                pToSeg: IDirectMusicSegment; wCommand: WORD; dwFlags: DWORD;
  1403.                                pChordMap: IDirectMusicChordMap;
  1404.                                var ppTransSeg: IDirectMusicSegment;
  1405.                                var ppToSegState: IDirectMusicSegmentState;
  1406.                                var ppTransSegState: IDirectMusicSegmentState): HRESULT; stdcall;
  1407.        function ComposeTemplateFromShape(wNumMeasures, wShape: WORD; fIntro, fEnd: BOOL; wEndLength: WORD;
  1408.                                          var ppTempSeg: IDirectMusicSegment): HRESULT; stdcall;
  1409.        function ChangeChordMap(pSectionSeg: IDirectMusicSegment; fTrackScale: BOOL;
  1410.                                   pChordMap: IDirectMusicChordMap): HRESULT; stdcall;
  1411.     end;
  1412. const
  1413.     CLSID_DirectMusicPerformance : TGUID =
  1414.         (D1:$d2ac2881;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1415.     CLSID_DirectMusicSegment : TGUID =
  1416.         (D1:$d2ac2882;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1417.     CLSID_DirectMusicSegmentState : TGUID =
  1418.         (D1:$d2ac2883;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1419.      CLSID_DirectMusicGraph : TGUID =
  1420.         (D1:$d2ac2884;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1421.     CLSID_DirectMusicTempoTrack : TGUID =
  1422.         (D1:$d2ac2885;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1423.     CLSID_DirectMusicSeqTrack : TGUID =
  1424.         (D1:$d2ac2886;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1425.     CLSID_DirectMusicSysExTrack : TGUID =
  1426.         (D1:$d2ac2887;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1427.     CLSID_DirectMusicTimeSigTrack : TGUID =
  1428.         (D1:$d2ac2888;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1429.     CLSID_DirectMusicStyle : TGUID =
  1430.         (D1:$d2ac288a;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1431.     CLSID_DirectMusicChordTrack : TGUID =
  1432.         (D1:$d2ac288b;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1433.     CLSID_DirectMusicCommandTrack: TGUID =
  1434.         (D1:$d2ac288c;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1435.     CLSID_DirectMusicStyleTrack : TGUID =
  1436.         (D1:$d2ac288d;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1437.     CLSID_DirectMusicMotifTrack : TGUID =
  1438.         (D1:$d2ac288e;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1439.     CLSID_DirectMusicChordMap : TGUID =
  1440.         (D1:$d2ac288f;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1441.     CLSID_DirectMusicComposer : TGUID =
  1442.         (D1:$d2ac2890;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1443.     CLSID_DirectMusicSignPostTrack : TGUID =
  1444.         (D1:$f17e8672;D2:$c3b4;D3:$11d1;D4:($87,$b,$0,$60,$8,$93,$b1,$bd));
  1445.     CLSID_DirectMusicLoader : TGUID =
  1446.         (D1:$d2ac2892;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1447.     CLSID_DirectMusicBandTrack :TGUID =
  1448.         (D1:$d2ac2894;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1449.     CLSID_DirectMusicBand : TGUID =
  1450.         (D1:$79ba9e00;D2:$b6ee;D3:$11d1;D4:($86,$be,$0,$c0,$4f,$bf,$8f,$ef));
  1451.     CLSID_DirectMusicChordMapTrack : TGUID =
  1452.         (D1:$d2ac2896;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1453.     CLSID_DirectMusicMuteTrack : TGUID =
  1454.         (D1:$d2ac2898;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1455.     // Special GUID for all object types. This is used by the loader.
  1456.     GUID_DirectMusicAllTypes : TGUID =
  1457.         (D1:$d2ac2893;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1458.     // Notification guids
  1459.     GUID_NOTIFICATION_SEGMENT : TGUID =
  1460.         (D1:$d2ac2899;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1461.     GUID_NOTIFICATION_PERFORMANCE : TGUID =
  1462.         (D1: $81f75bc5;D2:$4e5d;D3:$11d2;D4:($bc,$c7,$0,$a0,$c9,$22,$e6,$eb));
  1463.     GUID_NOTIFICATION_MEASUREANDBEAT : TGUID =
  1464.         (D1:$d2ac289a;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1465.     GUID_NOTIFICATION_CHORD : TGUID =
  1466.         (D1:$d2ac289b;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1467.     GUID_NOTIFICATION_COMMAND : TGUID =
  1468.         (D1:$d2ac289c;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1469.     // Track param type guids
  1470.     GUID_CommandTrack : TGUID =
  1471.         (D1:$d2ac289d;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1472.     GUID_ChordTrackChord : TGUID =
  1473.         (D1:$d2ac289e;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1474.     GUID_ChordTrackRhythm : TGUID =
  1475.         (D1:$d2ac289f;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1476.     GUID_StyleTrackRepeats : TGUID =
  1477.         (D1:$d2ac28a0;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1478.     GUID_StyleTrackStyle : TGUID =
  1479.         (D1:$d2ac28a1;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1480.     GUID_MotifTrack : TGUID =
  1481.         (D1:$d2ac28a2;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1482.     GUID_TimeSigTrack : TGUID =
  1483.         (D1:$d2ac28a4;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1484.     GUID_TempoTrack : TGUID =
  1485.         (D1:$d2ac28a5;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1486.     GUID_BandTrack : TGUID =
  1487.         (D1:$d2ac28a6;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1488.     GUID_BandTrack_Download : TGUID =
  1489.         (D1:$d2ac28a7;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1490.     GUID_BandTrack_Unload : TGUID =
  1491.         (D1:$d2ac28a8;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1492.     GUID_BandTrack_Enable_Auto_Download : TGUID =
  1493.         (D1:$d2ac28a9;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1494.     GUID_BandTrack_Disable_Auto_Download :TGUID =
  1495.         (D1:$d2ac28aa;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1496.     GUID_BandTrack_Clear_All_Bands : TGUID =
  1497.         (D1:$d2ac28ab;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1498.     GUID_BandTrack_AddBand : TGUID =
  1499.         (D1:$d2ac28ac;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1500.     GUID_BandTrack_SetGMOnly : TGUID =
  1501.         (D1:$6621075;D2:$e92e;D3:$11d1;D4:($a8,$c5,$0,$c0,$4f,$a3,$72,$6e));
  1502.     GUID_BandTrack_ConnectToDLSCollection : TGUID =
  1503.         (D1:$1db1ae6b;D2:$e92e;D3:$11d1;D4:($a8,$c5,$0,$c0,$4f,$a3,$72,$6e));
  1504.     GUID_PersonalityTrack : TGUID =
  1505.         (D1:$d2ac28ad;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1506.     GUID_AuditionTrack : TGUID =
  1507.         (D1:$d2ac28ae;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1508.     GUID_MuteTrack : TGUID =
  1509.         (D1:$d2ac28af;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1510.     // Global data guids
  1511.     GUID_PerfMasterTempo : TGUID =
  1512.         (D1:$d2ac28b0;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1513.     GUID_PerfMasterVolume : TGUID =
  1514.         (D1:$d2ac28b1;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1515.     GUID_PerfMasterGrooveLevel : TGUID =
  1516.         (D1:$d2ac28b2;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1517.     GUID_PerfAutoDownload : TGUID =
  1518.         (D1:$fb09565b;D2:$3631;D3:$11d2;D4:($bc,$b8,$0,$a0,$c9,$22,$e6,$eb));
  1519.     // GUID for default GM/GS dls collection.
  1520.     GUID_DefaultGMCollection : TGUID =
  1521.         (D1:$f17e8673;D2:$c3b4;D3:$11d1;D4:($87,$b,$0,$60,$8,$93,$b1,$bd));
  1522.     // These guids are used in IDirectMusicSegment::SetParam to tell the band track to perform various actions.
  1523.     // Download bands for the IDirectMusicSegment
  1524.     GUID_Download : TGUID =
  1525.         (D1:$d2ac28a7;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1526.     // Unload bands for the IDirectMusicSegment
  1527.     GUID_Unload : TGUID =
  1528.         (D1:$d2ac28a8;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1529.     // Set segment to manage all program changes, bank selects, etc. for simple playback of a standard MIDI file
  1530.     GUID_StandardMIDIFile : TGUID =
  1531.         (D1:$6621075;D2:$e92e;D3:$11d1;D4:($a8,$c5,$0,$c0,$4f,$a3,$72,$6e));
  1532.     // IID's
  1533.     IID_IDirectMusicLoader : TGUID =
  1534.         (D1:$2ffaaca2;D2:$5dca;D3:$11d2;D4:($af,$a6,$0,$aa,$0,$24,$d8,$b6));
  1535.     IID_IDirectMusicGetLoader : TGUID =
  1536.         (D1:$68a04844;D2:$d13d;D3:$11d1;D4:($af,$a6,$0,$aa,$0,$24,$d8,$b6));
  1537.     IID_IDirectMusicObject : TGUID =
  1538.         (D1:$d2ac28b5;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1539.     IID_IDirectMusicSegment : TGUID =
  1540.         (D1:$f96029a2;D2:$4282;D3:$11d2;D4:($87,$17,$0,$60,$8,$93,$b1,$bd));
  1541.     IID_IDirectMusicSegmentState : TGUID =
  1542.         (D1:$a3afdcc7;D2:$d3ee;D3:$11d1;D4:($bc,$8d,$0,$a0,$c9,$22,$e6,$eb));
  1543.     IID_IDirectMusicTrack : TGUID =
  1544.         (D1:$f96029a1;D2:$4282;D3:$11d2;D4:($87,$17,$0,$60,$8,$93,$b1,$bd));
  1545.     IID_IDirectMusicPerformance : TGUID =
  1546.         (D1:$7d43d03;D2:$6523;D3:$11d2;D4:($87,$1d,$0,$60,$8,$93,$b1,$bd));
  1547.     IID_IDirectMusicTool : TGUID =
  1548.         (D1:$d2ac28ba;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1549.     IID_IDirectMusicGraph : TGUID =
  1550.         (D1:$2befc277;D2:$5497;D3:$11d2;D4:($bc,$cb,$0,$a0,$c9,$22,$e6,$eb));
  1551.     IID_IDirectMusicStyle : TGUID =
  1552.         (D1:$d2ac28bd;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1553.     IID_IDirectMusicChordMap : TGUID =
  1554.         (D1:$d2ac28be;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1555.     IID_IDirectMusicComposer : TGUID =
  1556.         (D1:$d2ac28bf;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1557.     IID_IDirectMusicBand : TGUID =
  1558.         (D1:$d2ac28c0;D2:$b39b;D3:$11d1;D4:($87,$4,$0,$60,$8,$93,$b1,$bd));
  1559. (************************************************************************
  1560. *                                                                       *
  1561. *   dmusicf.h -- This module defines the DirectMusic file formats       *
  1562. *                                                                       *
  1563. *   Copyright (c) 1998, Microsoft Corp. All rights reserved.            *
  1564. *                                                                       *
  1565. ************************************************************************)
  1566. const
  1567.    // Common chunks
  1568.    DMUS_FOURCC_GUID_CHUNK       = $64697567; // mmioFOURCC('g','u','i','d')
  1569.    DMUS_FOURCC_INFO_LIST        = $4F464E49; // mmioFOURCC('I','N','F','O')
  1570.    DMUS_FOURCC_UNFO_LIST        = $4F464E55; // mmioFOURCC('U','N','F','O')
  1571.    DMUS_FOURCC_CATEGORY_CHUNK   = $67746163; // mmioFOURCC('c','a','t','g')
  1572.    DMUS_FOURCC_VERSION_CHUNK    = $73726576; // mmioFOURCC('v','e','r','s')
  1573. type
  1574.     PDMUS_COMMAND_PARAM =^TDMUS_COMMAND_PARAM;
  1575.     TDMUS_COMMAND_PARAM = record
  1576.        bCommand    : BYTE;
  1577.        bGrooveLevel: BYTE;
  1578.        bGrooveRange: BYTE;
  1579.     end;
  1580.     // The following structures are used by the Tracks, and are the packed structures
  1581.     // that are passed to the Tracks inside the IStream.
  1582.     PDMUS_IO_SEQ_ITEM = ^TDMUS_IO_SEQ_ITEM;
  1583.     TDMUS_IO_SEQ_ITEM = record
  1584.        lTime: DWORD;
  1585.        lDuration: DWORD;
  1586.        bEventType: BYTE;
  1587.        bStatus: BYTE;
  1588.        bByte1: BYTE;
  1589.        bByte2: BYTE;
  1590.        bType: BYTE;
  1591.        bPad: array[0..2] of BYTE;
  1592.     end;
  1593.     PDMUS_IO_CURVE_ITEM = ^TDMUS_IO_CURVE_ITEM;
  1594.     TDMUS_IO_CURVE_ITEM = record
  1595.        mtStart: TMUSIC_TIME;
  1596.        mtDuration: TMUSIC_TIME;
  1597.        mtResetDuration: TMUSIC_TIME;
  1598.        dwPChannel: DWORD;
  1599.        nStartValue: Smallint;
  1600.        nEndValue: Smallint;
  1601.        nResetValue: Smallint;
  1602.        bType: BYTE;
  1603.        bCurveShape: BYTE;
  1604.        bCCData: BYTE;
  1605.        bFlags: BYTE;
  1606.        bPad: array[0..1] of BYTE;
  1607.     end;
  1608.     PDMUS_IO_TEMPO_ITEM = ^TDMUS_IO_TEMPO_ITEM;
  1609.     TDMUS_IO_TEMPO_ITEM = record
  1610.        lTime: DWORD;
  1611.        dblTempo: DOUBLE;
  1612.     end;
  1613.     PDMUS_IO_SYSEX_ITEM = ^TDMUS_IO_SYSEX_ITEM;
  1614.     TDMUS_IO_SYSEX_ITEM = record
  1615.        lTime: DWORD;
  1616.        dwSysExLength: DWORD;
  1617.        pbSysExData: PByte;
  1618.     end;
  1619.     PDMUS_IO_BANKSELECT_ITEM = ^TDMUS_IO_BANKSELECT_ITEM;
  1620.     TDMUS_IO_BANKSELECT_ITEM = record
  1621.        byLSB: BYTE;
  1622.        byMSB: BYTE;
  1623.        byPad: array[0..1] of BYTE;
  1624.     end;
  1625.     PDMUS_IO_PATCH_ITEM = ^TDMUS_IO_PATCH_ITEM;
  1626.     TDMUS_IO_PATCH_ITEM = record
  1627.        lTime: DWORD;
  1628.        byStatus: BYTE;
  1629.        byByte1: BYTE;
  1630.        byByte2: BYTE;
  1631.        byMSB: BYTE;
  1632.        byLSB: BYTE;
  1633.        byPad: array[0..2] of BYTE;
  1634.        dwFlags: DWORD;
  1635.        pIDMCollection: IDirectMusicCollection;
  1636.        pNext: PDMUS_IO_PATCH_ITEM;
  1637.     end;
  1638.     PDMUS_IO_TIMESIGNATURE_ITEM = ^TDMUS_IO_TIMESIGNATURE_ITEM;
  1639.     TDMUS_IO_TIMESIGNATURE_ITEM = record
  1640.        lTime: DWORD;
  1641.        bBeatsPerMeasure: BYTE;   // beats per measure (top of time sig)
  1642.        bBeat: BYTE;              // what note receives the beat (bottom of time sig.)
  1643.                                  // we can assume that 0 means 256th note
  1644.        wGridsPerBeat: WORD;      // grids per beat
  1645.     end;
  1646.     PDMUS_SUBCHORD = ^TDMUS_SUBCHORD;
  1647.     TDMUS_SUBCHORD = record
  1648.        dwChordPattern: DWORD;     // Notes in the subchord
  1649.        dwScalePattern: DWORD;     // Notes in the scale
  1650.        dwInversionPoints: DWORD;  // Where inversions can occur
  1651.        dwLevels: DWORD;           // Which levels are supported by this subchord
  1652.        bChordRoot: BYTE;          // Root of the subchord
  1653.        bScaleRoot: BYTE;          // Root of the scale
  1654.     end;
  1655.     PDMUS_CHORD_PARAM = ^TDMUS_CHORD_PARAM;
  1656.     TDMUS_CHORD_PARAM = record
  1657.        wszName: array[0..15] of WCHAR;// Name of the chord
  1658.        wMeasure: WORd;                // Measure this falls on
  1659.        bBeat: BYTE;                   // Beat this falls on
  1660.        bSubChordCount: BYTE;          // Number of chords in the list of subchords
  1661.        SubChordList: array[0..DMUS_MAXSUBCHORD-1] of TDMUS_SUBCHORD; // List of sub chords
  1662.     end;
  1663.     PDMUS_RHYTHM_PARAM = ^TDMUS_RHYTHM_PARAM;
  1664.     TDMUS_RHYTHM_PARAM = record
  1665.        TimeSig: TDMUS_TIMESIGNATURE;
  1666.        dwRhythmPattern: DWORD;
  1667.     end;
  1668.     PDMUS_TEMPO_PARAM = ^TDMUS_TEMPO_PARAM;
  1669.     TDMUS_TEMPO_PARAM = record
  1670.        mtTime: TMUSIC_TIME;
  1671.        dblTempo: DOUBLE;
  1672.     end;
  1673.     PDMUS_MUTE_PARAM = ^TDMUS_MUTE_PARAM;
  1674.     TDMUS_MUTE_PARAM = record
  1675.        dwPChannel: DWORD;
  1676.        dwPChannelMap: DWORD;
  1677.     end;
  1678. const
  1679.     // Style chunks
  1680.     DMUS_FOURCC_STYLE_FORM        = 1414745412; //mmioFOURCC('D','M','S','T')
  1681.     DMUS_FOURCC_STYLE_CHUNK       = 1752790131; //mmioFOURCC('s','t','y','h')
  1682.     DMUS_FOURCC_PART_LIST         = 1953653104; //mmioFOURCC('p','a','r','t')
  1683.     DMUS_FOURCC_PART_CHUNK        = 1752461936; //mmioFOURCC('p','r','t','h')
  1684.     DMUS_FOURCC_NOTE_CHUNK        = 1702129518; //mmioFOURCC('n','o','t','e')
  1685.     DMUS_FOURCC_CURVE_CHUNK       = 1702261347; //mmioFOURCC('c','r','v','e')
  1686.     DMUS_FOURCC_PATTERN_LIST      = 1853125744; //mmioFOURCC('p','t','t','n')
  1687.     DMUS_FOURCC_PATTERN_CHUNK     = 1752069232; //mmioFOURCC('p','t','n','h')
  1688.     DMUS_FOURCC_RHYTHM_CHUNK      = 1836345458; //mmioFOURCC('r','h','t','m')
  1689.     DMUS_FOURCC_PARTREF_LIST      = 1717924464; //mmioFOURCC('p','r','e','f')
  1690.     DMUS_FOURCC_PARTREF_CHUNK     = 1667658352; //mmioFOURCC('p','r','f','c')
  1691.     DMUS_PLAYMODE_SCALE_ROOT      = 1;
  1692.     DMUS_PLAYMODE_CHORD_ROOT      = 2;
  1693.     DMUS_PLAYMODE_SCALE_INTERVALS = 4;
  1694.     DMUS_PLAYMODE_CHORD_INTERVALS = 8;
  1695.     DMUS_PLAYMODE_NONE            = 16;
  1696.     DMUS_PLAYMODE_FIXED           = 0;
  1697.     DMUS_PLAYMODE_FIXEDTOSCALE    = DMUS_PLAYMODE_SCALE_ROOT;
  1698.     DMUS_PLAYMODE_FIXEDTOCHORD    = DMUS_PLAYMODE_CHORD_ROOT;
  1699.     DMUS_PLAYMODE_PEDALPOINT      = (DMUS_PLAYMODE_SCALE_ROOT or DMUS_PLAYMODE_SCALE_INTERVALS);
  1700.     DMUS_PLAYMODE_PURPLEIZED      = (DMUS_PLAYMODE_SCALE_INTERVALS or DMUS_PLAYMODE_CHORD_INTERVALS or DMUS_PLAYMODE_CHORD_ROOT);
  1701.     DMUS_PLAYMODE_NORMALCHORD     = (DMUS_PLAYMODE_CHORD_ROOT or DMUS_PLAYMODE_CHORD_INTERVALS);
  1702. type
  1703.     PDMUS_IO_TIMESIG = ^TDMUS_IO_TIMESIG;
  1704.     TDMUS_IO_TIMESIG = record
  1705.        // Time signatures define how many beats per measure, which note receives
  1706.        // the beat, and the grid resolution.
  1707.        bBeatsPerMeasure: BYTE;   // beats per measure (top of time sig)
  1708.        bBeat: BYTE;              // what note receives the beat (bottom of time sig.)
  1709.                                  // we can assume that 0 means 256th note
  1710.        wGridsPerBeat: WORD;      // grids per beat
  1711.     end;
  1712.     PDMUS_IO_STYLE = ^TDMUS_IO_STYLE;
  1713.     TDMUS_IO_STYLE = record
  1714.        timeSig: TDMUS_IO_TIMESIG; // Styles have a default Time Signature
  1715.        dblTempo: DOUBLE;
  1716.     end;
  1717.     PDMUS_IO_VERSION = ^TDMUS_IO_VERSION;
  1718.     TDMUS_IO_VERSION = record
  1719.        dwVersionMS: DWORD; // Version # high-order 32 bits
  1720.        dwVersionLS: DWORD; // Version # low-order 32 bits
  1721.     end;
  1722.     PDMUS_IO_PATTERN = ^TDMUS_IO_PATTERN;
  1723.     TDMUS_IO_PATTERN = record
  1724.        timeSig: TDMUS_IO_TIMESIG;// Patterns can override the Style's Time sig.
  1725.        bGrooveBottom: BYTE;      // bottom of groove range
  1726.        bGrooveTop: BYTE;         // top of groove range
  1727.        wEmbellishment: WORD;     // Fill, Break, Intro, End, Normal, Motif
  1728.        wNbrMeasures: WORD;       // length in measures
  1729.     end;
  1730.     PDMUS_IO_STYLEPART = ^TDMUS_IO_STYLEPART;
  1731.     TDMUS_IO_STYLEPART = record
  1732.        tieSig: TDMUS_IO_TIMESIG;                  // can override pattern's
  1733.        dwVariationChoices: array[0..31] of DWORD; // MOAW choice bitfield
  1734.        guidPartID: TGUID;                         // identifies the part
  1735.        wNbrMeasures: WORD;                        // length of the Part
  1736.        bPlayModeFlags: BYTE;                      // see PLAYMODE flags
  1737.        bInvertUpper: BYTE;                        // inversion upper limit
  1738.        bInvertLower: BYTE;                        // inversion lower limit
  1739.     end;
  1740.     PDMUS_IO_PARTREF = ^TDMUS_IO_PARTREF;
  1741.     TDMUS_IO_PARTREF = record
  1742.        guidPartID: TGUID;       // unique ID for matching up with parts
  1743.        wLogicalPartID: WORD;    // corresponds to port/device/midi channel
  1744.        bVariationLockID: BYTE;  // parts with the same ID lock variations.
  1745.                                 // high bit is used to identify master Part
  1746.        bSubChordLevel: BYTE;    // tells which sub chord level this part wants
  1747.        bPriority: BYTE;         // 256 priority levels. Parts with lower priority
  1748.                                 // aren't played first when a device runs out of
  1749.                                 // notes
  1750.        bRandomVariation: BYTE;  // when set, matching variations play in random order
  1751.                                 // when clear, matching variations play sequentially
  1752.     end;
  1753.     PDMUS_IO_STYLENOTE = ^TDMUS_IO_STYLENOTE;
  1754.     TDMUS_IO_STYLENOTE = record
  1755.         mtGridStart: TMUSIC_TIME;   // when this note occurs
  1756.         dwVariation: DWORD;         // variation bits
  1757.         mtDuration: TMUSIC_TIME;    // how long this note lasts
  1758.         nTimeOffset: Smallint;      // offset from mtGridStart
  1759.         wMusicValue: WORD;          // Position in scale.
  1760.         bVelocity: BYTE;            // Note velocity.
  1761.         bTimeRange: BYTE;           // Range to randomize start time.
  1762.         bDurRange: BYTE;            // Range to randomize duration.
  1763.         bVelRange: BYTE;            // Range to randomize velocity.
  1764.         bInversionID: BYTE;         // Identifies inversion group to which this note belongs
  1765.         bPlayModeFlags: BYTE;       // Can override part
  1766.     end;
  1767.     PDMUS_IO_STYLECURVE = ^TDMUS_IO_STYLECURVE;
  1768.     TDMUS_IO_STYLECURVE = record
  1769.         mtGridStart: TMUSIC_TIME;    // when this curve occurs
  1770.         dwVariation: DWORd;          // variation bits
  1771.         mtDuration: TMUSIC_TIME;     // how long this curve lasts
  1772.         mtResetDuration: TMUSIC_TIME;// how long after the end of the curve to reset the curve
  1773.         nTimeOffset: Smallint;       // offset from mtGridStart
  1774.         nStartValue: Smallint;       // curve's start value
  1775.         nEndValue: Smallint;         // curve's end value
  1776.         nResetValue: Smallint;       // the value to which to reset the curve
  1777.         bEventType: BYTE;            // type of curve
  1778.         bCurveShape: BYTE;           // shape of curve
  1779.         bCCData: BYTE;               // CC#
  1780.         bFlags: BYTE;                // Bit 1=TRUE means to send nResetValue. Otherwise, don't.
  1781.                                      // Other bits are reserved.
  1782.     end;
  1783. (*******************************************************************************
  1784. RIFF
  1785. (
  1786.     'STYL'          // Style
  1787.     <styh-ck>       // Style header chunk
  1788.     <guid-ck>       // Every Style has a GUID
  1789.     [<INFO-list>]   // Name, author, copyright info., comments
  1790.     [<vers-ck>]     // version chunk
  1791.     <part-list>...  // List of parts in the Style, used by patterns
  1792.     <pttn-list>...  // List of patterns in the Style
  1793.     <DMBD-form>...  // List of bands in the Style
  1794.     [<motf-list>]   // List of motifs in the Style
  1795. )
  1796.     // <styh-ck>
  1797.     styh
  1798.     (
  1799.         <DMUS_IO_STYLE>
  1800.     )
  1801.     // <guid-ck>
  1802.     guid
  1803.     (
  1804.         <GUID>
  1805.     )
  1806.     // <vers-ck>
  1807.     vers
  1808.     (
  1809.         <DMUS_IO_VERSION>
  1810.     )
  1811.     // <part-list>
  1812.     LIST
  1813.     (
  1814.         'part'
  1815.         <prth-ck>       // Part header chunk
  1816.         [<INFO-list>]
  1817.         [<note-ck>]     // List of notes in Part
  1818.         [<crve-ck>]     // List of curves in Part
  1819.     )
  1820.         // <orth-ck>
  1821.         prth
  1822.         (
  1823.             <DMUS_IO_STYLEPART>
  1824.         )
  1825.         // <note-ck>
  1826.         'note'
  1827.         (
  1828.             // sizeof DMUS_IO_STYLENOTE:DWORD
  1829.             <DMUS_IO_STYLENOTE>...
  1830.         )
  1831.         // <crve-ck>
  1832.         'crve'
  1833.         (
  1834.             // sizeof DMUS_IO_STYLECURVE:DWORD
  1835.             <DMUS_IO_STYLECURVE>...
  1836.         )
  1837.     // <pttn-list>
  1838.     LIST
  1839.     (
  1840.         'pttn'
  1841.         <ptnh-ck>       // Pattern header chunk
  1842.         <rhtm-ck>       // List of rhythms for chord matching
  1843.         [<INFO-list>]
  1844.         <pref-list>...  // List of part reference id's
  1845.     )
  1846.         // <ptnh-ck>
  1847.         ptnh
  1848.         (
  1849.             <DMUS_IO_PATTERN>
  1850.         )
  1851.         // <rhtm-ck>
  1852.         'rhtm'
  1853.         (
  1854.             // DWORD's representing rhythms for chord matching based on number
  1855.             // of measures in the pattern
  1856.         )
  1857.         // pref-list
  1858.         LIST
  1859.         (
  1860.             'pref'
  1861.             <prfc-ck>   // part ref chunk
  1862.         )
  1863.         // <prfc-ck>
  1864.         prfc
  1865.         (
  1866.             <DMUS_IO_PARTREF>
  1867.         )
  1868. *******************************************************************************)
  1869. const
  1870.     // Chord and command file formats
  1871.     DMUS_FOURCC_CHORDTRACK_LIST        = 1685221219; // mmioFOURCC('c','o','r','d')
  1872.     DMUS_FOURCC_CHORDTRACKHEADER_CHUNK = 1751413347; // mmioFOURCC('c','r','d','h')
  1873.     DMUS_FOURCC_CHORDTRACKBODY_CHUNK   = 1650750051; // mmioFOURCC('c','r','d','b')
  1874.     DMUS_FOURCC_COMMANDTRACK_CHUNK     = 1684958563; // mmioFOURCC('c','m','n','d')
  1875. type
  1876.     PDMUS_IO_CHORD = ^TDMUS_IO_CHORD;
  1877.     TDMUS_IO_CHORD = record
  1878.        wszName: array[0..15]of WCHAR;// Name of the chord
  1879.        mtTime: TMUSIC_TIME;          // Time of this chord
  1880.        wMeasure: WORD;               // Measure this falls on
  1881.        bBeat: BYTE;                  // Beat this falls on
  1882.     end;
  1883.     PDMUS_IO_SUBCHORD = ^TDMUS_IO_SUBCHORD;
  1884.     TDMUS_IO_SUBCHORD = record
  1885.        dwChordPattern: DWORD;    // Notes in the subchord
  1886.        dwScalePattern: DWORD;    // Notes in the scale
  1887.        dwInversionPoints: DWORD; // Where inversions can occur
  1888.        dwLevels: DWORD;          // Which levels are supported by this subchord
  1889.        bChordRoot: BYTE;         // Root of the subchord
  1890.        bScaleRoot: BYTE;         // Root of the scale
  1891.     end;
  1892.     PDMUS_IO_COMMAND = ^TDMUS_IO_COMMAND;
  1893.     TDMUS_IO_COMMAND = record
  1894.        mtTime: TMUSIC_TIME;  // Time of this command
  1895.        wMeasure: WORD;       // Measure this falls on
  1896.        bBeat: BYTE;          // Beat this falls on
  1897.        bCommand: BYTE;       // Command type (see #defines below)
  1898.        bGrooveLevel: BYTE;   // Groove level (0 if command is not a groove)
  1899.        bGrooveRange: BYTE;   // Groove range
  1900.     end;
  1901. (*******************************************************************************
  1902.     // <chrd-list>
  1903.     LIST
  1904.     (
  1905.         'chrd'
  1906.         <crdh-ck>
  1907.         <crdb-ck>       // Chord body chunk
  1908.     )
  1909.         // <crdh-ck>
  1910.         crdh
  1911.         (
  1912.             // Scale: dword (upper 8 bits for root, lower 24 for scale)
  1913.         )
  1914.         // <crdb-ck>
  1915.         crdb
  1916.         (
  1917.             // sizeof DMUS_IO_CHORD:dword
  1918.             <DMUS_IO_CHORD>
  1919.             // # of DMUS_IO_SUBCHORDS:dword
  1920.             // sizeof DMUS_IO_SUBCHORDS:dword
  1921.             // a number of <DMUS_IO_SUBCHORD>
  1922.         )
  1923.     // <cmnd-list>
  1924.     'cmnd'
  1925.     (
  1926.         //sizeof DMUS_IO_COMMAND: DWORD
  1927.         <DMUS_IO_COMMAND>...
  1928.     )
  1929. *******************************************************************************)
  1930. (*******************************************************************************
  1931. RIFF
  1932. (
  1933.     'DMPF'          // DirectMusic Performance chunk
  1934.     [<prfh-ck>]     // Performance header chunk
  1935.     [<guid-ck>]     // GUID for performance
  1936.     [<vers-ck>]     // Optional version info
  1937.     [<INFO-list>]   // Name, author, copyright info., comments
  1938.     [<ptgl-list>]   // List of Port groups, which are lists of desired port properties and
  1939.                     // the PChannels to assign the Port.
  1940.     [<ntfl-list>]   // List of notifications
  1941.     [<glbl-list>]   // List of global data
  1942.     [<DMTG-form>]   // Optional ToolGraph
  1943. )
  1944.     // <prfh-ck>
  1945.     'prfh'          // Performance header
  1946.     (
  1947.         <DMUS_IO_PERFORMANCE_HEADER>
  1948.     )
  1949.     // <guid-ck>
  1950.     'guid'
  1951.     (
  1952.         <GUID>
  1953.     )
  1954.     // <vers-ck>
  1955.     vers
  1956.     (
  1957.         <DMUS_IO_VERSION>
  1958.     )
  1959.     // <ptgl-list>
  1960.     LIST
  1961.     (
  1962.         'ptgl'          // List of Port groups
  1963.         <pspl-list>     // List of support items for this group
  1964.     )
  1965.     // <ntfl-list>
  1966.     LIST
  1967.     (
  1968.         'ntfl'          // List of notifications
  1969.         <guid-ck>       // Notification guid
  1970.     )
  1971.     // <glbl-list>
  1972.     LIST
  1973.     (
  1974.         'glbl'          // List of global data
  1975.         <glbd-ck>       // The data.
  1976.     )
  1977.         // <glbd-ck>
  1978.         'glbd'
  1979.         (
  1980.             <DMUS_IO_GLOBAL_DATA>
  1981.         )
  1982. // <pspl-list>
  1983. LIST
  1984. (
  1985.     'pspl'              // List of port support items
  1986.     <psph-ck>           // Port support item header chunk
  1987.     <pchn-ck>           // PChannels that want this Port
  1988. )
  1989.     // <pchn-ck>
  1990.     'pchn'
  1991.     (
  1992.         <DMUS_IO_PCHANNELS>
  1993.     )
  1994.     // <psph-ck>            // Port support item header chunk
  1995.     (
  1996.         'psph'              // Port support item header
  1997.         <DMUS_IO_PORT_SUPPORT_HEADER>
  1998.     )
  1999. *******************************************************************************)
  2000. //  File io for DirectMusic Tool and ToolGraph objects
  2001. const
  2002.     // RIFF ids:
  2003.     DMUS_FOURCC_TOOLGRAPH_FORM = 1196707140; // mmioFOURCC('D','M','T','G')
  2004.     DMUS_FOURCC_TOOL_LIST      = 1819045748; // mmioFOURCC('t','o','l','l')
  2005.     DMUS_FOURCC_TOOL_FORM      = 1280593220; // mmioFOURCC('D','M','T','L')
  2006.     DMUS_FOURCC_TOOL_CHUNK     = 1751936884; // mmioFOURCC('t','o','l','h')
  2007. // io structures:
  2008. type
  2009.     PDMUS_IO_TOOL_HEADER = ^TDMUS_IO_TOOL_HEADER;
  2010.     TDMUS_IO_TOOL_HEADER = record
  2011.        guidClassID: TGUID;    // Class id of tool.
  2012.        lIndex: DWORD;         // Position in graph.
  2013.        cPChannels: DWORD;     // Number of items in channels array.
  2014.        ckid: FOURCC;          // chunk ID of tool's data chunk if 0 fccType valid.
  2015.        fccType: FOURCC;       // list type if NULL ckid valid.
  2016.        dwPChannels: array[0..0] of DWORD; // Array of PChannels, size determined by cPChannels.
  2017.     end;
  2018. (*******************************************************************************
  2019. RIFF
  2020. (
  2021.     'DMTG'          // DirectMusic ToolGraph chunk
  2022.     [<guid-ck>]     // GUID for ToolGraph
  2023.     [<vers-ck>]     // Optional version info
  2024.     [<INFO-list>]   // Name, author, copyright info., comments
  2025.     <toll-list>     // List of Tools
  2026. )
  2027.     // <guid-ck>
  2028.     'guid'
  2029.     (
  2030.         <GUID>
  2031.     )
  2032.     // <vers-ck>
  2033.     vers
  2034.     (
  2035.         <DMUS_IO_VERSION>
  2036.     )
  2037.     // <toll-list>
  2038.     LIST
  2039.     (
  2040.         'toll'          // List of tools
  2041.         <DMTL-form>...  // Each tool is encapsulated in a RIFF chunk
  2042.     )
  2043. // <DMTL-form>      // Tools can be embedded in a graph or stored as separate files.
  2044. RIFF
  2045. (
  2046.     'DMTL'
  2047.     <tolh-ck>
  2048.     [<guid-ck>]     // Optional GUID for tool object instance (not to be confused with Class id in track header)
  2049.     [<vers-ck>]     // Optional version info
  2050.     [<INFO-list>]   // Optional name, author, copyright info., comments
  2051.     [<data>]        // Tool data. Must be a RIFF readable chunk.
  2052. )
  2053.     // <tolh-ck>            // Tool header chunk
  2054.     (
  2055.         'tolh'
  2056.         <DMUS_IO_TOOL_HEADER>   // Tool header
  2057.     )
  2058. *******************************************************************************)
  2059. //  File io for DirectMusic Band Track object
  2060. const
  2061.    // RIFF ids:
  2062.    DMUS_FOURCC_BANDTRACK_FORM  = 1413631300; // mmioFOURCC('D','M','B','T')
  2063.    DMUS_FOURCC_BANDTRACK_CHUNK = 1752458338; // mmioFOURCC('b','d','t','h')
  2064.    DMUS_FOURCC_BANDS_LIST      = 1818518124; // mmioFOURCC('l','b','d','l')
  2065.    DMUS_FOURCC_BAND_LIST       = 1684955756; // mmioFOURCC('l','b','n','d')
  2066.    DMUS_FOURCC_BANDITEM_CHUNK  = 1751737442; // mmioFOURCC('b','d','i','h')
  2067. //  io structures
  2068. type
  2069.     PDMUS_IO_BAND_TRACK_HEADER = ^TDMUS_IO_BAND_TRACK_HEADER;
  2070.     TDMUS_IO_BAND_TRACK_HEADER = record
  2071.        bAutoDownload: BOOL;     // Determines if Auto-Download is enabled.
  2072.     end;
  2073.     PDMUS_IO_BAND_ITEM_HEADER = ^TDMUS_IO_BAND_ITEM_HEADER;
  2074.     TDMUS_IO_BAND_ITEM_HEADER = record
  2075.        lBandTime: TMUSIC_TIME;  // Position in track list.
  2076.     end;
  2077. (*******************************************************************************
  2078. RIFF
  2079. (
  2080.     'DMBT'          // DirectMusic Band Track form-type
  2081.     [<bdth-ck>]     // Band track header
  2082.     [<guid-ck>]     // GUID for band track
  2083.     [<vers-ck>]     // Optional version info
  2084.     [<INFO-list>]   // Name, author, copyright info., comments
  2085.     <lbdl-list>     // List of Band Lists
  2086. )
  2087.     // <bnth-ck>
  2088.     'bdth'
  2089.     (
  2090.         <DMUS_IO_BAND_TRACK_HEADER>
  2091.     )
  2092.     // <guid-ck>
  2093.     'guid'
  2094.     (
  2095.         <GUID>
  2096.     )
  2097.     // <vers-ck>
  2098.     vers
  2099.     (
  2100.         <DMUS_IO_VERSION>
  2101.     )
  2102.     // <lbdl-list>
  2103.     LIST
  2104.     (
  2105.         'lbdl'          // List of bands
  2106.         <lbnd-list>     // Each band is encapsulated in a list
  2107.     )
  2108.         // <lbnd-list>
  2109.         LIST
  2110.         (
  2111.             'lbnd'
  2112.             <bdih-ck>
  2113.             <DMBD-form> // Band
  2114.         )
  2115.             // <bdih-ck>            // band item header
  2116.             (
  2117.                 <DMUS_IO_BAND_ITEM_HEADER>  // Band item header
  2118.             )
  2119. *******************************************************************************)
  2120. //  File io for DirectMusic Band object
  2121. const
  2122.      // RIFF ids:
  2123.      DMUS_FOURCC_BAND_FORM          = 1145195844; // mmioFOURCC('D','M','B','D')
  2124.      DMUS_FOURCC_INSTRUMENTS_LIST   = 1818845804; // mmioFOURCC('l','b','i','l')
  2125.      DMUS_FOURCC_INSTRUMENT_LIST    = 1852400236; // mmioFOURCC('l','b','i','n')
  2126.      DMUS_FOURCC_INSTRUMENT_CHUNK   = 1936615778; // mmioFOURCC('b','i','n','s')
  2127. const
  2128.      // Flags for DMUS_IO_INSTRUMENT
  2129.      DMUS_IO_INST_PATCH          = (1 shl 0);        // dwPatch is valid.
  2130.      DMUS_IO_INST_BANKSELECT_MSB = (1 shl 1);        // dwPatch contains a valid Bank Select MSB part
  2131.      DMUS_IO_INST_BANKSELECT_LSB = (1 shl 2);        // dwPatch contains a valid Bank Select LSB part
  2132.      DMUS_IO_INST_ASSIGN_PATCH   = (1 shl 3);        // dwAssignPatch is valid
  2133.      DMUS_IO_INST_NOTERANGES     = (1 shl 4);        // dwNoteRanges is valid
  2134.      DMUS_IO_INST_PAN            = (1 shl 5);        // bPan is valid
  2135.      DMUS_IO_INST_VOLUME         = (1 shl 6);        // bVolume is valid
  2136.      DMUS_IO_INST_TRANSPOSE      = (1 shl 7);        // nTranspose is valid
  2137.      DMUS_IO_INST_GM             = (1 shl 8);        // Instrument is from GM collection
  2138.      DMUS_IO_INST_GS             = (1 shl 9);        // Instrument is from GS collection
  2139.      DMUS_IO_INST_VPATCH         = (1 shl 10);       // Instrument dwPatch is a virtual patch
  2140. //  io structures
  2141. type
  2142.     PDMUS_IO_INSTRUMENT = ^TDMUS_IO_INSTRUMENT;
  2143.     TDMUS_IO_INSTRUMENT = record
  2144.        dwPatch: DWORD;                    // MSB, LSB and Program change to define instrument
  2145.        dwAssignPatch: DWORD;              // MSB, LSB and Program change to assign to instrument when downloading
  2146.        dwNoteRanges: array[0..3] of DWORD;// 128 bits; one for each MIDI note instrument needs to able to play
  2147.        dwPChannel: DWORD;                 // PChannel instrument plays on
  2148.        dwFlags: DWORD;                    // DMUS_IO_INST_ flags
  2149.        bPan: Byte;                        // Pan for instrument
  2150.        bVolume: Byte;                     // Volume for instrument
  2151.        nTranspose: Smallint;              // Number of semitones to transpose notes
  2152.     end;
  2153. (*******************************************************************************
  2154. // <DMBD-form> bands can be embedded in other forms
  2155. RIFF
  2156. (
  2157.     'DMBD'          // DirectMusic Band chunk
  2158.     [<guid-ck>]     // GUID for band
  2159.     [<vers-ck>]     // Optional version info
  2160.     [<INFO-list>]   // Name, author, copyright info., comments
  2161.     <lbil-list>     // List of Instruments
  2162. )
  2163.     // <guid-ck>
  2164.     'guid'
  2165.     (
  2166.         <GUID>
  2167.     )
  2168.     // <vers-ck>
  2169.     vers
  2170.     (
  2171.         <DMUS_IO_VERSION>
  2172.     )
  2173.     // <lbil-list>
  2174.     LIST
  2175.     (
  2176.         'lbil'          // List of instruments
  2177.         <lbin-list>     // Each instrument is encapsulated in a list
  2178.     )
  2179.         // <lbin-list>
  2180.         LIST
  2181.         (
  2182.             'lbin'
  2183.             <bins-ck>
  2184.             [<DMRF-list>]       // Optional reference to DLS Collection file.
  2185.         )
  2186.             // <bins-ck>            // Instrument chunk
  2187.             (
  2188.                 'bins'
  2189.                 <DMUS_IO_INSTRUMENT>    // Instrument header
  2190.             )
  2191. *******************************************************************************)
  2192. //  File io for DirectMusic Segment object
  2193. const
  2194.      // RIFF ids:
  2195.      DMUS_FOURCC_SEGMENT_FORM   = 1196641604; // mmioFOURCC('D','M','S','G')
  2196.      DMUS_FOURCC_SEGMENT_CHUNK  = 1751606643; // mmioFOURCC('s','e','g','h')
  2197.      DMUS_FOURCC_TRACK_LIST     = 1818980980; // mmioFOURCC('t','r','k','l')
  2198.      DMUS_FOURCC_TRACK_FORM     = 1263816004; // mmioFOURCC('D','M','T','K')
  2199.      DMUS_FOURCC_TRACK_CHUNK    = 1751872116; // mmioFOURCC('t','r','k','h')
  2200. //  io structures:
  2201. type
  2202.     PDMUS_IO_SEGMENT_HEADER = ^TDMUS_IO_SEGMENT_HEADER;
  2203.     TDMUS_IO_SEGMENT_HEADER = record
  2204.        dwRepeats: DWORD;         // Number of repeats. By default, 0.
  2205.        mtLength: TMUSIC_TIME;    // Length, in music time.
  2206.        mtPlayStart: TMUSIC_TIME; // Start of playback. By default, 0.
  2207.        mtLoopStart: TMUSIC_TIME; // Start of looping portion. By default, 0.
  2208.        mtLoopEnd : TMUSIC_TIME;  // End of loop. Must be greater than dwPlayStart. By default equal to length.
  2209.        dwResolution: DWORD;      // Default resolution.
  2210.     end;
  2211.     PDMUS_IO_TRACK_HEADER = ^TDMUS_IO_TRACK_HEADER;
  2212.     TDMUS_IO_TRACK_HEADER = record
  2213.        guidClassID: TGUID;    //* Class id of track.
  2214.        dwPosition: DWORD;     // Position in track list.
  2215.        dwGroup: DWORD;        // Group bits for track.
  2216.        ckid: FOURCC;          // chunk ID of track's data chunk if 0 fccType valid.
  2217.        fccType: FOURCC;       // list type if NULL ckid valid
  2218.     end;
  2219. (*******************************************************************************
  2220. RIFF
  2221. (
  2222.     'DMSG'          // DirectMusic Segment chunk
  2223.     <segh-ck>       // Segment header chunk
  2224.     [<guid-ck>]     // GUID for segment
  2225.     [<vers-ck>]     // Optional version info
  2226.     [<INFO-list>]   // Name, author, copyright info., comments
  2227.     <trkl-list>     // List of Tracks
  2228.     [<DMTG-form>]   // Optional ToolGraph
  2229. )
  2230.     // <segh-ck>        
  2231.     'segh'
  2232.     (
  2233.         <DMUS_IO_SEGMENT_HEADER>
  2234.     )
  2235.     
  2236.     // <guid-ck>
  2237.     'guid'
  2238.     (
  2239.         <GUID>
  2240.     )
  2241.     // <vers-ck>
  2242.     vers
  2243.     (
  2244.         <DMUS_IO_VERSION>
  2245.     )
  2246.     // <trkl-list>
  2247.     LIST
  2248.     (
  2249.         'trkl'          // List of tracks
  2250.         <DMTK-form>...  // Each track is encapsulated in a RIFF chunk
  2251.     )
  2252. // <DMTK-form>      // Tracks can be embedded in a segment or stored as separate files.
  2253. RIFF
  2254. (
  2255.     'DMTK'
  2256.     <trkh-ck>
  2257.     [<guid-ck>]     // Optional GUID for track object instance (not to be confused with Class id in track header)
  2258.     [<vers-ck>]     // Optional version info
  2259.     [<INFO-list>]   // Optional name, author, copyright info., comments
  2260.     [<data>]        // Track data. Must be a RIFF readable chunk.
  2261. )
  2262.     // <trkh-ck>            // Track header chunk
  2263.     (
  2264.         'trkh'
  2265.         <DMUS_IO_TRACK_HEADER>  // Track header
  2266.     )
  2267. *******************************************************************************)
  2268. //  File io for DirectMusic reference chunk.
  2269. //  This is used to embed a reference to an object.
  2270. const
  2271.      //  RIFF ids:
  2272.      DMUS_FOURCC_REF_LIST       = 1179798852; // mmioFOURCC('D','M','R','F')
  2273.      DMUS_FOURCC_REF_CHUNK      = 1751541106; // mmioFOURCC('r','e','f','h')
  2274.      DMUS_FOURCC_DATE_CHUNK     = 1702125924; // mmioFOURCC('d','a','t','e')
  2275.      DMUS_FOURCC_NAME_CHUNK     = 1701667182; // mmioFOURCC('n','a','m','e')
  2276.      DMUS_FOURCC_FILE_CHUNK     = 1701603686; // mmioFOURCC('f','i','l','e')
  2277. type
  2278.     PDMUS_IO_REFERENCE = ^TDMUS_IO_REFERENCE;
  2279.     TDMUS_IO_REFERENCE = record
  2280.        guidClassID: TGUID;    // Class id is always required.
  2281.        dwValidData: DWORD;    // Flags.
  2282.     end;
  2283. (*******************************************************************************
  2284. LIST
  2285. (
  2286.     'DMRF'          // DirectMusic Reference chunk
  2287.     <refh-ck>       // Reference header chunk
  2288.     [<guid-ck>]     // Optional object GUID.
  2289.     [<date-ck>]     // Optional file date.
  2290.     [<name-ck>]     // Optional name.
  2291.     [<file-ck>]     // Optional file name.
  2292.     [<catg-ck>]     // Optional category name.
  2293.     [<vers-ck>]     // Optional version info.
  2294. )
  2295.     // <refh-ck>
  2296.     'refh'
  2297.     (
  2298.         <DMUS_IO_REFERENCE>
  2299.     )
  2300.     // <guid-ck>
  2301.     'guid'
  2302.     (
  2303.         <GUID>
  2304.     )
  2305.     // <date-ck>
  2306.     date
  2307.     (
  2308.         <FILETIME>
  2309.     )
  2310.     // <name-ck>
  2311.     name
  2312.     (
  2313.         // Name, stored as NULL terminated string of WCHARs
  2314.     )
  2315.     // <file-ck>
  2316.     file
  2317.     (
  2318.         // File name, stored as NULL terminated string of WCHARs
  2319.     )
  2320.     // <catg-ck>
  2321.     catg
  2322.     (
  2323.         // Category name, stored as NULL terminated string of WCHARs
  2324.     )
  2325.     // <vers-ck>
  2326.     vers
  2327.     (
  2328.         <DMUS_IO_VERSION>
  2329.     )
  2330. *******************************************************************************)
  2331. //  File i/o for DirectMusic Performance object
  2332. const
  2333.      //  RIFF ids:
  2334.      DMUS_FOURCC_PERFORMANCE_FORM        = 1179667780; //mmioFOURCC('D','M','P','F')
  2335.      DMUS_FOURCC_PERFORMANCE_CHUNK       = 1751544432; //mmioFOURCC('p','r','f','h')
  2336.      DMUS_FOURCC_PERF_PORTGROUP_LIST     = 1818719344; //mmioFOURCC('p','t','g','l')
  2337.      DMUS_FOURCC_PERF_NOTIFICATION_LIST  = 1818653806; //mmioFOURCC('n','t','f','l')
  2338.      DMUS_FOURCC_PERF_GLOBAL_DATA_LIST   = 1818389607; //mmioFOURCC('g','l','b','l')
  2339.      DMUS_FOURCC_PERF_SUPPORT_LIST       = 1819308912; //mmioFOURCC('p','s','p','l')
  2340.      DMUS_FOURCC_PERF_SUPPORT_CHUNK      = 1752200048; //mmioFOURCC('p','s','p','h')
  2341.      DMUS_FOURCC_PERF_PCHANNELS_CHUNK    = 1852334960; //mmioFOURCC('p','c','h','n')
  2342. //  io structures:
  2343. type
  2344.     PDMUS_IO_PERFORMANCE_HEADER = ^TDMUS_IO_PERFORMANCE_HEADER;
  2345.     TDMUS_IO_PERFORMANCE_HEADER = record
  2346.        dwPrepareTime: DWORD;  // time ahead, in ms, to transport
  2347.        dwPrePlayTime: DWORD;  // time ahead, in ms, of latency clock to pack events
  2348.     end;
  2349.     // identifies the type of data in DMUS_IO_USSupportData
  2350.     TDMUS_SUPPORTTYPE = (DMUS_ST_BOOL,DMUS_ST_DWORD,DMUS_ST_LONG);
  2351.     PDMUS_IO_SUPPORT_DATA = ^TDMUS_IO_SUPPORT_DATA;
  2352.     TDMUS_IO_SUPPORT_DATA = record  // data used in DMUS_IO_USPortSupportHeader
  2353.        typ: TDMUS_SUPPORTTYPE;      // identifies which member of the union is valid
  2354.        case integer of
  2355.          0: (fVal: BOOL);
  2356.          1: (dwVal: DWORD);
  2357.          2: (lVal: LONGINT);
  2358.     end;
  2359.     PDMUS_IO_PORT_SUPPORT_HEADER = ^TDMUS_IO_PORT_SUPPORT_HEADER;
  2360.     TDMUS_IO_PORT_SUPPORT_HEADER = record // identifies desired port properties
  2361.         guidID  : TGUID;                  // Support ID.
  2362.         lowData : TDMUS_IO_SUPPORT_DATA;  // Low range of data, inclusive. If BOOL type,
  2363.                                           // ignore highData. Otherwise, combine lowData
  2364.                                           // and highData into a range.
  2365.         highData: TDMUS_IO_SUPPORT_DATA   // High range of data, inclusive
  2366.     end;
  2367.     PDMUS_IO_PCHANNELS = ^TDMUS_IO_PCHANNELS;
  2368.     TDMUS_IO_PCHANNELS = record             // Holds the PChannels to assign to a Port
  2369.        cPChannels: DWORD;                  // Number of items in channels array.
  2370.        adwPChannels: array[0..0] of DWORD; // Array of PChannels, size determined by cPChannels.
  2371.     end;
  2372.     PDMUS_IO_GLOBAL_DATA = ^TDMUS_IO_GLOBAL_DATA;
  2373.     TDMUS_IO_GLOBAL_DATA = record // Holds the global data information
  2374.        guid: TGUID;               // The global data guid
  2375.        dwSize: DWORD;             // The size of the data
  2376.        acData: array[0..0]of Char;// Holds the data of the global data, size determine by dwSize
  2377.     end;
  2378. // personalities
  2379. const
  2380.      // runtime chunks
  2381.      DMUS_FOURCC_PERSONALITY_FORM    = 1380994372; //mmioFOURCC('D','M','P','R')
  2382.      DMUS_FOURCC_IOPERSONALITY_CHUNK = 1752327536; //mmioFOURCC('p','e','r','h')
  2383.      DMUS_FOURCC_SUBCHORD_CHUNK      = 1952737379; //mmioFOURCC('c','h','d','t')
  2384.      DMUS_FOURCC_CHORDENTRY_CHUNK    = 1751476323; //mmioFOURCC('c','h','e','h')
  2385.      DMUS_FOURCC_SUBCHORDID_CHUNK    = 1852007027; //mmioFOURCC('s','b','c','n')
  2386.      DMUS_FOURCC_IONEXTCHORD_CHUNK   = 1685218158; //mmioFOURCC('n','c','r','d')
  2387.      DMUS_FOURCC_NEXTCHORDSEQ_CHUNK  = 1903387502; //mmioFOURCC('n','c','s','q')
  2388.      DMUS_FOURCC_IOSIGNPOST_CHUNK    = 1752395891; //mmioFOURCC('s','p','s','h')
  2389.      DMUS_FOURCC_CHORDNAME_CHUNK     = 1296125513; //mmioFOURCC('I','N','A','M')
  2390.      // runtime list chunks
  2391.      DMUS_FOURCC_CHORDENTRY_LIST     = 1701800035; //mmioFOURCC('c','h','o','e')
  2392.      DMUS_FOURCC_CHORDMAP_LIST       = 1885433187; //mmioFOURCC('c','m','a','p')
  2393.      DMUS_FOURCC_CHORD_LIST          = 1685219427; //mmioFOURCC('c','h','r','d')
  2394.      DMUS_FOURCC_CHORDPALETTE_LIST   = 1819306083; //mmioFOURCC('c','h','p','l')
  2395.      DMUS_FOURCC_CADENCE_LIST        = 1701077347; //mmioFOURCC('c','a','d','e')
  2396.      DMUS_FOURCC_SIGNPOSTITEM_LIST   = 1953722483; //mmioFOURCC('s','p','s','t')
  2397.      DMUS_FOURCC_SIGNPOST_LIST       = 1903390835; //mmioFOURCC('s','p','s','q')
  2398. // run time data structs
  2399. type
  2400.     PDMUS_IO_PERSONALITY = ^TDMUS_IO_PERSONALITY;
  2401.     TDMUS_IO_PERSONALITY = record
  2402.        wszLoadName: array[0..19] of WCHAR;
  2403.        dwScalePattern: DWORD;
  2404.        dwFlags: DWORD;
  2405.     end;
  2406.     PDMUS_IO_PERS_SUBCHORD = ^TDMUS_IO_PERS_SUBCHORD;
  2407.     TDMUS_IO_PERS_SUBCHORD = record
  2408.         dwChordPattern: DWORD;
  2409.         dwScalePattern: DWORD;
  2410.         dwInvertPattern: DWORD;
  2411.         bChordRoot: BYTE;
  2412.         bScaleRoot: BYTE;
  2413.         wCFlags: WORD;
  2414.         dwLevels: DWORD;// parts or which subchord levels this chord supports
  2415.     end;
  2416.     PDMUS_IO_CHORDENTRY = ^TDMUS_IO_CHORDENTRY;
  2417.     TDMUS_IO_CHORDENTRY = record
  2418.         dwFlags: DWORD;
  2419.         wConnectionID: WORD;  // replaces runtime "pointer to this"
  2420.     end;
  2421.     PDMUS_IO_NEXTCHORD = ^TDMUS_IO_NEXTCHORD;
  2422.     TDMUS_IO_NEXTCHORD = record
  2423.        dwFlags: DWORD;
  2424.        nWeight: WORD;
  2425.        wMinBeats: WORD;
  2426.        wMaxBeats: WORd;
  2427.        wConnectionID: WORD;  // points to an ioChordEntry
  2428.     end;
  2429.     PDMUS_IO_PERS_SIGNPOST = ^TDMUS_IO_PERS_SIGNPOST;
  2430.     TDMUS_IO_PERS_SIGNPOST = record
  2431.        dwChords: DWORD;   // 1bit per group
  2432.        dwFlags: DWORD;
  2433.     end;
  2434. (*******************************************************************************
  2435. RIFF
  2436. (
  2437.     'DMPR'
  2438.     <perh-ck>           // Personality header chunk
  2439.     [<guid-ck>]         // guid chunk
  2440.     [<vers-ck>]         // version chunk (two DWORDS)
  2441.     <INFO-list>         // standard MS Info chunk
  2442.     <chdt-ck>           // subchord database
  2443.     <chpl-list>         // chord palette
  2444.     <cmap-list>         // chord map
  2445.     <spst-list>         // signpost list
  2446.  )
  2447.  <chdt> ::= chdt(<cbChordSize::WORD>  <ioSubChord> ... )
  2448. <chpl-list> ::= LIST('chpl'
  2449.                                 <chrd-list> ... // chord definition
  2450.                              )
  2451. <chrd-list> ::= LIST('chrd'
  2452.                                 <INAM-ck>   // name of chord in wide char format
  2453.                                 <sbcn-ck>   // list of subchords composing chord
  2454.                                 [<ched-ck>] //  optional chord edit flags
  2455.                                 )
  2456. <cmap-list> ::= LIST('cmap' <choe-list> )
  2457. <choe-list> ::= LIST('choe'
  2458.                                 <cheh-ck>   // chord entry data
  2459.                                 <chrd-list> // chord definition
  2460.                                 <ncsq-ck>   // connecting(next) chords
  2461.                                 )
  2462. <spst-list> ::= LIST('spst'
  2463.                              <spsh-ck>
  2464.                              <chrd-list>
  2465.                              [<cade-list>]
  2466.                              )
  2467. <cade-list> ::= LIST('cade' <chrd-list> ...)
  2468. <sbcn-ck> ::= sbcn(<cSubChordID:WORD>)
  2469. <cheh-ck> ::= cheh(i<DMUS_IO_CHORDENTRY>)
  2470. <ncrd-ck> ::= ncrd(<DMUS_IO_NEXTCHORD>)
  2471. <ncsq-ck> ::= ncsq(<wNextChordSize:WORD> <DMUS_IO_NEXTCHORD>...)
  2472. <spsh-ck> ::= spsh(<DMUS_IO_PERS_SIGNPOST>)
  2473. *******************************************************************************)
  2474. const
  2475.      // Signpost tracks
  2476.      DMUS_FOURCC_SIGNPOST_TRACK_CHUNK  = 1886283635; //   mmioFOURCC( 's', 'g', 'n', 'p' )
  2477. type
  2478.     PDMUS_IO_SIGNPOST = ^TDMUS_IO_SIGNPOST;
  2479.     TDMUS_IO_SIGNPOST = record
  2480.        mtTime: TMUSIC_TIME;
  2481.        dwChords: DWORD;
  2482.        wMeasure: WORD;
  2483.     end;
  2484. (*******************************************************************************
  2485.     // <sgnp-list>
  2486.     'sgnp'
  2487.     (
  2488.         //sizeof DMUS_IO_SIGNPOST: DWORD
  2489.         <DMUS_IO_SIGNPOST>...
  2490.     )
  2491. *******************************************************************************)
  2492. const
  2493.      DMUS_FOURCC_MUTE_CHUNK = 1702131053; // mmioFOURCC('m','u','t','e')
  2494. type
  2495.     PDMUS_IO_MUTE = ^TDMUS_IO_MUTE;
  2496.     TDMUS_IO_MUTE = record
  2497.        mtTime: TMUSIC_TIME;
  2498.        dwPChannel: DWORD;
  2499.        dwPChannelMap: DWORD;
  2500.     end;
  2501. (*******************************************************************************
  2502.     // <mute-list>
  2503.     'mute'
  2504.     (
  2505.         //sizeof DMUS_IO_MUTE:DWORD
  2506.         <DMUS_IO_MUTE>...
  2507.     )
  2508. *******************************************************************************)
  2509. // Used for both style and personality tracks
  2510. const
  2511.      DMUS_FOURCC_TIME_STAMP_CHUNK = 1886221427; //   mmioFOURCC('s', 't', 'm', 'p')
  2512.      // Style tracks
  2513.      DMUS_FOURCC_STYLE_TRACK_LIST = 1920234611; //   mmioFOURCC('s', 't', 't', 'r')
  2514.      DMUS_FOURCC_STYLE_REF_LIST   = 1718776947; //   mmioFOURCC('s', 't', 'r', 'f')
  2515. (*******************************************************************************
  2516.     // <sttr-list>
  2517.     LIST('sttr'
  2518.     (
  2519.         // some number of <strf-list>
  2520.     )
  2521.     // <strf-list>
  2522.     LIST('strf'
  2523.     (
  2524.         <stmp-ck>
  2525.         <DMRF>
  2526.     )
  2527.     // <stmp-ck> defined in ..dmcomposdmcompp.h
  2528. *******************************************************************************)
  2529. const
  2530.      // Personality tracks
  2531.      DMUS_FOURCC_PERS_TRACK_LIST = 1920231024; //mmioFOURCC('p', 'f', 't', 'r')
  2532.      DMUS_FOURCC_PERS_REF_LIST   = 1718773360; //mmioFOURCC('p', 'f', 'r', 'f')
  2533. (*
  2534.     // <pftr-list>
  2535.     LIST('pftr'
  2536.     (
  2537.         // some number of <pfrf-list>
  2538.     )
  2539.     // <pfrf-list>
  2540.     LIST('pfrf'
  2541.     (
  2542.         <stmp-ck>
  2543.         <DMRF>
  2544.     )
  2545.   // <stmp-ck>
  2546.   'stmp'
  2547.   (
  2548.     // time:DWORD
  2549.   )
  2550. *******************************************************************************)
  2551. const
  2552.      DMUS_FOURCC_TEMPO_TRACK   = 1920230772; //  mmioFOURCC('t','e','t','r')
  2553. (*******************************************************************************
  2554.     // tempo list
  2555.     'tetr'
  2556.     (
  2557.         // sizeof DMUS_IO_TEMPO_ITEM: DWORD
  2558.         <DMUS_IO_TEMPO_ITEM>...
  2559.     )
  2560. *******************************************************************************)
  2561. const
  2562.      DMUS_FOURCC_SEQ_TRACK  = 1920233843;//  mmioFOURCC('s','q','t','r')
  2563. (*******************************************************************************
  2564.     // sequence track
  2565.     'sqtr'
  2566.     (
  2567.         // sizeof DMUS_IO_SEQ_ITEM: DWORD
  2568.         <DMUS_IO_SEQ_ITEM>...
  2569.     )
  2570. *******************************************************************************)
  2571. const
  2572.      DMUS_FOURCC_CURVE_TRACK  = 1920235107;//   mmioFOURCC('c','v','t','r')
  2573. (*******************************************************************************
  2574.     // curve track
  2575.     'cvtr'
  2576.     (
  2577.         // sizeof DMUS_IO_CURVE_ITEM: DWORD
  2578.         <DMUS_IO_CURVE_ITEM>...
  2579.     )
  2580. *******************************************************************************)
  2581. const
  2582.      DMUS_FOURCC_SYSEX_TRACK    = 2020833651;// mmioFOURCC('s','y','s','x')
  2583. (*******************************************************************************
  2584.     // sysex track
  2585.     'sysx'
  2586.     (
  2587.         // list of:
  2588.         // {
  2589.         //      time of the sys-ex message: long
  2590.         //      length of the sys-ex data: DWORD
  2591.         //      sys-ex: data
  2592.         // }...
  2593.     )
  2594. *******************************************************************************)
  2595. const
  2596.      DMUS_FOURCC_TIMESIGNATURE_TRACK = 1936550260; //mmioFOURCC('t','i','m','s');
  2597. (*******************************************************************************
  2598.     // time signature track
  2599.     'tims'
  2600.     (
  2601.         // size of DMUS_IO_TIMESIGNATURE_ITEM : DWORD
  2602.         <DMUS_IO_TIMESIGNATURE_ITEM>...
  2603.     )
  2604. *)
  2605. implementation
  2606. end.