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