23639ababcdfbd05d1466928d81fd842f34ca940
[reactos.git] / reactos / dll / win32 / mmdrv / mme.c
1 /*
2 *
3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS Multimedia
5 * FILE: dll/win32/mmdrv/mme.c
6 * PURPOSE: Multimedia User Mode Driver (MME Interface)
7 * PROGRAMMER: Andrew Greenwood
8 * Aleksey Bragin
9 * UPDATE HISTORY:
10 * Jan 14, 2007: Rewritten and tidied up
11 */
12
13 #include "mmdrv.h"
14
15 /*
16 Sends a message to the client (application), such as WOM_DONE. This
17 is just a wrapper around DriverCallback which translates the
18 parameters appropriately.
19 */
20
21 BOOL
22 NotifyClient(
23 SessionInfo* session_info,
24 DWORD message,
25 DWORD_PTR parameter1,
26 DWORD_PTR parameter2)
27 {
28 return DriverCallback(session_info->callback,
29 HIWORD(session_info->flags),
30 session_info->mme_handle,
31 message,
32 session_info->app_user_data,
33 parameter1,
34 parameter2);
35 }
36
37
38
39 /*
40 MME Driver Entrypoint
41 Wave Output
42 */
43
44 DWORD APIENTRY
45 wodMessage(
46 UINT device_id,
47 UINT message,
48 DWORD_PTR private_handle,
49 DWORD_PTR parameter1,
50 DWORD_PTR parameter2)
51 {
52 switch ( message )
53 {
54 /* http://www.osronline.com/ddkx/w98ddk/mmedia_4p80.htm */
55 case WODM_GETNUMDEVS :
56 DPRINT("WODM_GETNUMDEVS\n");
57 return GetDeviceCount(WaveOutDevice);
58
59 /* http://www.osronline.com/ddkx/w98ddk/mmedia_4p6h.htm */
60 case WODM_GETDEVCAPS :
61 DPRINT("WODM_GETDEVCAPS\n");
62 return GetDeviceCapabilities(WaveOutDevice,
63 device_id,
64 parameter1,
65 parameter2);
66
67 /* http://www.osronline.com/ddkx/w98ddk/mmedia_4p85.htm */
68 case WODM_OPEN :
69 {
70 WAVEOPENDESC* open_desc = (WAVEOPENDESC*) parameter1;
71 DPRINT("WODM_OPEN\n");
72
73 if ( parameter2 && WAVE_FORMAT_QUERY )
74 return QueryWaveFormat(WaveOutDevice, open_desc->lpFormat);
75 else
76 return OpenDevice(WaveOutDevice,
77 device_id,
78 open_desc,
79 parameter2,
80 private_handle);
81 }
82
83 /* http://www.osronline.com/ddkx/w98ddk/mmedia_4p6g.htm */
84 case WODM_CLOSE :
85 {
86 DPRINT("WODM_CLOSE\n");
87 return CloseDevice(private_handle);
88 }
89
90 /* http://www.osronline.com/ddkx/w98ddk/mmedia_4p9w.htm */
91 case WODM_WRITE :
92 {
93 DPRINT("WODM_WRITE\n");
94 return WriteWaveBuffer(private_handle,
95 (PWAVEHDR) parameter1,
96 parameter2);
97 }
98
99 /* http://www.osronline.com/ddkx/w98ddk/mmedia_4p86.htm */
100 case WODM_PAUSE :
101 {
102 DPRINT("WODM_PAUSE\n");
103 return HandleBySessionThread(private_handle, message, 0);
104 }
105
106 /* http://www.osronline.com/ddkx/w98ddk/mmedia_4p89.htm */
107 case WODM_RESTART :
108 {
109 DPRINT("WODM_RESTART\n");
110 return HandleBySessionThread(private_handle, message, 0);
111 }
112
113 /* http://www.osronline.com/ddkx/w98ddk/mmedia_4p88.htm */
114 case WODM_RESET :
115 {
116 DPRINT("WODM_RESET\n");
117 return HandleBySessionThread(private_handle, message, 0);
118 }
119
120 /* http://www.osronline.com/ddkx/w98ddk/mmedia_4p83.htm */
121 #if 0
122 case WODM_GETPOS :
123 {
124 DPRINT("WODM_GETPOS\n");
125 return GetPosition(private_handle,
126 (PMMTIME) parameter1,
127 parameter2);
128 }
129 #endif
130
131 /* http://www.osronline.com/ddkx/w98ddk/mmedia_4p6f.htm */
132 case WODM_BREAKLOOP :
133 {
134 DPRINT("WODM_BREAKLOOP\n");
135 return HandleBySessionThread(private_handle, message, 0);
136 }
137
138 /* TODO: Others */
139 }
140
141 DPRINT("Unsupported message\n");
142 return MMSYSERR_NOTSUPPORTED;
143 }