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