home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / include / idf.h < prev    next >
Text File  |  1998-04-25  |  13KB  |  391 lines

  1. //************************************************************************
  2. //**
  3. //**  THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
  4. //**  ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED
  5. //**  TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR
  6. //**  A PARTICULAR PURPOSE.
  7. //**
  8. //**  Copyright (C) 1993 - 1995 Microsoft Corporation. All Rights Reserved.
  9. //**
  10. //**  IDF.h
  11. //**
  12. //**  DESCRIPTION:
  13. //**     This file contains the format of the .IDF files.
  14. //**
  15. //**  HISTORY:
  16. //**     04/29/93       created.
  17. //**     07/04/93       added UNICODE for displayable strings.
  18. //**     09/04/93       added keymaps.
  19. //**     09/05/93       added ID's for channel types.
  20. //**
  21. //************************************************************************
  22.  
  23. /*
  24. @doc  EXTERNAL SDK
  25.  
  26. @types   IDFHEADER |
  27.    This is the format of the "hdr " chunk in a Microsoft IDF file.
  28.    This will be the first subchunk of a "MMAP" list chunk.  This will 
  29.    provide information on the IDF itself; what version, who created it,
  30.    and a unique ASCII ID for the instrument.
  31.  
  32. @field   DWORD | cbStruct |
  33.    This is the inclusive size of the header structure.
  34.  
  35. @field   DWORD | dwVersion |
  36.    This is the version of the IDF file.
  37.    under.
  38.  
  39. @field   DWORD | dwCreator |
  40.    This is the creator ID for the IDF.
  41.  
  42. @field   DWORD | cbInstID |
  43.    This is the size of the unique instrument identifier including the NULL.
  44.  
  45. @field   BYTE | abInstID[] |
  46.    This is the actual ASCII bytes of the unique instrument id. This _IS_ 
  47.    NULL terminated.  There is no UNICODE version of this since this will
  48.    only be used internally and not displayed to the user.
  49.  
  50. @othertype  IDFHEADER * | PIDFHEADER |
  51.    A memory model dependant pointer to the structure.
  52.  
  53. @othertype  IDFHEADER FAR* | LPIDFHEADER |
  54.    A far pointer to the structure.
  55. */
  56.  
  57. typedef struct tag_IDFHEADER
  58. {
  59.    DWORD cbStruct;
  60.  
  61.    DWORD dwVersion;
  62.    DWORD dwCreator;
  63.  
  64.    DWORD cbInstID;
  65.    BYTE  abInstID[1];
  66. } IDFHEADER, *PIDFHEADER, FAR *LPIDFHEADER;
  67.  
  68. /*
  69. @doc  EXTERNAL SDK
  70.  
  71. @types   IDFINSTINFO |
  72.    This is the format of the "inst" chunk in a Microsoft IDF file.
  73.    This chunk will contain information on the instrument, e.g. who
  74.    manufactured it, the name of the instrument, it's manufacturer and
  75.    product id's and a revision number.
  76.  
  77. @field   DWORD | cbStruct |
  78.    This is the inclusive size of the instrument information structure.
  79.  
  80. @field   DWORD | dwManufactID |
  81.    Manufacturer's ID.
  82.  
  83. @field   DWORD | dwProductID |
  84.    Product's ID.
  85.  
  86. @field   DWORD | dwRevision |
  87.    Revision of the product.
  88.  
  89. @field   DWORD | cbManufactASCII |
  90.    Length of the ASCII version of the manufacturuers name.
  91.  
  92. @field   DWORD | cbManufactUNICODE |
  93.    Length of the UNICODE version of the manufacturuers name.
  94.  
  95. @field   DWORD | cbProductASCII |
  96.    Length of the ASCII version of the product name.
  97.  
  98. @field   DWORD | cbProductUNICODE |
  99.    Length of the UNICODE version of the product name.
  100.  
  101. @field   BYTE | abData[] |
  102.    Contains the ASCII and UNICODE strings for the manufacturer and product
  103.    names.  NOTE that all strings are separated by a NULL and the NULL IS
  104.    counted in the string lengths.
  105.  
  106. @othertype  IDFINSTINFO * | PIDFINSTINFO |
  107.    A memory model dependant pointer to the structure.
  108.  
  109. @othertype  IDFINSTINFO FAR * | LPIDFINSTINFO |
  110.    A far pointer to the structure.
  111.  
  112. @comm The idea is that the cbManufactXXXXX and cbProductXXXXX will be the
  113.       offsets into the bData array of bytes and it will contain a complete
  114.       string that you can strcpy out.  That is why the NULL is included in
  115.       the byte count and in the actual data.
  116. */
  117.  
  118. typedef struct tag_IDFINSTINFO
  119. {
  120.    DWORD cbStruct;
  121.  
  122.    DWORD dwManufactID;
  123.    DWORD dwProductID;
  124.    DWORD dwRevision;
  125.  
  126.    DWORD cbManufactASCII;
  127.    DWORD cbManufactUNICODE;
  128.    DWORD cbProductASCII;
  129.    DWORD cbProductUNICODE;
  130.  
  131.    BYTE  abData[1];
  132. } IDFINSTINFO, FAR *LPIDFINSTINFO;
  133.  
  134. /*
  135. @doc  EXTERNAL SDK
  136.  
  137. @types   IDFINSTCAPS |
  138.    This is the format of the "caps" chunk in a Microsoft IDF file.
  139.    This chunk will contain information on the MIDI capabilities of
  140.    the device. e.g. basic channel of the instrument, number of channels
  141.    that the instrument has available. the polyphony of the instrument, 
  142.    whether or not it supports General MIDI, etc....
  143.  
  144. @field   DWORD | cbStruct |
  145.    This is the size of the capabilities structure.
  146.  
  147. @field   DWORD | fdwFlags |
  148.    Flags specifiying additional capabilities of an instrument.
  149.  
  150. @flag IDFINSTCAPS_F_GENERAL_MIDI |
  151.    Instrument supports General MIDI.
  152.  
  153. @flag IDFINSTCAPS_F_SYSTEMEXCLUSIVE |
  154.    Instrument supports system exclusive messages
  155.  
  156. @field   DWORD | dwBasicChannel |
  157.    The basic channel for the instrument.
  158.  
  159. @field   DWORD | cNumChannels |
  160.    Number of channels that the instrument supports to.
  161.  
  162. @field   DWORD | cInstrumentPolyphony |
  163.    The total polyphony for the instrument.
  164.  
  165. @field   DWORD | cChannelPolyphony |
  166.    The polyphony per channel.
  167.  
  168. @othertype  IDFINSTCAPS * | PIDFINSTCAPS |
  169.    A memory model dependant pointer to the structure.
  170.  
  171. @othertype  IDFINSTCAPS FAR * | LPIDFINSTCAPS |
  172.    A far pointer to the structure.
  173. */
  174.  
  175. typedef struct tag_IDFINSTCAPS
  176. {
  177.    DWORD cbStruct;
  178.    DWORD fdwFlags;
  179.    DWORD dwBasicChannel;
  180.    DWORD cNumChannels;
  181.    DWORD cInstrumentPolyphony;
  182.    DWORD cChannelPolyphony;
  183. } IDFINSTCAPS, *PIDFINSTCAPS, FAR *LPIDFINSTCAPS;
  184.  
  185. #define  IDFINSTCAPS_F_GENERAL_MIDI       0x00000001
  186. #define  IDFINSTCAPS_F_SYSTEMEXCLUSIVE    0x00000002
  187.  
  188. /*
  189. @doc  EXTERNAL SDK
  190.  
  191. @types   IDFCHANNELHDR |
  192.    This is the format of the "chan" chunk in a Microsoft IDF file.
  193.    This contains a description on what "type" a channel is, i.e. 
  194.    is it a General MIDI channel, a drum channel, etc... Directly 
  195.    following this header is the actual data on each channel.
  196.  
  197. @field   DWORD | cbStruct |
  198.    This is the size of the channel header structure.
  199.  
  200. @field   DWORD | fdwFlags |
  201.    Flags describing the channel type information.
  202.  
  203. @flag IDFCHANNELHDR_F_GENERAL_MIDI |
  204.    If this flag is set then any channels that are not defined in the 
  205.    IDF are General MIDI channel types.  If this flag is _NOT_ set then
  206.    any channels that are not defined in the IDF are undefined and should 
  207.    NOT be used in mapping. This flag overrides the contents of dwGeneralMask
  208.    and dwDrumMask.
  209.  
  210. @field DWORD | dwGeneralMask |
  211.    This mask indicates which channels are available for
  212.    use as general channels. The channels will be considered usable even if
  213.    there is no associcate IDFCHANNELINFO structure defined.
  214.  
  215. @field DWORD | dwDrumMask |
  216.    This mask indicates which channels are available for
  217.    use as drum channels. The channels will be considered usable even if
  218.    there is no associcate IDFCHANNELINFO structure defined.
  219.  
  220. @field   DWORD | cNumChannels |
  221.    This is the number of channels that follows the header.
  222.  
  223. @othertype  IDFCHANNELHDR * | PIDFCHANNELHDR |
  224.    A memory model dependant pointer to the structure.
  225.  
  226. @othertype  IDFCHANNELHDR FAR * | LPIDFCHANNELHDR |
  227.    A far pointer to the structure.
  228. */
  229.  
  230. typedef struct tag_IDFCHANNELHDR
  231. {
  232.    DWORD cbStruct;
  233.    DWORD dwGeneralMask;
  234.    DWORD dwDrumMask;
  235.    DWORD dwReserved;                    // Must be zero
  236.    DWORD fdwFlags;
  237. } IDFCHANNELHDR, *PIDFCHANNELHDR, FAR *LPIDFCHANNELHDR;
  238.  
  239. #define  IDFCHANNELHDR_F_GENERAL_MIDI     0x00000001
  240.  
  241. /*
  242. @doc  EXTERNAL SDK
  243.  
  244. @types    IDFCHANNELINFO |
  245.    This is the format of the actual channel information for Microsoft
  246.    authored IDF files. This is the Microsoft supported format for
  247.    channel information.
  248.  
  249. @field   DWORD | dwChannel |
  250.    This is the channel number that the structure defines.
  251.  
  252. @field   DWORD | fdwChannel |
  253.    Defines the possible types this channel can be.
  254.  
  255.    @flag    IDFCHANNELINFO_F_GENERAL_CHANNEL |
  256.        Indicates that this channel may be a general channel.
  257.  
  258.    @flag    IDFCHANNELINFO_F_DRUM_CHANNEL |
  259.        Indicates that this channel may be a drum channel.
  260.  
  261. @field   DWORD | cbInitData |
  262.     Specifies the length of the data which should be sent to initialize
  263.     the channel. This data will be send to initialize the channel each
  264.     time the mapper is opened.
  265.  
  266. @field    BYTE | abData[] |
  267.     This field contains the actual initialization data.
  268.     <f cbInitData> should indicate the length of this sequence,
  269.     byte aligned. However, the actual sequence should be padded so that
  270.     it is actually DWORD aligned (i.e. even multiple
  271.     of four bytes). <f cbStruct> should reflect the padded length of
  272.     the sequences.
  273.         
  274. @othertype  IDFCHANNELINFO * | PIDFCHANNELINFO |
  275.    A memory model dependant pointer to the structure.
  276.  
  277. @othertype  IDFCHANNELINFO FAR * | LPIDFCHANNELINFO |
  278.    A far pointer to the structure.
  279. */
  280.  
  281. typedef struct tag_IDFCHANNELINFO
  282. {
  283.    DWORD cbStruct;
  284.    DWORD dwChannel;
  285.    DWORD cbInitData;
  286.    BYTE  abData[];
  287. } IDFCHANNELINFO, *PIDFCHANNELINFO, FAR *LPIDFCHANNELINFO;
  288.  
  289. /*
  290. @doc  EXTERNAL SDK
  291.  
  292. @types   IDFPATCHMAPHDR |
  293.    This is the format of the "map " chunk in a Microsoft IDF file.
  294.    This chunk contains information on the patch map used for the 
  295.    instrument. Directly following this header is the actual mapping 
  296.    information for each patch.
  297.  
  298. @field   DWORD | cbStruct |
  299.    This is the size of the patch map header structure.
  300.  
  301. @field   BYTE | abPatchMap[128] |
  302.    This array contains the actual patch map. The incoming patch is
  303.    used to index the array; the array contents are the new patch value
  304.    and must be in the range 0x00-0x7F. Patch maps will only apply to
  305.    channels of type general. If the instrument needs a patch change
  306.    on a drum channel, it should be included in the initialization data
  307.    in the IDFCHANNELINFO.
  308.  
  309. @othertype  IDFPATCHMAPHDR * | PIDFPATCHMAPHDR |
  310.    A memory model dependant pointer to the structure.
  311.  
  312. @othertype  IDFPATCHMAPHDR FAR * | LPIDFPATCHMAPHDR |
  313.    A far pointer to the structure.
  314. */
  315.  
  316. typedef struct tag_IDFPATCHMAPHDR
  317. {
  318.    DWORD cbStruct;
  319.    BYTE  abPatchMap[128];
  320.            
  321. } IDFPATCHMAPHDR, *PIDFPATCHMAPHDR, FAR *LPIDFPATCHMAPHDR;
  322.  
  323. /*
  324. @doc  EXTERNAL SDK
  325.  
  326. @types   IDFKEYMAPHDR |
  327.    This is the format of the "key " chunk in a Microsoft IDF file.
  328.    This chunk contains information on the all of the key maps used 
  329.    for a given instrument. The information that is in this structure
  330.    pertains to all of the key maps for the instrument.  It contains
  331.    the total number of key maps for the instrument and whether or not
  332.    the key maps are General MIDI.
  333.  
  334. @field   DWORD | cbStruct |
  335.    This is the size of the key map header structure.
  336.  
  337. @field   DWORD | cNumKeyMaps |
  338.    This is the number of key maps that follow the header.
  339.  
  340. @field   DWORD | cbKeyMap |
  341.    This is the size of each key map that follows the header.   
  342.  
  343. @othertype  IDFPATCHMAPHDR * | PIDFPATCHMAPHDR |
  344.    A memory model dependant pointer to the structure.
  345.  
  346. @othertype  IDFPATCHMAPHDR FAR * | LPIDFPATCHMAPHDR |
  347.    A far pointer to the structure.
  348. */
  349.  
  350. typedef struct tag_IDFKEYMAPHDR
  351. {
  352.    DWORD cbStruct;
  353.    DWORD cNumKeyMaps;
  354.    DWORD cbKeyMap;
  355. } IDFKEYMAPHDR, *PIDFKEYMAPHDR, FAR *LPIDFKEYMAPHDR;
  356.  
  357. /*
  358. @doc  EXTERNAL SDK
  359.  
  360. @types   IDFKEYMAP |
  361.    This is the format of the "gkey" or "dkey" chunk in a Microsoft
  362.    IDF file. This chunk contains information on the all of the key maps
  363.    used for a given instrument. The information that is in this structure
  364.    pertains to all of the key maps for the instrument.  It contains
  365.    the total number of key maps for the instrument and whether or not
  366.    the key maps are General MIDI.
  367.  
  368. @field   DWORD | cbStruct |
  369.    This is the size of the key map header structure.
  370.  
  371. @field   BYTE | abKeyMap[128] |
  372.     This field contains the actual key map. The incoming key number from
  373.     a note on or note off message is used to index this array; the array
  374.     contents are the new key value. If the high bit it set in the new
  375.     key value, then the note on or note off will be ignore; otherwise,
  376.     it will be transmitted with the new key value.
  377.     
  378. @othertype  IDFKEYMAP * | PIDFKEYMAP |
  379.    A memory model dependant pointer to the structure.
  380.  
  381. @othertype  IDFKEYMAP FAR * | LPIDFKEYMAP |
  382.    A far pointer to the structure.
  383. */
  384.  
  385. typedef struct tag_IDFKEYMAP
  386. {
  387.    DWORD cbStruct;
  388.    BYTE  abKeyMap[128];
  389. } IDFKEYMAP, *PIDFKEYMAP, FAR *LPIDFKEYMAP;
  390.  
  391.