ReactOS  0.4.15-dev-1206-g731eddf
mme.c
Go to the documentation of this file.
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 #define NDEBUG
16 #include <debug.h>
17 
18 /*
19  Sends a message to the client (application), such as WOM_DONE. This
20  is just a wrapper around DriverCallback which translates the
21  parameters appropriately.
22 */
23 
24 BOOL
26  SessionInfo* session_info,
27  DWORD message,
28  DWORD_PTR parameter1,
29  DWORD_PTR parameter2)
30 {
31  return DriverCallback(session_info->callback,
32  HIWORD(session_info->flags),
33  session_info->mme_handle,
34  message,
35  session_info->app_user_data,
36  parameter1,
37  parameter2);
38 }
39 
40 
41 
42 /*
43  MME Driver Entrypoint
44  Wave Output
45 */
46 
50  UINT message,
51  DWORD_PTR private_handle,
52  DWORD_PTR parameter1,
53  DWORD_PTR parameter2)
54 {
55  switch ( message )
56  {
57  /* http://www.osronline.com/ddkx/w98ddk/mmedia_4p80.htm */
58  case WODM_GETNUMDEVS :
59  DPRINT("WODM_GETNUMDEVS\n");
61 
62  /* http://www.osronline.com/ddkx/w98ddk/mmedia_4p6h.htm */
63  case WODM_GETDEVCAPS :
64  DPRINT("WODM_GETDEVCAPS\n");
66  device_id,
67  parameter1,
68  parameter2);
69 
70  /* http://www.osronline.com/ddkx/w98ddk/mmedia_4p85.htm */
71  case WODM_OPEN :
72  {
73  WAVEOPENDESC* open_desc = (WAVEOPENDESC*) parameter1;
74  DPRINT("WODM_OPEN\n");
75 
76  if ( parameter2 && WAVE_FORMAT_QUERY )
77  return QueryWaveFormat(WaveOutDevice, open_desc->lpFormat);
78  else
80  device_id,
81  open_desc,
82  parameter2,
83  private_handle);
84  }
85 
86  /* http://www.osronline.com/ddkx/w98ddk/mmedia_4p6g.htm */
87  case WODM_CLOSE :
88  {
89  DPRINT("WODM_CLOSE\n");
90  return CloseDevice(private_handle);
91  }
92 
93  /* http://www.osronline.com/ddkx/w98ddk/mmedia_4p9w.htm */
94  case WODM_WRITE :
95  {
96  DPRINT("WODM_WRITE\n");
97  return WriteWaveBuffer(private_handle,
98  (PWAVEHDR) parameter1,
99  parameter2);
100  }
101 
102  /* http://www.osronline.com/ddkx/w98ddk/mmedia_4p86.htm */
103  case WODM_PAUSE :
104  {
105  DPRINT("WODM_PAUSE\n");
106  return HandleBySessionThread(private_handle, message, 0);
107  }
108 
109  /* http://www.osronline.com/ddkx/w98ddk/mmedia_4p89.htm */
110  case WODM_RESTART :
111  {
112  DPRINT("WODM_RESTART\n");
113  return HandleBySessionThread(private_handle, message, 0);
114  }
115 
116  /* http://www.osronline.com/ddkx/w98ddk/mmedia_4p88.htm */
117  case WODM_RESET :
118  {
119  DPRINT("WODM_RESET\n");
120  return HandleBySessionThread(private_handle, message, 0);
121  }
122 
123  /* http://www.osronline.com/ddkx/w98ddk/mmedia_4p83.htm */
124 #if 0
125  case WODM_GETPOS :
126  {
127  DPRINT("WODM_GETPOS\n");
128  return GetPosition(private_handle,
129  (PMMTIME) parameter1,
130  parameter2);
131  }
132 #endif
133 
134  /* http://www.osronline.com/ddkx/w98ddk/mmedia_4p6f.htm */
135  case WODM_BREAKLOOP :
136  {
137  DPRINT("WODM_BREAKLOOP\n");
138  return HandleBySessionThread(private_handle, message, 0);
139  }
140 
141  /* TODO: Others */
142  }
143 
144  DPRINT("Unsupported message\n");
145  return MMSYSERR_NOTSUPPORTED;
146 }
MMRESULT CloseDevice(DeviceInfo *device_info)
Definition: beepmidi.c:383
#define WODM_PAUSE
Definition: mmddk.h:115
#define WAVE_FORMAT_QUERY
Definition: mmsystem.h:188
Definition: tftpd.h:59
DWORD WriteWaveBuffer(DWORD_PTR private_handle, PWAVEHDR wave_header, DWORD wave_header_size)
Definition: wave.c:372
#define WODM_GETDEVCAPS
Definition: mmddk.h:109
DWORD flags
Definition: mmdrv.h:153
#define WODM_RESTART
Definition: mmddk.h:116
#define WODM_OPEN
Definition: mmddk.h:110
DWORD APIENTRY wodMessage(UINT device_id, UINT message, DWORD_PTR private_handle, DWORD_PTR parameter1, DWORD_PTR parameter2)
Definition: mme.c:48
DWORD_PTR app_user_data
Definition: mmdrv.h:150
MMRESULT OpenDevice(DeviceInfo **private_data, MIDIOPENDESC *open_desc, DWORD flags)
Definition: beepmidi.c:264
unsigned int BOOL
Definition: ntddk_ex.h:94
UINT device_id
Definition: mmdrv.h:134
void DPRINT(...)
Definition: polytest.cpp:61
DWORD QueryWaveFormat(DeviceType device_type, PVOID lpFormat)
Definition: wave.c:335
#define WODM_BREAKLOOP
Definition: mmddk.h:125
#define WODM_WRITE
Definition: mmddk.h:114
LPWAVEFORMATEX lpFormat
Definition: mmddk.h:399
unsigned long DWORD
Definition: ntddk_ex.h:95
#define MMSYSERR_NOTSUPPORTED
Definition: mmsystem.h:104
HDRVR mme_handle
Definition: mmdrv.h:141
DWORD_PTR callback
Definition: mmdrv.h:151
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define WODM_CLOSE
Definition: mmddk.h:111
unsigned int UINT
Definition: ndis.h:50
DWORD GetDeviceCount(DeviceType device_type)
Definition: common.c:58
BOOL NotifyClient(SessionInfo *session_info, DWORD message, DWORD_PTR parameter1, DWORD_PTR parameter2)
Definition: mme.c:25
#define WODM_GETPOS
Definition: mmddk.h:118
#define HIWORD(l)
Definition: typedefs.h:247
BOOL WINAPI DriverCallback(DWORD dwCallBack, UINT uFlags, HDRVR hDev, UINT wMsg, DWORD dwUser, DWORD dwParam1, DWORD dwParam2)
DWORD HandleBySessionThread(DWORD_PTR private_handle, DWORD_PTR message, DWORD_PTR parameter)
Definition: session.c:240
MMRESULT GetDeviceCapabilities(MIDIOUTCAPS *caps)
Definition: beepmidi.c:210
DWORD GetPosition(DWORD private_handle, PMMTIME time, DWORD time_size)
#define APIENTRY
Definition: api.h:79
#define WODM_RESET
Definition: mmddk.h:117
#define WODM_GETNUMDEVS
Definition: mmddk.h:108