Windows NT 4.0 source code leak
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.

212 lines
5.2 KiB

4 years ago
  1. /****************************************************************************
  2. *
  3. * driver.h
  4. *
  5. * Copyright (c) 1991 Microsoft Corporation. All Rights Reserved.
  6. *
  7. ***************************************************************************/
  8. #include <synth.h>
  9. //
  10. // Porting stuff
  11. //
  12. #define BCODE
  13. #define _loadds
  14. #define fEnabled TRUE
  15. #define AsULMUL(a, b) ((DWORD)((DWORD)(a) * (DWORD)(b)))
  16. #define AsLSHL(a, b) ((DWORD)((DWORD)(a) << (DWORD)(b)))
  17. #define AsULSHR(a, b) ((DWORD)((DWORD)(a) >> (DWORD)(b)))
  18. #define AsMemCopy memcpy
  19. extern HANDLE MidiDeviceHandle;
  20. extern SYNTH_DATA DeviceData[];
  21. extern int MidiPosition;
  22. extern VOID MidiFlush(VOID);
  23. extern VOID MidiCloseDevice(HANDLE DeviceHandle);
  24. extern MMRESULT MidiOpenDevice(LPHANDLE lpHandle, BOOL Write);
  25. extern MMRESULT MidiSetVolume(DWORD Left, DWORD Right);
  26. extern VOID MidiCheckVolume(VOID);
  27. extern MMRESULT MidiGetVolume(LPDWORD lpVolume);
  28. #define SYNTH_DATA_SIZE 80
  29. MMRESULT MidiTranslateStatus(VOID);
  30. extern VOID FAR PASCAL MidiSendFM (DWORD wAddress, BYTE bValue);
  31. extern VOID FAR PASCAL MidiNewVolume (WORD wLeft, WORD wRight);
  32. extern WORD FAR PASCAL MidiInit (VOID);
  33. extern BYTE gbVelocityAtten[32];
  34. //
  35. // End of porting stuff
  36. //
  37. /*
  38. * midi device type - determined by kernel driver
  39. */
  40. UINT gMidiType;
  41. /*
  42. * values for gMidiType - set in MidiOpenDevice
  43. */
  44. #define TYPE_ADLIB 1
  45. #define TYPE_OPL3 2
  46. #define SYSEX_ERROR 0xFF // internal error code for sysexes on input
  47. #define STRINGLEN (100)
  48. /* number of windows which we can have registered */
  49. #define REGWINDOWS (10)
  50. /* volume defines */
  51. #define VOL_MIDI (0)
  52. #define VOL_NUMVOL (1)
  53. #define VOL_LEFT (0)
  54. #define VOL_RIGHT (1)
  55. /* strings */
  56. #define SR_ALERT 1
  57. #define SR_ALERT_IO 2
  58. #define SR_ALERT_NOIO 3
  59. #define SR_ALERT_NOPATCH 4
  60. #define SR_STR_DRIVERMIDIOUT 5
  61. #define SR_STR_VOLUME 6
  62. #define SR_ALERT_BAD 7
  63. #define SR_ALERT_CONFIGFAIL 8
  64. #define SR_ALERT_FAILREMOVE 9
  65. #define IDS_MENUABOUT 10
  66. /* MIDI defines */
  67. /* errors */
  68. #define ERR_OUTOFMEMORY (1)
  69. #define NUMCHANNELS (16)
  70. #define NUMPATCHES (256)
  71. #define DRUMCHANNEL (9) /* midi channel 10 */
  72. /****************************************************************************
  73. typedefs
  74. ***************************************************************************/
  75. // per allocation structure for midi
  76. typedef struct portalloc_tag {
  77. DWORD dwCallback; // client's callback
  78. DWORD dwInstance; // client's instance data
  79. HMIDIOUT hMidi; // handle for stream
  80. DWORD dwFlags; // allocation flags
  81. }PORTALLOC, NEAR *NPPORTALLOC;
  82. /****************************************************************************
  83. strings
  84. ***************************************************************************/
  85. #if DBG
  86. #ifndef NOSTR
  87. extern char FAR STR_DRIVER[];
  88. extern char FAR STR_MMDEBUG[];
  89. #endif // NOSTR
  90. extern WCHAR STR_CRLF[];
  91. extern WCHAR STR_SPACE[];
  92. #endif
  93. #define STR_HELPFILE TEXT("synth.hlp")
  94. #define INI_STR_PATCHLIB TEXT("Patches")
  95. #define INI_SOUND TEXT("synth.ini")
  96. #define INI_DRIVER TEXT("Driver")
  97. /****************************************************************************
  98. globals
  99. ***************************************************************************/
  100. /* midi.c */
  101. extern BYTE gbMidiInUse; /* if MIDI is in use */
  102. // in init.c
  103. extern HMODULE ghModule; // our module handle
  104. /***************************************************************************
  105. prototypes
  106. ***************************************************************************/
  107. BOOL NEAR PASCAL modSuspend(void);
  108. BOOL NEAR PASCAL modReactivate(void);
  109. // config.c
  110. int DrvInstall(void);
  111. extern int DlgAboutProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
  112. extern LRESULT ConfigRemove(HWND hDlg);
  113. // drvproc.c
  114. LRESULT DriverProc(DWORD dwDriverID, HDRVR hDriver, UINT uiMessage, LPARAM lParam1, LPARAM lParam2);
  115. // init.c
  116. void cdecl AlertBox(HWND hwnd, UINT wStrId, ...);
  117. WORD GetWindowsVersionCorrectly(void);
  118. /* midi.c */
  119. VOID NEAR PASCAL MidiMessage (DWORD dwData);
  120. DWORD modMessage(UINT id,
  121. UINT msg, DWORD dwUser, DWORD dwParam1, DWORD dwParam2);
  122. UINT MidiOpen (VOID);
  123. VOID MidiClose (VOID);
  124. void MidiReset(void);
  125. void modGetDevCaps(LPBYTE lpCaps, UINT wSize);
  126. /****************************************************************************
  127. Debug output
  128. ***************************************************************************/
  129. #if DBG
  130. extern WORD wDebugLevel; // debug level
  131. #define D1(sz) if (wDebugLevel >= 1) (OutputDebugStr(STR_CRLF),OutputDebugStr(TEXT(sz)))
  132. #define D2(sz) if (wDebugLevel >= 2) (OutputDebugStr(STR_SPACE),OutputDebugStr(TEXT(sz)))
  133. #define D3(sz) if (wDebugLevel >= 3) (OutputDebugStr(STR_SPACE),OutputDebugStr(TEXT(sz)))
  134. #define D4(sz) if (wDebugLevel >= 4) (OutputDebugStr(STR_SPACE),OutputDebugStr(TEXT(sz)))
  135. #else
  136. #define D1(sz) 0
  137. #define D2(sz) 0
  138. #define D3(sz) 0
  139. #define D4(sz) 0
  140. #endif