3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: services/dd/mpu401/dll/mpu401.c
6 * PURPOSE: MPU-401 MIDI driver WINMM interface
7 * PROGRAMMER: Andrew Greenwood
9 * Sept 28, 2003: Created
21 // Erm... This is in mmsystem i think:
22 LONG APIENTRY
DefDriverProc(DWORD dwDriverIdentifier
,
24 UINT message
, // Bug in ptypes32.h
31 STATIC
int MessageLength(BYTE b
)
33 if (b
> 0xf8) return 1;
37 case 0xf0 : case 0xf4 : case 0xf5 : case 0xf6 : case 0xf7 :
39 case 0xf1 : case 0xf3 :
47 case 0x80 : case 0x90 : case 0xa0 : case 0xb0 : case 0xe0 :
51 return 0; // must be a status byte
55 DWORD APIENTRY
modMessage(DWORD id
, DWORD msg
, DWORD dwUser
,
56 DWORD dwParam1
, DWORD dwParam2
)
60 case MODM_GETNUMDEVS
:
61 DBG("MODM_GETNUMDEVS\n");
64 case MODM_GETDEVCAPS
:
65 DBG("MODM_GETDEVCAPS\n");
78 MODM_DATA requests that the driver process a short MIDI message.
83 dwParam1 : MIDI message packed into a 32-bit number
93 for (i
= 0; i
< 4; i
++)
95 b
[i
] = (BYTE
)(dwParam1
% 256);
98 // midiOutWrite(data, length, client?)
99 // somehow we need to keep track of running status
100 // return midiOutWrite(b, modMIDIlength((PMIDIALLOC)dwUser, b[0]),
101 // (PMIDIALLOC)dwUser);
105 DBG("MODM_LONGDATA\n");
112 case MODM_SETVOLUME
:
113 DBG("MODM_SETVOLUME\n");
116 case MODM_GETVOLUME
:
117 DBG("MODM_GETVOLUME\n");
120 case MODM_CACHEPATCHES
:
121 DBG("MODM_CACHEPATCHES\n");
124 case MODM_CACHEDRUMPATCHES
:
125 DBG("MODM_CACHEDRUMPATCHES\n");
129 // return MMSYSERR_NOT_SUPPORTED;
134 LRESULT
DriverProc(DWORD dwDriverID
, HDRVR hDriver
, UINT uiMessage
,
135 LPARAM lParam1
, LPARAM lParam2
)
141 Process driver messages
144 dwDriverID : Identifier of installable driver
145 hDriver : Handle of the installable driver instance
146 uiMessage : Which operation to perform
147 lParam1 : Message-dependent
148 lParam2 : Message-dependent
151 For parameters that aren't listed in the messages, they are not
154 Loading and unloading messages occur in this order:
155 DRV_LOAD - DRV_ENABLE - DRV_OPEN
156 DRV_CLOSE - DRV_DISABLE - DRV_FREE
163 DRV_LOAD notifies the driver that it has been loaded. It should
164 then make sure it can function properly.
170 Non-zero if successful
178 DRV_FREE notifies the driver that it is being unloaded. It
179 should make sure it releases any memory or other resources.
182 hDriver : Hande of the installable driver instance
192 DRV_OPEN directs the driver to open a new instance.
195 dwDriverID : Identifier of the installable driver
196 hDriver : Handle of the installable driver instance
197 lParam1 : Wide string specifying configuration
198 information, or this can be NULL
199 lParam2 : 32-bit driver-specific data
202 Non-zero if successful
210 DRV_CLOSE directs the driver to close the specified instance.
213 dwDriverID : Identifier of the installable driver
214 hDriver : Handle of the installable driver instance
215 lParam1 : 32-bit value passed from DriverClose()
216 lParam2 : 32-bit value passed from DriverClose()
219 Non-zero if successful
227 DRV_ENABLE enables the driver (as if you didn't see THAT one
231 hDriver : Handle of the installable driver instance
241 DRV_DISABLE disables the driver - see above comment ;) This
242 message comes before DRV_FREE.
245 hDriver : Handle of the installable driver instance
250 DBG("DRV_DISABLE\n");
253 case DRV_QUERYCONFIGURE
:
255 DRV_QUERYCONFIGURE asks the driver if it supports custom
259 dwDriverID : Identifier of the installable driver
260 hDriver : Handle of the installable driver instance
263 Non-zero to indicate the driver can display a config dialog
266 DBG("DRV_QUERYCONFIGURE\n");
271 DRV_CONFIGURE requests the driver to display a configuration
275 dwDriverID : Identified of the installable driver
276 hDriver : Handle of the installable driver instance
277 lParam1 : Handle of the parent window of the dialog
278 lParam2 : Address of a DRVCONFIGINFO, or NULL
281 DRVCNF_OK The configuration was successful
282 DRVCNF_CANCEL The user cancelled the dialog box
283 DRVCNF_RESTART The configuration requires a reboot
285 DBG("DRV_CONFIGURE\n");
290 DRV_INSTALL notifies the driver that it is being installed.
293 dwDriverID : Identifier of the installable driver
294 hDriver : Handle of the installable driver instance
295 lParam2 : Address of a DEVCONFIGINFO, or NULL
298 DRVCNF_OK The configuration was successful
299 DRVCNF_CANCEL The user cancelled the dialog box
300 DRVCNF_RESTART The configuration requires a reboot
302 DBG("DRV_INSTALL\n");
307 DRV_REMOVE notifies the driver that it is being removed from the
311 dwDriverID : Identifier of the installable driver
312 hDriver : Handle of the installable driver instance
322 DRV_POWER notifies the driver that power is being turned on/off.
325 dwDriverID : Identifier of the installable driver
326 hDriver : Handle of the installable driver instance
333 case DRV_EXITSESSION
:
335 DRV_EXITSESSION notifies the driver that Windows is shutting down.
338 dwDriverID : Identifier of the installable driver
339 hDriver : Handle of the installable driver instance
345 // case DRV_PNPINSTALL : break;
347 return DefDriverProc(dwDriverID
, hDriver
, uiMessage
, lParam1
, lParam2
);
350 return DefDriverProc(dwDriverID
, hDriver
, uiMessage
, lParam1
, lParam2
);
354 BOOL CALLBACK
DProc(HWND hwnd
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
356 // if (uMsg == WM_INITDIALOG)
365 // HWND Dlg = CreateDialog(GetModuleHandle(NULL), "Config", NULL, DProc);
366 HWND Z
= CreateWindow("Static", "", WS_OVERLAPPEDWINDOW
| WS_VISIBLE
, 0, 0, 20, 20, NULL
, NULL
, GetModuleHandle(NULL
), NULL
);
367 if (DialogBox(GetModuleHandle(NULL
), MAKEINTRESOURCE(1001), Z
, DProc
) == -1)
368 MessageBox(NULL
, "Error", "Error", MB_OK
| MB_TASKMODAL
);