Idf.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394
  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 - 1999 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. #ifndef __IDF_H__
  23. #define __IDF_H__
  24. /*
  25. @doc EXTERNAL SDK
  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. @field DWORD | cbStruct |
  32. This is the inclusive size of the header structure.
  33. @field DWORD | dwVersion |
  34. This is the version of the IDF file.
  35. under.
  36. @field DWORD | dwCreator |
  37. This is the creator ID for the IDF.
  38. @field DWORD | cbInstID |
  39. This is the size of the unique instrument identifier including the NULL.
  40. @field BYTE | abInstID[] |
  41. This is the actual ASCII bytes of the unique instrument id. This _IS_
  42. NULL terminated. There is no UNICODE version of this since this will
  43. only be used internally and not displayed to the user.
  44. @othertype IDFHEADER * | PIDFHEADER |
  45. A memory model dependant pointer to the structure.
  46. @othertype IDFHEADER FAR* | LPIDFHEADER |
  47. A far pointer to the structure.
  48. */
  49. typedef struct tag_IDFHEADER
  50. {
  51. DWORD cbStruct;
  52. DWORD dwVersion;
  53. DWORD dwCreator;
  54. DWORD cbInstID;
  55. BYTE abInstID[1];
  56. } IDFHEADER, *PIDFHEADER, FAR *LPIDFHEADER;
  57. /*
  58. @doc EXTERNAL SDK
  59. @types IDFINSTINFO |
  60. This is the format of the "inst" chunk in a Microsoft IDF file.
  61. This chunk will contain information on the instrument, e.g. who
  62. manufactured it, the name of the instrument, it's manufacturer and
  63. product id's and a revision number.
  64. @field DWORD | cbStruct |
  65. This is the inclusive size of the instrument information structure.
  66. @field DWORD | dwManufactID |
  67. Manufacturer's ID.
  68. @field DWORD | dwProductID |
  69. Product's ID.
  70. @field DWORD | dwRevision |
  71. Revision of the product.
  72. @field DWORD | cbManufactASCII |
  73. Length of the ASCII version of the manufacturuers name.
  74. @field DWORD | cbManufactUNICODE |
  75. Length of the UNICODE version of the manufacturuers name.
  76. @field DWORD | cbProductASCII |
  77. Length of the ASCII version of the product name.
  78. @field DWORD | cbProductUNICODE |
  79. Length of the UNICODE version of the product name.
  80. @field BYTE | abData[] |
  81. Contains the ASCII and UNICODE strings for the manufacturer and product
  82. names. NOTE that all strings are separated by a NULL and the NULL IS
  83. counted in the string lengths.
  84. @othertype IDFINSTINFO * | PIDFINSTINFO |
  85. A memory model dependant pointer to the structure.
  86. @othertype IDFINSTINFO FAR * | LPIDFINSTINFO |
  87. A far pointer to the structure.
  88. @comm The idea is that the cbManufactXXXXX and cbProductXXXXX will be the
  89. offsets into the bData array of bytes and it will contain a complete
  90. string that you can strcpy out. That is why the NULL is included in
  91. the byte count and in the actual data.
  92. */
  93. typedef struct tag_IDFINSTINFO
  94. {
  95. DWORD cbStruct;
  96. DWORD dwManufactID;
  97. DWORD dwProductID;
  98. DWORD dwRevision;
  99. DWORD cbManufactASCII;
  100. DWORD cbManufactUNICODE;
  101. DWORD cbProductASCII;
  102. DWORD cbProductUNICODE;
  103. BYTE abData[1];
  104. } IDFINSTINFO, FAR *LPIDFINSTINFO;
  105. /*
  106. @doc EXTERNAL SDK
  107. @types IDFINSTCAPS |
  108. This is the format of the "caps" chunk in a Microsoft IDF file.
  109. This chunk will contain information on the MIDI capabilities of
  110. the device. e.g. basic channel of the instrument, number of channels
  111. that the instrument has available. the polyphony of the instrument,
  112. whether or not it supports General MIDI, etc....
  113. @field DWORD | cbStruct |
  114. This is the size of the capabilities structure.
  115. @field DWORD | fdwFlags |
  116. Flags specifiying additional capabilities of an instrument.
  117. @flag IDFINSTCAPS_F_GENERAL_MIDI |
  118. Instrument supports General MIDI.
  119. @flag IDFINSTCAPS_F_SYSTEMEXCLUSIVE |
  120. Instrument supports system exclusive messages
  121. @field DWORD | dwBasicChannel |
  122. The basic channel for the instrument.
  123. @field DWORD | cNumChannels |
  124. Number of channels that the instrument supports to.
  125. @field DWORD | cInstrumentPolyphony |
  126. The total polyphony for the instrument.
  127. @field DWORD | cChannelPolyphony |
  128. The polyphony per channel.
  129. @othertype IDFINSTCAPS * | PIDFINSTCAPS |
  130. A memory model dependant pointer to the structure.
  131. @othertype IDFINSTCAPS FAR * | LPIDFINSTCAPS |
  132. A far pointer to the structure.
  133. */
  134. typedef struct tag_IDFINSTCAPS
  135. {
  136. DWORD cbStruct;
  137. DWORD fdwFlags;
  138. DWORD dwBasicChannel;
  139. DWORD cNumChannels;
  140. DWORD cInstrumentPolyphony;
  141. DWORD cChannelPolyphony;
  142. } IDFINSTCAPS, *PIDFINSTCAPS, FAR *LPIDFINSTCAPS;
  143. #define IDFINSTCAPS_F_GENERAL_MIDI 0x00000001
  144. #define IDFINSTCAPS_F_SYSTEMEXCLUSIVE 0x00000002
  145. /*
  146. @doc EXTERNAL SDK
  147. @types IDFCHANNELHDR |
  148. This is the format of the "chan" chunk in a Microsoft IDF file.
  149. This contains a description on what "type" a channel is, i.e.
  150. is it a General MIDI channel, a drum channel, etc... Directly
  151. following this header is the actual data on each channel.
  152. @field DWORD | cbStruct |
  153. This is the size of the channel header structure.
  154. @field DWORD | fdwFlags |
  155. Flags describing the channel type information.
  156. @flag IDFCHANNELHDR_F_GENERAL_MIDI |
  157. If this flag is set then any channels that are not defined in the
  158. IDF are General MIDI channel types. If this flag is _NOT_ set then
  159. any channels that are not defined in the IDF are undefined and should
  160. NOT be used in mapping. This flag overrides the contents of dwGeneralMask
  161. and dwDrumMask.
  162. @field DWORD | dwGeneralMask |
  163. This mask indicates which channels are available for
  164. use as general channels. The channels will be considered usable even if
  165. there is no associcate IDFCHANNELINFO structure defined.
  166. @field DWORD | dwDrumMask |
  167. This mask indicates which channels are available for
  168. use as drum channels. The channels will be considered usable even if
  169. there is no associcate IDFCHANNELINFO structure defined.
  170. @field DWORD | cNumChannels |
  171. This is the number of channels that follows the header.
  172. @othertype IDFCHANNELHDR * | PIDFCHANNELHDR |
  173. A memory model dependant pointer to the structure.
  174. @othertype IDFCHANNELHDR FAR * | LPIDFCHANNELHDR |
  175. A far pointer to the structure.
  176. */
  177. typedef struct tag_IDFCHANNELHDR
  178. {
  179. DWORD cbStruct;
  180. DWORD dwGeneralMask;
  181. DWORD dwDrumMask;
  182. DWORD dwReserved; // Must be zero
  183. DWORD fdwFlags;
  184. } IDFCHANNELHDR, *PIDFCHANNELHDR, FAR *LPIDFCHANNELHDR;
  185. #define IDFCHANNELHDR_F_GENERAL_MIDI 0x00000001
  186. /*
  187. @doc EXTERNAL SDK
  188. @types IDFCHANNELINFO |
  189. This is the format of the actual channel information for Microsoft
  190. authored IDF files. This is the Microsoft supported format for
  191. channel information.
  192. @field DWORD | dwChannel |
  193. This is the channel number that the structure defines.
  194. @field DWORD | fdwChannel |
  195. Defines the possible types this channel can be.
  196. @flag IDFCHANNELINFO_F_GENERAL_CHANNEL |
  197. Indicates that this channel may be a general channel.
  198. @flag IDFCHANNELINFO_F_DRUM_CHANNEL |
  199. Indicates that this channel may be a drum channel.
  200. @field DWORD | cbInitData |
  201. Specifies the length of the data which should be sent to initialize
  202. the channel. This data will be send to initialize the channel each
  203. time the mapper is opened.
  204. @field BYTE | abData[] |
  205. This field contains the actual initialization data.
  206. <f cbInitData> should indicate the length of this sequence,
  207. byte aligned. However, the actual sequence should be padded so that
  208. it is actually DWORD aligned (i.e. even multiple
  209. of four bytes). <f cbStruct> should reflect the padded length of
  210. the sequences.
  211. @othertype IDFCHANNELINFO * | PIDFCHANNELINFO |
  212. A memory model dependant pointer to the structure.
  213. @othertype IDFCHANNELINFO FAR * | LPIDFCHANNELINFO |
  214. A far pointer to the structure.
  215. */
  216. typedef struct tag_IDFCHANNELINFO
  217. {
  218. DWORD cbStruct;
  219. DWORD dwChannel;
  220. DWORD cbInitData;
  221. BYTE abData[];
  222. } IDFCHANNELINFO, *PIDFCHANNELINFO, FAR *LPIDFCHANNELINFO;
  223. /*
  224. @doc EXTERNAL SDK
  225. @types IDFPATCHMAPHDR |
  226. This is the format of the "map " chunk in a Microsoft IDF file.
  227. This chunk contains information on the patch map used for the
  228. instrument. Directly following this header is the actual mapping
  229. information for each patch.
  230. @field DWORD | cbStruct |
  231. This is the size of the patch map header structure.
  232. @field BYTE | abPatchMap[128] |
  233. This array contains the actual patch map. The incoming patch is
  234. used to index the array; the array contents are the new patch value
  235. and must be in the range 0x00-0x7F. Patch maps will only apply to
  236. channels of type general. If the instrument needs a patch change
  237. on a drum channel, it should be included in the initialization data
  238. in the IDFCHANNELINFO.
  239. @othertype IDFPATCHMAPHDR * | PIDFPATCHMAPHDR |
  240. A memory model dependant pointer to the structure.
  241. @othertype IDFPATCHMAPHDR FAR * | LPIDFPATCHMAPHDR |
  242. A far pointer to the structure.
  243. */
  244. typedef struct tag_IDFPATCHMAPHDR
  245. {
  246. DWORD cbStruct;
  247. BYTE abPatchMap[128];
  248. } IDFPATCHMAPHDR, *PIDFPATCHMAPHDR, FAR *LPIDFPATCHMAPHDR;
  249. /*
  250. @doc EXTERNAL SDK
  251. @types IDFKEYMAPHDR |
  252. This is the format of the "key " chunk in a Microsoft IDF file.
  253. This chunk contains information on the all of the key maps used
  254. for a given instrument. The information that is in this structure
  255. pertains to all of the key maps for the instrument. It contains
  256. the total number of key maps for the instrument and whether or not
  257. the key maps are General MIDI.
  258. @field DWORD | cbStruct |
  259. This is the size of the key map header structure.
  260. @field DWORD | cNumKeyMaps |
  261. This is the number of key maps that follow the header.
  262. @field DWORD | cbKeyMap |
  263. This is the size of each key map that follows the header.
  264. @othertype IDFPATCHMAPHDR * | PIDFPATCHMAPHDR |
  265. A memory model dependant pointer to the structure.
  266. @othertype IDFPATCHMAPHDR FAR * | LPIDFPATCHMAPHDR |
  267. A far pointer to the structure.
  268. */
  269. typedef struct tag_IDFKEYMAPHDR
  270. {
  271. DWORD cbStruct;
  272. DWORD cNumKeyMaps;
  273. DWORD cbKeyMap;
  274. } IDFKEYMAPHDR, *PIDFKEYMAPHDR, FAR *LPIDFKEYMAPHDR;
  275. /*
  276. @doc EXTERNAL SDK
  277. @types IDFKEYMAP |
  278. This is the format of the "gkey" or "dkey" chunk in a Microsoft
  279. IDF file. This chunk contains information on the all of the key maps
  280. used for a given instrument. The information that is in this structure
  281. pertains to all of the key maps for the instrument. It contains
  282. the total number of key maps for the instrument and whether or not
  283. the key maps are General MIDI.
  284. @field DWORD | cbStruct |
  285. This is the size of the key map header structure.
  286. @field BYTE | abKeyMap[128] |
  287. This field contains the actual key map. The incoming key number from
  288. a note on or note off message is used to index this array; the array
  289. contents are the new key value. If the high bit it set in the new
  290. key value, then the note on or note off will be ignore; otherwise,
  291. it will be transmitted with the new key value.
  292. @othertype IDFKEYMAP * | PIDFKEYMAP |
  293. A memory model dependant pointer to the structure.
  294. @othertype IDFKEYMAP FAR * | LPIDFKEYMAP |
  295. A far pointer to the structure.
  296. */
  297. typedef struct tag_IDFKEYMAP
  298. {
  299. DWORD cbStruct;
  300. BYTE abKeyMap[128];
  301. } IDFKEYMAP, *PIDFKEYMAP, FAR *LPIDFKEYMAP;
  302. #endif