Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

193 lines
6.5 KiB

  1. /*
  2. * MIDIMAP.H
  3. *
  4. * Copyright (C) 1990 Microsoft Corporation. All rights reserved.
  5. */
  6. /****************************************************************************
  7. MIDI output mapping definitions
  8. *****************************************************************************/
  9. /*
  10. * Error code definitions.
  11. */
  12. typedef UINT MMAPERR;
  13. #define MMAPERR_SUCCESS (MMAPERR)0 // Nothing bad happened.
  14. #define MMAPERR_FILENOTFOUND (MMAPERR)1 // midimap.cfg not found
  15. #define MMAPERR_INVALIDFLAG (MMAPERR)2 // invalid flag was passed
  16. #define MMAPERR_INVALIDPORT (MMAPERR)3 // setup accesses invalid port
  17. #define MMAPERR_INVALIDSETUP (MMAPERR)4 // invalid setup name
  18. #define MMAPERR_INVALIDPATCH (MMAPERR)5 // invalid patchmap name
  19. #define MMAPERR_INVALIDKEY (MMAPERR)6 // invalid keymap name
  20. #define MMAPERR_MEMORY (MMAPERR)7 // "Out of memory."
  21. #define MMAPERR_READ (MMAPERR)8 // "Can't read file."
  22. #define MMAPERR_WRITE (MMAPERR)9 // "Can't write file."
  23. #define MMAPERR_OPEN (MMAPERR)10 // "Can't open file."
  24. #define MMAPERR_OPEN_READONLY (MMAPERR)11 // "Can't open file (read-only)."
  25. #define MMAPERR_CREATE (MMAPERR)12 // "Can't create file."
  26. #define MMAPERR_UNDEFINED (MMAPERR)13 // "Internal error."
  27. #define MMAPERR_FULL (MMAPERR)14 // "Map table full."
  28. #define MMAPERR_MAXERROR (MMAPERR)15
  29. /*
  30. * Map flag definitions.
  31. */
  32. #define MMAP_SETUP 0x01 // map is a setup
  33. #define MMAP_PATCH 0x02 // map is a patchmap
  34. #define MMAP_KEY 0x04 // map is a keymap
  35. #define MMAP_PORTS 0xFF // enumerate ports
  36. /*
  37. * String length definitions.
  38. */
  39. #define MMAP_MAXNAME 16 // max map name length
  40. #define MMAP_MAXDESC 32 // max map description length
  41. #define MMAP_MAXCFGNAME 24 // max file name len for cfg file
  42. /*
  43. * MIDICHANNELMAP definitions.
  44. */
  45. // dwFlags
  46. #define MMAP_ACTIVE 0x00000001 // is this channel active?
  47. #define MMAP_PATCHMAP 0x00000002 // is there a patch map for
  48. // this channel?
  49. #define MMAP_ID_NOPORT 0xFFFF // chnl mapped to [none] entry
  50. /****************************************************************************
  51. MIDI output mapping support structures
  52. *****************************************************************************/
  53. typedef struct midichannelmap_tag {
  54. DWORD dwFlags; // flags for channel map
  55. WORD wDeviceID; // port ID of device
  56. WORD wChannel; // port channel of device
  57. DWORD oPMap; // offset of patch map
  58. } MIDICHANNELMAP, FAR *LPMIDICHANNELMAP;
  59. typedef struct midimap_tag {
  60. DWORD dwFlags; // flags (none defined yet)
  61. BYTE szName[MMAP_MAXNAME]; // name
  62. BYTE szDesc[MMAP_MAXDESC]; // description
  63. MIDICHANNELMAP chMap[16]; // array of channel maps
  64. } MIDIMAP, FAR *LPMIDIMAP;
  65. typedef struct midipatchmap_tag {
  66. DWORD dwFlags; // flags (none defined yet)
  67. BYTE szName[MMAP_MAXNAME]; // name
  68. BYTE szDesc[MMAP_MAXDESC]; // description
  69. WORD wPMap[MIDIPATCHSIZE]; // lobyte=patch, hibyte=volume
  70. DWORD okMaps[MIDIPATCHSIZE]; // offsets of key maps
  71. BYTE bVMax; // max volume scalar
  72. BYTE bDummy; // alignment byte
  73. WORD wDummy; // alignment word
  74. } MIDIPATCHMAP, FAR *LPMIDIPATCHMAP;
  75. typedef struct midikeymap_tag {
  76. DWORD dwFlags; // flags (none defined yet)
  77. BYTE szName[MMAP_MAXNAME]; // name
  78. BYTE szDesc[MMAP_MAXDESC]; // description
  79. BYTE bKMap[MIDIPATCHSIZE]; // xlat table for key number
  80. } MIDIKEYMAP, FAR *LPMIDIKEYMAP;
  81. /****************************************************************************
  82. MIDI output mapping support routines
  83. *****************************************************************************/
  84. typedef BOOL (CALLBACK *ENUMPROC) (LPSTR, LPSTR, UINT, HWND, LPSTR);
  85. MMAPERR FAR PASCAL mapSetCurrentSetup (LPSTR);
  86. MMAPERR FAR PASCAL mapGetCurrentSetup (LPSTR, UINT);
  87. MMAPERR FAR PASCAL mapDelete (UINT, LPSTR);
  88. MMAPERR FAR PASCAL mapEnumerate ( UINT uFlag
  89. , ENUMPROC lpfnCallback
  90. , UINT uCase // passed to lpfnCallback
  91. , HWND hCombo // passed to lpfnCallback
  92. , LPSTR lpSetupName // passed to lpfnCallback
  93. );
  94. DWORD FAR PASCAL mapGetSize (UINT, LPSTR);
  95. DWORD FAR PASCAL mapGetPatchSize(LPMIDIPATCHMAP lpPatch);
  96. MMAPERR FAR PASCAL mapRead (UINT, LPSTR, LPVOID);
  97. MMAPERR FAR PASCAL mapWrite (UINT, LPVOID);
  98. DWORD FAR PASCAL mapGetUsageCount (UINT, LPSTR);
  99. DWORD FAR PASCAL mapPatchMapInSetup (LPSTR, LPSTR);
  100. DWORD FAR PASCAL mapKeyMapInSetup (LPSTR, LPSTR);
  101. DWORD FAR PASCAL mapExists (UINT, LPSTR);
  102. MMAPERR FAR PASCAL mapInitMapFile (void);
  103. DWORD FAR PASCAL mapFileVersion (void);
  104. // services from midi.c
  105. void FAR PASCAL mapUnlock(void);
  106. BOOL FAR PASCAL mapLock(void);
  107. // death fix
  108. void FAR PASCAL mapConnect(LPSTR);
  109. void FAR PASCAL mapDisconnect(void);
  110. /************************************************************************/
  111. /*
  112. ** Edit structures.
  113. */
  114. typedef struct tagChannel {
  115. DWORD dFlags;
  116. WORD wDeviceID;
  117. WORD wChannel;
  118. char aszPatchName[MMAP_MAXNAME];
  119. } CHANNEL;
  120. typedef struct tagSetup {
  121. DWORD dFlags;
  122. char aszSetupName[MMAP_MAXNAME];
  123. char aszSetupDescription[MMAP_MAXDESC];
  124. CHANNEL channels[16];
  125. } SETUP;
  126. typedef struct tagKeyMap {
  127. BYTE bVolume;
  128. BYTE bDestination;
  129. char aszKeyMapName[MMAP_MAXNAME];
  130. } KEYMAP;
  131. typedef struct tagPatchMap {
  132. char aszPatchMapName[MMAP_MAXNAME];
  133. char aszPatchMapDescription[MMAP_MAXDESC];
  134. KEYMAP keymaps[128];
  135. } PATCHMAP;
  136. MMAPERR FAR PASCAL mapReadSetup(
  137. LPSTR lszSetupName,
  138. SETUP FAR* lpSetup);
  139. MMAPERR FAR PASCAL mapReadPatchMap(
  140. LPSTR lszPatchMapName,
  141. PATCHMAP FAR* lpPatch);
  142. /* place window so as to avoid going off screen */
  143. VOID PlaceWindow(HWND hwnd);
  144. /************************************************************************/
  145. /*
  146. ** Values used to communicate between the caller of mapEnumerate and the
  147. ** function called by mapEnumerate for each element.
  148. */
  149. #define MMENUM_BASIC 0
  150. #define MMENUM_INTOCOMBO 1
  151. #define MMENUM_DELETE 2